jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [apps/] [platform/] [default.pm] - Rev 1

Compare with Previous - Blame - Download


package HotSaNICmod::OSdep;

my $MODNAME;

sub version {
  ($VERSION = '$Revision: 1.23 $') =~ s/.*(\d+\.\d+).*/$1/;
  return "default.pm $VERSION";
  }

sub sample {
  my %args=@_;

  my $oid = '.1.3.6.1.2.1.25.4.2.1.2'; 
            # host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunName

  undef my %localapps;

  # build local process-table first
  #
  my $command="/bin/ps axc";
  open FILE,"$command|" || HotSaNIClog::error("unable to run '$command': $!");
  $_=<FILE>;   #strip header line
  while (<FILE>) {
    chomp;
    s/ *$//;  # strip spaces
    s/^.* //; # only need last word
    $localapps{$_}++;
    }
  close FILE;

  foreach $entry (@{$args{APP}}) {
    my ($host,$community,$item,$dbname,$name,$file,$description)=HotSaNICmod::common::get_names($entry);

    if ($host eq "") {
      # query local processes
      #
      if (! exists $localapps{$item}) { $localapps{$item}=0; }
      HotSaNICmod::do_rrd($item,"U",time,$localapps{$item});
      }
    }

  }

1;


Powered by WebSVN 2.2.1