1 | 1 | simandl | package HotSaNICmod::OSdep; |
2 | | | |
3 | | | my $MODNAME; |
4 | | | |
5 | | | sub version { |
6 | | | ($VERSION = '$Revision: 1.11 $') =~ s/.*(\d+\.\d+).*/$1/; |
7 | | | return "$^O.pm $VERSION"; |
8 | | | } |
9 | | | |
10 | | | sub sample { |
11 | | | my %args=@_; |
12 | | | |
13 | | | my $oid = '.1.3.6.1.2.1.25.4.2.1.2'; |
14 | | | # host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunName |
15 | | | |
16 | | | undef my %localapps; |
17 | | | |
18 | | | # build local process-table first |
19 | | | # |
20 | | | my $command="/bin/ps -aef -o \"comm\""; |
21 | | | open FILE,"$command|" || HotSaNIClog::error("unable to run '$command': $!"); |
22 | | | my @processes=(<FILE>); |
23 | | | close FILE; |
24 | | | |
25 | | | foreach my $entry (@{$args{APP}}) { |
26 | | | my ($host,$community,$item,$dbname,$name,$file,$description)=HotSaNICmod::common::get_names($entry); |
27 | | | |
28 | | | my $num=0; |
29 | | | if ($host eq "") { |
30 | | | # query local processes |
31 | | | # |
32 | | | for (@processes) { if ( index($_,$item) >= 0 ) { $num++; } } |
33 | | | HotSaNICmod::do_rrd($item,"U",time,$num); |
34 | | | } |
35 | | | } |
36 | | | } |
37 | | | |
38 | | | 1; |
39 | | | |