/[pdpsoft]/trunk/nl.nikhef.ndpf.tools/nagios-ndpf-sensors/scripts/check_qstat
ViewVC logotype

Diff of /trunk/nl.nikhef.ndpf.tools/nagios-ndpf-sensors/scripts/check_qstat

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1503 by ronalds, Thu Nov 26 13:29:50 2009 UTC revision 1504 by ronalds, Thu Feb 11 13:19:19 2010 UTC
# Line 46  my $cmd = "$QSTAT"; Line 46  my $cmd = "$QSTAT";
46  open QSTAT, "$cmd |";  open QSTAT, "$cmd |";
47  my $ret = $?;  my $ret = $?;
48    
49    my $perfdata = "";
50    
51  if ( $ret == 0 ) {  if ( $ret == 0 ) {
52      my ( $errstr, $warnstr, $okstr );      my ( $errstr, $warnstr, $okstr );
53    
54      my %count;      my %count = ( Q => 0, R => 0 );
55      while ( <QSTAT> ) {      while ( <QSTAT> ) {
56          next unless ( /^\d+/ );             # only count lines with job ID          next unless ( /^\d+/ );             # only count lines with job ID
57          my $state = (split /\s+/)[0,4];          my $state = (split /\s+/)[0,4];
# Line 60  if ( $ret == 0 ) { Line 62  if ( $ret == 0 ) {
62      # OK: message contains no details      # OK: message contains no details
63      $message = "OK; $count{R} running, $count{Q} queued";      $message = "OK; $count{R} running, $count{Q} queued";
64      $result = $ERRORS{"OK"};      $result = $ERRORS{"OK"};
65        $perfdata = "'queued'=$count{Q};;;;; 'running'=$count{R};;;;";
66  }  }
67  else {  else {
68      # Failed to get output of pbsnodes: UNKNOWN      # Failed to get output of pbsnodes: UNKNOWN
# Line 73  alarm(0); Line 76  alarm(0);
76  close QSTAT;  close QSTAT;
77    
78  # Write output and return exit code;  # Write output and return exit code;
79  print "$message\n";  print "$message|$perfdata\n";
80  exit($result);  exit($result);
81    

Legend:
Removed from v.1503  
changed lines
  Added in v.1504

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28