jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [apps/] [platform/] [default.pm] - Blame information for rev 1

 

Line No. Rev Author Line
11simandlpackage HotSaNICmod::OSdep;
2 
3my $MODNAME;
4 
5sub version {
6 ($VERSION = '$Revision: 1.23 $') =~ s/.*(\d+\.\d+).*/$1/;
7 return "default.pm $VERSION";
8 }
9 
10sub 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 axc";
21 open FILE,"$command|" || HotSaNIClog::error("unable to run '$command': $!");
22 $_=<FILE>; #strip header line
23 while (<FILE>) {
24 chomp;
25 s/ *$//; # strip spaces
26 s/^.* //; # only need last word
27 $localapps{$_}++;
28 }
29 close FILE;
30 
31 foreach $entry (@{$args{APP}}) {
32 my ($host,$community,$item,$dbname,$name,$file,$description)=HotSaNICmod::common::get_names($entry);
33 
34 if ($host eq "") {
35 # query local processes
36 #
37 if (! exists $localapps{$item}) { $localapps{$item}=0; }
38 HotSaNICmod::do_rrd($item,"U",time,$localapps{$item});
39 }
40 }
41 
42 }
43 
441;
45 

Powered by WebSVN 2.2.1