Revision: 662
          http://sourceforge.net/p/opencsw/code/662
Author:   dmichelsen
Date:     2013-05-13 10:05:11 +0000 (Mon, 13 May 2013)
Log Message:
-----------
Add check_prtdiag for V440

Added Paths:
-----------
    mirror/check_prtdiag
    mirror/check_prtdiag.conf

Added: mirror/check_prtdiag
===================================================================
--- mirror/check_prtdiag                                (rev 0)
+++ mirror/check_prtdiag        2013-05-13 10:05:11 UTC (rev 662)
@@ -0,0 +1,390 @@
+#!/usr/bin/perl -w
+#
+# File    : check_prtdiag
+# Purpose : prtdiag output parser
+# Author  : Sébastien Phélep ([email protected])
+# Date    : 2009/01/14
+#
+
+# Required packages ========================================================= #
+use strict;
+use File::Basename;
+use Getopt::Std;
+
+# Constants ================================================================= #
+my $PROGNAME = basename($0);
+my $CONFFILE = "${PROGNAME}.conf";
+my $VERSION  = "1.12";
+
+# Globals =================================================================== #
+my %conf = ();
+my @diag = ();
+my $syst = undef;
+my $file = undef;
+my @failed = ();
+my @passed = ();
+my %options = ();
+my $verbose = undef;
+my $cfgfile = undef;
+
+# Functions ================================================================= #
+
+# Default handler for --help
+sub HELP_MESSAGE
+{
+       usage(0);
+}
+
+# Default handler for --version
+sub VERSION_MESSAGE
+{
+       usage(0);
+}
+
+# Script usage
+sub usage
+{
+       # Get exit status
+       my $status = shift;
+       my $errmsg = shift;
+
+       # We've been called with an error message.
+       # Print it to STDERR with short usage
+       if( $errmsg )
+       {
+               print STDERR "${PROGNAME}: $errmsg\n\n";
+               print STDERR "Usage: ${PROGNAME} [-hv] [-c <file>] [-f 
<file>]\n";
+               print STDERR "Try '-h' for help.\n";
+       }
+       else
+       {
+               # Print full usage to STDOUT
+               print STDOUT << "EOF";
+
+${PROGNAME} - ${VERSION}
+Search for SUN hardware errors in prtdiag output.
+
+Usage: ${PROGNAME} [-hv] [-c <file>] [-f <file>]
+
+  -f <file>            : use prtdiag output found in file
+  -c <file>            : specify alternate location for config file
+                        (default location: '$CONFFILE')
+  -h                   : this (help) message
+  -v                   : verbose output
+EOF
+       }
+
+       # Exit with specified status
+       exit($status);
+}
+
+# Main starts here =========================================================== 
#
+
+# Use getopts for processing command line options
+usage(3) unless( getopts("f:c:hv",\%options) );
+
+# Need command usage ?
+usage(0) if($options{'h'});
+
+# Initialize values
+$cfgfile = $options{'c'} ? $options{'c'} : $CONFFILE;
+$file = $options{'f'} ? $options{'f'} : undef;
+$verbose = $options{'v'} ? 1 : 0;
+
+# Go English !
+$ENV{'LANG'} = "C";
+
+# Load config file
+unless( open(CONFIG,"<${cfgfile}") )
+{
+       print STDERR "Initialization error - unable to open file '${cfgfile}' : 
$!\n";
+       exit(3);
+}
+my $section = undef;
+while(<CONFIG>)
+{
+       chomp();
+       
+       # Remove comments
+       s/#.*//;
+       
+       # Ignore blank lines
+       next if( m/^\s*$/ );
+       
+       if( m/^\s*\[\s*(.*?)\s*\]\s*$/ )
+       {
+               $section = $1;
+               next;
+       }
+       elsif( m/^\s*(.*?)\s*=\s*(.*?)\s*$/ )
+       {
+               $conf{$section}->{$1} = $2 if( defined($section) );
+       }
+}
+close(CONFIG);
+
+# Check minimum config
+unless( $file )
+{
+       unless( defined($conf{'commands'}->{'prtdiag'}) )
+       {
+               print STDERR "Initialization error - 'prtdiag' command not 
defined in file '${CONFFILE}' !\n";
+               exit(3);
+       }
+
+       # Substitute macros
+       foreach my $section ( %conf )
+       {
+               foreach my $param ( keys( %{ $conf{$section} } ) )
+               {
+                       # Command substitution
+                       if( $conf{$section}->{$param} =~ m/CMD\((.*?)\)/ )
+                       {
+                               my $command = $1;
+                               unless( defined($conf{'commands'}->{$command}) )
+                               {
+                                       print STDERR "Initialization error - 
'$command' command not defined in file '${CONFFILE}' !\n";
+                                       exit(3);
+                               }
+                       
+                               my @result = `$conf{'commands'}->{$command} 
2>&1`;
+                               unless( ($?>>8) == 0 )
+                               {
+                                       print STDERR "Initialization error - 
Failed Substitution for '$command' : @result !\n";
+                                       exit(3);
+                               }
+                       
+                               chomp($result[0]);
+                               $conf{$section}->{$param} =~ 
s/CMD\($command\)/$result[0]/;
+                       }
+               }
+       }
+}
+
+# Get prtdiag input
+unless( $file )
+{
+       unless( open(DIAG,"$conf{'commands'}->{'prtdiag'}|") )
+       {
+               print STDOUT "Failed to create pipe for command 
'".$conf{'commands'}->{'prtdiag'}."' : $!\n";
+               exit(3);
+       }
+}
+else
+{
+       unless( open(DIAG,"<$file") )
+       {
+               print STDOUT "Failed to open file '$file' for reading : $!\n";
+               exit(3);
+       }
+}
+while(<DIAG>)
+{
+       chomp();
+       s/^\s*(.*?)\s*$/$1/;
+       push(@diag,$_);
+}
+close(DIAG);
+
+# Look for system type
+unless( defined($syst) )
+{
+       FSYS:
+       foreach my $section ( keys(%conf) )
+       {
+               foreach my $param ( keys(%{ $conf{$section} }) )
+               {
+                       next unless( $param eq "system.match" );
+                       if( grep(/$conf{$section}->{'system.match'}/,@diag) )
+                       {
+                               $syst = $section;
+                               last FSYS;
+                       }
+               }
+       }
+}
+
+# Check for unidentified system type
+unless( defined($syst) )
+{
+       print STDOUT "Unable to identify system type !\n";
+       exit(3);
+}
+print STDERR "Using system type : $syst\n" if( $verbose);
+
+# Further config checks
+unless( defined($conf{$syst}->{'system.checks'}) )
+{
+       print STDOUT "Initialization failed - Missing 'system.checks' entry for 
section '$syst' in file '$CONFFILE' !\n";
+       exit(3);
+}
+my @checks = split(/\s*,\s*/,$conf{$syst}->{'system.checks'});
+if( scalar(@checks) == 0 )
+{
+       print STDOUT "No check defined in 'system.checks' entry for section 
'$syst' in file '$CONFFILE' !\n";
+       exit(3);
+}
+foreach my $check ( @checks )
+{
+       foreach my $param ( "description", "begin_match", "end_match", 
"data_match", "data_labels", "ok_condition", "output_string" )
+       {
+               my $param_name = "checks.$check.$param";
+               unless( defined($conf{$syst}->{$param_name}) )
+               {
+                       print STDOUT "Initialization error - Missing 
'$param_name' entry for section '$syst' in file '$CONFFILE' !\n";
+                       exit(3);
+               }
+       }
+}
+
+# Check'em all
+foreach my $check ( @checks )
+{
+       # Get associated data
+       my $description = $conf{$syst}->{"checks.$check.description"};
+       my @labels = 
split(/\s*,\s*/,$conf{$syst}->{"checks.$check.data_labels"});
+       my $fetch_mode = $conf{$syst}->{"checks.$check.fetch_mode"};
+       my $begin = 0;
+       my $dcount = 0;
+       my $lcount = 0;
+       my %data = ();
+       
+       print STDERR "\nChecking $description:\n" if( $verbose);
+
+       # Parse prtdiag output
+       DIAG: foreach( @diag )
+       {
+               unless( $begin )
+               {
+                       # Looking for begin pattern
+                       next DIAG unless( 
m/$conf{$syst}->{"checks.$check.begin_match"}/ );
+                       s/$conf{$syst}->{"checks.$check.begin_match"}//;
+                       $begin = 1;
+               }
+               else
+               {
+                       # Stop parsing if matched end pattern
+                       last DIAG if( 
m/$conf{$syst}->{"checks.$check.end_match"}/ );
+               }
+               
+               # Skip unwanted data
+               if( defined($conf{$syst}->{"checks.$check.skip_match"}) )
+               {
+                       next DIAG if( 
m/$conf{$syst}->{"checks.$check.skip_match"}/ );
+               }
+               
+               # Reinit read values
+               my @values = ();
+               
+               # === Fetching data in linear mode === #
+               if( defined($fetch_mode) and ($fetch_mode eq "linear") )
+               {
+                       # Use specified regexp separator, or define a default 
one
+                       my $regexp_separator = 
$conf{$syst}->{"checks.$check.data_match_regsep"} || '\s*,\s';
+
+                       # Extract regular expresssions to be used for data 
collection
+                       my @dmatch = 
split(/\s*,\s*/,$conf{$syst}->{"checks.$check.data_match"});
+                       
+                       # Take care of counters
+                       if( $lcount >= scalar(@labels) )
+                       {
+                               $lcount = 0;
+                               $dcount = $dcount + scalar(@labels) + 1;
+                       }
+                       
+                       # Get all matching values
+                       @values = m/$dmatch[$lcount]/g;
+                       
+                       # Update our hash
+                       for( my $i=0; $i < scalar(@values); $i++ )
+                       {
+                               $data{($dcount+$i)}->{$labels[$lcount]} = 
$values[$i];
+                       }
+                       $lcount++;
+                       
+                       # Next one
+                       next DIAG;
+               }
+               # === Fetching data otherwise (aka tabular mode) === #
+               else
+               {
+                       # Next one if this does not match
+                       next DIAG unless( @values = 
m/$conf{$syst}->{"checks.$check.data_match"}/g );
+                       
+                       # Update our hash
+                       for( my $i=0; $i < scalar(@values); $i++ )
+                       {
+                               # Take care of counters
+                               if( $lcount >= scalar(@labels) )
+                               {
+                                       $lcount = 0;
+                                       $dcount++;
+                               }
+                               
+                               $data{$dcount}->{$labels[$lcount]} = 
$values[$i];
+                               $lcount++;
+                       }
+               }
+       }
+       
+       # Check collected data
+       my $errors = 0;
+       my $tests = 0;
+       foreach my $dataset ( keys(%data) )
+       {
+               my $test_result = "";
+               my $ok_condition = $conf{$syst}->{"checks.$check.ok_condition"};
+               my $output_string = 
$conf{$syst}->{"checks.$check.output_string"};
+
+               # Substitute labels in condition and output string
+               foreach my $label ( keys( %{ $data{$dataset} } ) )
+               {
+                       $ok_condition =~ s/%$label%/$data{$dataset}->{$label}/g;
+                       $output_string =~ 
s/%$label%/$data{$dataset}->{$label}/g;
+               }
+               
+               # Test condition
+               if( eval($ok_condition) )
+               {
+                       # Test passed
+                       $test_result = "INF - $output_string";
+                       push(@passed,$output_string);
+               }
+               else
+               {
+                       # Test failed
+                       $test_result = "ERR - $output_string";
+                       push(@failed,$output_string);
+                       $errors++;
+                       
+               }
+               $tests++;
+               print STDERR " $test_result\n" if( $verbose);
+       }
+       print STDERR "Checked $tests component".( $tests le 1 ? "" : "s").", 
found ".( $errors == 0 ? "no error" : "$errors errors" ).".\n" if( $verbose );
+}
+
+# Analyze global results
+my $checked = scalar(@passed) + scalar(@failed);
+if( scalar(@failed) > 0 )
+{
+       print STDERR "\n" if( $verbose );
+       print STDOUT "CRITICAL - Checked $checked component".( $checked le 1 ? 
"" : "s").", found ".scalar(@failed)." errors : ".join(', ',@failed)."|";
+       print STDOUT join(', ',@passed);
+       print STDOUT "\n";
+       exit(2);
+}
+elsif( $checked == 0 )
+{
+       print STDERR "\n" if( $verbose );
+       print STDOUT "WARNING - Found nothing to check !\n";
+       exit(1);
+}
+else
+{
+       print STDERR "\n" if( $verbose );
+       print STDOUT "OK - Successfully checked $checked component".( $checked 
le 1 ? "" : "s")."|";
+       print STDOUT join(', ',@passed);
+       print STDOUT "\n";
+       exit(0);
+}


Property changes on: mirror/check_prtdiag
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: mirror/check_prtdiag.conf
===================================================================
--- mirror/check_prtdiag.conf                           (rev 0)
+++ mirror/check_prtdiag.conf   2013-05-13 10:05:11 UTC (rev 662)
@@ -0,0 +1,522 @@
+# check_prtdiag.conf
+
+[commands]
+platform = /sbin/uname -i
+prtdiag = /usr/platform/CMD(platform)/sbin/prtdiag -v
+
+[SunFire 280R]
+system.match = ^System Configuration:.*Sun Fire 280R
+system.checks = Leds,Fans,Disks,PSU
+
+checks.Leds.description = system leds status
+checks.Leds.begin_match = ^System LED Status:\s+
+checks.Leds.end_match = ^$
+checks.Leds.fetch_mode = linear
+checks.Leds.data_match = ((?:\S+\s)*\S+),\[\s*(.*?)\s*\]
+checks.Leds.data_labels = Location,Status
+checks.Leds.ok_condition = not( ( "%Location%" =~ m/FAULT/i ) and ("%Status%" 
eq "ON") )
+checks.Leds.output_string = System LED '%Location%' status is '%Status%'
+
+checks.Fans.description = fans status
+checks.Fans.begin_match = ^Fan Bank :
+checks.Fans.end_match = ^=
+checks.Fans.data_match = ^(\S+)\s+\[\s*(\S+)\s*\]
+checks.Fans.data_labels = Bank,Status
+checks.Fans.ok_condition = "%Status%" eq "NO_FAULT"
+checks.Fans.output_string = Fan '%Bank%' status is '%Status%'
+
+checks.Disks.description = disks status
+checks.Disks.begin_match = ^Disk Status:
+checks.Disks.end_match = ^=
+checks.Disks.data_match = ^(.*?\d+)(?:.*?)\[\s*(\S+)\s*\]\s*$
+checks.Disks.data_labels = Disk,Status
+checks.Disks.ok_condition = "%Status%" eq "NO_FAULT"
+checks.Disks.output_string = Disk '%Disk%' status is '%Status%'
+
+checks.PSU.description = power supplies status
+checks.PSU.begin_match = ^Power Supplies:
+checks.PSU.end_match = ^=
+checks.PSU.data_match = ^(.*?\d+)\s+\[\s*(\S+)\s*\]
+checks.PSU.data_labels = Supply,Status
+checks.PSU.ok_condition = "%Status%" eq "OK"
+checks.PSU.output_string = Power supply '%Supply%' status is '%Status%'
+
+
+[Enterprise 150]
+system.match = ^System Configuration:.*Sun Ultra 1 SBus
+system.checks = Boards
+
+checks.Boards.description = IO cards status
+checks.Boards.begin_match = ^=+\sIO Cards
+checks.Boards.end_match = ^=
+checks.Boards.data_match = ^(No failures found in System|(?:No|Detected) 
System Faults)
+checks.Boards.data_labels = Diagnosis
+checks.Boards.ok_condition = "%Diagnosis%" =~ m/^(No) /
+checks.Boards.output_string = System diagnosis for IO cards is '%Diagnosis%'
+
+
+[Enterprise 250]
+system.match = ^System Configuration:.*Sun \(TM\) Enterprise 250
+system.checks = Memory,Leds,Disks,Fans,PSU,Boards
+
+checks.Memory.description = memory banks status
+checks.Memory.begin_match = ^=+ Memory
+checks.Memory.end_match = ^=
+checks.Memory.data_match = ^\s*(\d+)\s+\S+\s+(.*?)\s+.*?(\S+)$
+checks.Memory.data_labels = Bank,Socket,Status
+checks.Memory.ok_condition = "%Status%" eq "OK"
+checks.Memory.output_string = Memory unit '%Socket%' on bank '%Bank%' status 
is '%Status%'
+
+checks.Leds.description = system leds status
+checks.Leds.begin_match = ^System LED Status:\s+
+checks.Leds.end_match = ^$
+checks.Leds.fetch_mode = linear
+checks.Leds.data_match = ((?:\S+\s)*\S+),\[\s*(.*?)\s*\]
+checks.Leds.data_labels = Location,Status
+checks.Leds.ok_condition = not( ( "%Location%" =~ m/ERROR/i ) and ("%Status%" 
eq "ON") )
+checks.Leds.output_string = System LED '%Location%' status is '%Status%'
+
+checks.Disks.description = disks status
+checks.Disks.begin_match = ^Disk LED Status:
+checks.Disks.end_match = ^=
+checks.Disks.data_match = (DISK\s+\d+):\s+\[\s*(.*?)\s*\]
+checks.Disks.data_labels = Disk,Status
+checks.Disks.ok_condition = "%Status%" =~ m/^(OK|EMPTY)$/
+checks.Disks.output_string = Disk '%Disk%' status is '%Status%'
+
+checks.Fans.description = fans status
+checks.Fans.begin_match = ^Fan Bank :
+checks.Fans.end_match = ^=
+checks.Fans.data_match = ^(\S+)\s+\d+\s+(\S+)
+checks.Fans.data_labels = Bank,Status
+checks.Fans.ok_condition = "%Status%" eq "OK"
+checks.Fans.output_string = Fan '%Bank%' status is '%Status%'
+
+checks.PSU.description = power supplies status
+checks.PSU.begin_match = ^Power Supplies:
+checks.PSU.end_match = ^=
+checks.PSU.data_match = ^\s*(\d+).*?(\S+)$
+checks.PSU.data_labels = Supply,Status
+checks.PSU.ok_condition = "%Status%" eq "OK"
+checks.PSU.output_string = Power supply '%Supply%' status is '%Status%'
+
+checks.Boards.description = IO cards status
+checks.Boards.begin_match = ^=+\sIO Cards
+checks.Boards.end_match = ^=
+checks.Boards.data_match = ^(No failures found in System|(?:No|Detected) 
System Faults)
+checks.Boards.data_labels = Diagnosis
+checks.Boards.ok_condition = "%Diagnosis%" =~ m/^No /
+checks.Boards.output_string = System diagnosis for IO cards is '%Diagnosis%'
+
+
+[Enterprise 450]
+system.match = ^System Configuration:.*Sun Enterprise 450
+system.checks = Memory,Leds,Disks,Fans,PSU,Boards
+
+checks.Memory.description = memory banks status
+checks.Memory.begin_match = ^=+ Memory
+checks.Memory.end_match = ^=
+checks.Memory.data_match = ^\s*(\d+)\s+\S+\s+(.*?)\s+.*?(\S+)$
+checks.Memory.data_labels = Bank,Socket,Status
+checks.Memory.ok_condition = "%Status%" eq "OK"
+checks.Memory.output_string = Memory unit '%Socket%'  on bank '%Bank%' status 
is '%Status%'
+
+checks.Leds.description = system leds status
+checks.Leds.begin_match = ^System LED Status:\s+
+checks.Leds.end_match = ^$
+checks.Leds.fetch_mode = linear
+checks.Leds.data_match = ((?:\S+\s)*\S+),\[\s*(.*?)\s*\]
+checks.Leds.data_labels = Location,Status
+checks.Leds.ok_condition = not( ( "%Location%" =~ m/ERROR/i ) and ("%Status%" 
eq "ON") )
+checks.Leds.output_string = System LED '%Location%' status is '%Status%'
+
+checks.Disks.description = disks status
+checks.Disks.begin_match = ^Disk LED Status:
+checks.Disks.end_match = ^=
+checks.Disks.data_match = (DISK\s+\d+):\s+\[\s*(.*?)\s*\]
+checks.Disks.data_labels = Disk,Status
+checks.Disks.ok_condition = "%Status%" =~ m/^(OK|EMPTY)$/
+checks.Disks.output_string = Disk '%Disk%' status is '%Status%'
+
+checks.Fans.description = fans status
+checks.Fans.begin_match = ^Fans:
+checks.Fans.end_match = ^$
+checks.Fans.data_match = ^(\S+)\s+\d+\s+(\S+)
+checks.Fans.data_labels = Bank,Status
+checks.Fans.ok_condition = "%Status%" eq "OK"
+checks.Fans.output_string = Fan '%Bank%' status is '%Status%'
+
+checks.PSU.description = power supplies status
+checks.PSU.begin_match = ^Power Supplies:
+checks.PSU.end_match = ^=
+checks.PSU.data_match = ^\s*(\d+).*?(\S+)$
+checks.PSU.data_labels = Supply,Status
+checks.PSU.ok_condition = "%Status%" eq "OK"
+checks.PSU.output_string = Power supply '%Supply%' status is '%Status%'
+
+checks.Boards.description = IO cards status
+checks.Boards.begin_match = ^=+\sIO Cards
+checks.Boards.end_match = ^=
+checks.Boards.data_match = ^(No failures found in System|(?:No|Detected) 
System Faults)
+checks.Boards.data_labels = Diagnosis
+checks.Boards.ok_condition = "%Diagnosis%" =~ m/^No /
+checks.Boards.output_string = System diagnosis for IO cards is '%Diagnosis%'
+
+
+[Enterprise 3000]
+system.match = Sun Enterprise 3000$
+system.checks = Leds,Fans,Temperatures,PSU,Boards
+
+checks.Leds.description = system leds status
+checks.Leds.begin_match = ^System LED Status:
+checks.Leds.end_match = :$
+checks.Leds.data_match = ^\S+\s+(\S+)\s+(\S+)\s+(\S+)
+checks.Leds.data_labels = Power,Failure,Running
+checks.Leds.ok_condition = "%Failure%" ne "ON"
+checks.Leds.output_string = System failure led status is '%Failure%'
+
+checks.Fans.description = fans status
+checks.Fans.begin_match = ^Fans:
+checks.Fans.end_match = ^$
+checks.Fans.skip_match = ^(-+|Unit)
+checks.Fans.data_match = ^(\S+)\s+(\S+)
+checks.Fans.data_labels = Unit,Status
+checks.Fans.ok_condition = "%Status%" eq "OK"
+checks.Fans.output_string = Fan '%Unit%' status is '%Status%'
+
+checks.Temperatures.description = temperature sensors
+checks.Temperatures.begin_match = ^System Temperatures
+checks.Temperatures.end_match = :$
+checks.Temperatures.skip_match = ^Location
+checks.Temperatures.data_match = ^(\S+\s+\d+):\s+(.*?)\s+(\S+)
+checks.Temperatures.data_labels = Location,Temperature,Trend
+checks.Temperatures.ok_condition = ( "%Trend%" eq "stable" )
+checks.Temperatures.output_string = Trend status '%Trend%' for temperature 
sensor '%Location%' (temp.: %Temperature% deg.)
+
+checks.PSU.description = power supplies status
+checks.PSU.begin_match = ^Power Supplies:
+checks.PSU.end_match = ^$
+checks.PSU.data_match = ^((?:\S+\s)*\S+)\s+(\S+)
+checks.PSU.skip_match = ^(Supply|-+)
+checks.PSU.data_labels = Supply,Status
+checks.PSU.ok_condition = "%Status%" eq "OK"
+checks.PSU.output_string = Power supply '%Supply%' status is '%Status%'
+
+checks.Boards.description = IO cards status
+checks.Boards.begin_match = ^=+(\sIO Cards|Cartes ES)
+checks.Boards.end_match = ^=+\s\S+
+checks.Boards.data_match = ^(No failures found in System|(?:No|Detected) 
System Faults)
+checks.Boards.data_labels = Diagnosis
+checks.Boards.ok_condition = "%Diagnosis%" =~ m/^No /
+checks.Boards.output_string = System diagnosis for IO cards is '%Diagnosis%'
+
+
+[Ultra 10]
+system.match = ^System Configuration:.*Sun Ultra 5\/10 UPA\/PCI
+system.checks = Boards
+
+checks.Boards.description = IO cards status
+checks.Boards.begin_match = ^=+\sIO Cards
+checks.Boards.end_match = ^=
+checks.Boards.data_match = ^(No failures found in System|(?:No|Detected) 
System Faults)
+checks.Boards.data_labels = Diagnosis
+checks.Boards.ok_condition = "%Diagnosis%" =~ m/^No /
+checks.Boards.output_string = System diagnosis for IO cards is '%Diagnosis%'
+
+
+[SunFire V120]
+system.match = ^System Configuration:.*Sun Fire V120
+system.checks = Boards
+
+checks.Boards.description = IO cards status
+checks.Boards.begin_match = ^=+\sIO Cards
+checks.Boards.end_match = ^=
+checks.Boards.data_match = ^(No failures found in System|(?:No|Detected) 
System Faults)
+checks.Boards.data_labels = Diagnosis
+checks.Boards.ok_condition = "%Diagnosis%" =~ m/^No /
+checks.Boards.output_string = System diagnosis for IO cards is '%Diagnosis%'
+
+
+[SunFire V240]
+system.match = ^System Configuration:.*Sun Fire V240
+system.checks = Fans,Leds,Temperatures,Voltages,Current,FRU
+
+checks.Fans.description = fans status
+checks.Fans.begin_match = ^Fan Speeds:
+checks.Fans.end_match = :$
+checks.Fans.data_match = ^(.*?\d+)\s+(\S+)\s+(\S+)
+checks.Fans.data_labels = Location,Sensor,Status
+checks.Fans.ok_condition = "%Status%" eq "okay"
+checks.Fans.output_string = Fan '%Location%/%Sensor%' status is '%Status%'
+
+checks.Leds.description = system leds status
+checks.Leds.begin_match = ^Led State:
+checks.Leds.end_match = :$
+checks.Leds.data_match = ^(\S+)\s+(?:SERVICE)\s+(\S+)
+checks.Leds.data_labels = Location,State
+checks.Leds.ok_condition = "%State%" eq "off"
+checks.Leds.output_string = Service indicator '%Location%' state is '%State%'
+
+checks.Temperatures.description = temperature sensors
+checks.Temperatures.begin_match = ^Temperature sensors:
+checks.Temperatures.end_match = :$
+checks.Temperatures.skip_match = ^Location
+checks.Temperatures.data_match = ^(\S+)\s+(\S+).*?(\S+)$
+checks.Temperatures.data_labels = Location,Sensor,Status
+checks.Temperatures.ok_condition = ( "%Status%" eq "okay" )
+checks.Temperatures.output_string = Temperature sensor '%Location%/%Sensor%' 
status is '%Status%'
+
+checks.Voltages.description = voltage sensors
+checks.Voltages.begin_match = ^Voltage sensors:
+checks.Voltages.end_match = :$
+checks.Voltages.skip_match = ^Location
+checks.Voltages.data_match = ^(\S+)\s+(\S+).*?(\S+)$
+checks.Voltages.data_labels = Location,Sensor,Status
+checks.Voltages.ok_condition = "%Status%" eq "okay"
+checks.Voltages.output_string = Voltage sensor '%Location%/%Sensor%' status is 
'%Status%'
+
+checks.Current.description = current sensors
+checks.Current.begin_match = ^Current sensors:
+checks.Current.end_match = ^$
+checks.Current.skip_match = ^Location
+checks.Current.data_match = ^(\S+)\s+(\S+).*?(\S+)$
+checks.Current.data_labels = Location,Sensor,Status
+checks.Current.ok_condition = "%Status%" eq "okay"
+checks.Current.output_string = Current sensor '%Location%/%Sensor%' status is 
'%Status%'
+
+checks.FRU.description = FRU operational status
+checks.FRU.begin_match = ^Fru Operational Status:
+checks.FRU.end_match = ^$
+checks.FRU.skip_match = ^Location
+checks.FRU.data_match = ^(\S+)\s+(\S+)
+checks.FRU.data_labels = Location,Status
+checks.FRU.ok_condition = "%Status%" =~ m/present|okay/
+checks.FRU.output_string = FRU '%Location%' status is '%Status%'
+
+
+[SunFire V440]
+system.match = ^System Configuration:.*Sun Fire V440
+system.checks = Fans,Leds,Temperatures,Voltages,Current,FRU
+
+checks.Fans.description = fans status
+checks.Fans.begin_match = ^Fan Speeds:
+checks.Fans.end_match = :$
+checks.Fans.data_match = ^(.*?\d+)\s+(\S+)\s+(\S+)
+checks.Fans.data_labels = Location,Sensor,Status
+checks.Fans.ok_condition = "%Status%" eq "okay"
+checks.Fans.output_string = Fan '%Location%/%Sensor%' status is '%Status%'
+
+checks.Leds.description = system leds status
+checks.Leds.begin_match = ^Led State:
+checks.Leds.end_match = :$
+checks.Leds.data_match = ^(\S+)\s+(?:SERVICE)\s+(\S+)
+checks.Leds.data_labels = Location,State
+checks.Leds.ok_condition = "%State%" eq "off"
+checks.Leds.output_string = Service indicator '%Location%' state is '%State%'
+
+checks.Temperatures.description = temperature sensors
+checks.Temperatures.begin_match = ^Temperature sensors:
+checks.Temperatures.end_match = :$
+checks.Temperatures.skip_match = ^Location
+checks.Temperatures.data_match = ^(\S+)\s+(\S+).*?(\S+)$
+checks.Temperatures.data_labels = Location,Sensor,Status
+checks.Temperatures.ok_condition = ( "%Status%" eq "okay" )
+checks.Temperatures.output_string = Temperature sensor '%Location%/%Sensor%' 
status is '%Status%'
+
+checks.Voltages.description = voltage sensors
+checks.Voltages.begin_match = ^Voltage sensors:
+checks.Voltages.end_match = :$
+checks.Voltages.skip_match = ^Location
+checks.Voltages.data_match = ^(\S+)\s+(\S+).*?(\S+)$
+checks.Voltages.data_labels = Location,Sensor,Status
+checks.Voltages.ok_condition = "%Status%" eq "okay"
+checks.Voltages.output_string = Voltage sensor '%Location%/%Sensor%' status is 
'%Status%'
+
+checks.Current.description = current sensors
+checks.Current.begin_match = ^Current sensors:
+checks.Current.end_match = ^$
+checks.Current.skip_match = ^Location
+checks.Current.data_match = ^(\S+)\s+(\S+).*?(\S+)$
+checks.Current.data_labels = Location,Sensor,Status
+checks.Current.ok_condition = "%Status%" eq "okay"
+checks.Current.output_string = Current sensor '%Location%/%Sensor%' status is 
'%Status%'
+
+checks.FRU.description = FRU operational status
+checks.FRU.begin_match = ^Fru Operational Status:
+checks.FRU.end_match = ^$
+checks.FRU.skip_match = ^Location
+checks.FRU.data_match = ^(\S+)\s+(\S+)$
+checks.FRU.data_labels = Location,Status
+checks.FRU.ok_condition = "%Status%" =~ m/present|okay/
+checks.FRU.output_string = FRU '%Location%' status is '%Status%'
+
+
+[SunFire V490]
+system.match = ^System Configuration:.*Sun Fire V490
+system.checks = Temperatures,Leds,Disks,Fans,PSU
+
+checks.Temperatures.description = temperature sensors
+checks.Temperatures.begin_match = ^System Temperatures.*:
+checks.Temperatures.end_match = ^$
+checks.Temperatures.skip_match = ^Device
+checks.Temperatures.data_match = ^(\S+)\s+(\S+)\s+(\S+)$
+checks.Temperatures.data_labels = Sensor,Temperature,Status
+checks.Temperatures.ok_condition = ( "%Status%" eq "OK" )
+checks.Temperatures.output_string = Temperature sensor '%Sensor%' status is 
'%Status%' (temp.: %Temperature% deg.)
+
+checks.Leds.description = system leds status
+checks.Leds.begin_match = ^System LED Status:
+checks.Leds.end_match = ^=
+checks.Leds.fetch_mode = linear
+checks.Leds.skip_match = ^-+
+checks.Leds.data_match = ((?:\S+\s)*\S+),\[\s*(.*?)\s*\]
+checks.Leds.data_labels = Location,Status
+checks.Leds.ok_condition = not( ( "%Location%" eq "FAULT" ) and ("%Status%" eq 
"ON") )
+checks.Leds.output_string = System LED '%Location%' status is '%Status%'
+
+checks.Disks.description = disks status
+checks.Disks.begin_match = ^Disk Status:
+checks.Disks.end_match = ^$
+checks.Disks.data_match = ^(.*?\d+)(?:.*?)\[\s*(\S+)\s*\]\s*$
+checks.Disks.data_labels = Disk,Status
+checks.Disks.ok_condition = "%Status%" eq "NO_FAULT"
+checks.Disks.output_string = Disk '%Disk%' status is '%Status%'
+
+checks.Fans.description = fans status
+checks.Fans.begin_match = ^Fan Status:
+checks.Fans.end_match = ^=
+checks.Fans.data_match = ^(\S+)\s+(\S+)\s+(.*?)\s+\[\s*(\S+)\s*\]
+checks.Fans.data_labels = Tray,Fan,Speed,Status
+checks.Fans.ok_condition = "%Status%" eq "NO_FAULT"
+checks.Fans.output_string = Fan '%Tray%/%Fan%' status is '%Status%' (speed: 
%Speed% rpm)
+
+checks.PSU.description = power supplies status
+checks.PSU.begin_match = ^Power Supplies:
+checks.PSU.end_match = ^=
+checks.PSU.data_match = ^(.*?)\s+\[\s*(\S+)\s*\]
+checks.PSU.data_labels = Supply,Status
+checks.PSU.ok_condition = "%Status%" eq "NO_FAULT"
+checks.PSU.output_string = Power supply '%Supply%' status is '%Status%'
+
+
+[SunFire 880]
+system.match = ^System Configuration:.*Sun Fire 880
+system.checks = Boards,Temperatures,Leds,Disks,Fans,PSU
+
+checks.Boards.description = IO cards status
+checks.Boards.begin_match = ^=+\sIO Cards
+checks.Boards.end_match = ^=
+checks.Boards.data_match = ^(No failures found in System|(?:No|Detected) 
System Faults)
+checks.Boards.data_labels = Diagnosis
+checks.Boards.ok_condition = "%Diagnosis%" =~ m/^No /
+checks.Boards.output_string = System diagnosis for IO cards is '%Diagnosis%'
+
+checks.Temperatures.description = temperature sensors
+checks.Temperatures.begin_match = ^System Temperatures
+checks.Temperatures.end_match = ^$
+checks.Temperatures.skip_match = ^Device
+checks.Temperatures.data_match = ^(\S+)\s+(.*?)\s+(\S+)
+checks.Temperatures.data_labels = Device,Temperature,Status
+checks.Temperatures.ok_condition = ( "%Status%" eq "OK" )
+checks.Temperatures.output_string = Temperature sensor '%Device%' status is 
'%Status%' (temp.: %Temperature% deg.)
+
+checks.Leds.description = system leds status
+checks.Leds.begin_match = ^System LED Status:
+checks.Leds.end_match = ^=
+checks.Leds.skip_match = ^$
+checks.Leds.fetch_mode = linear
+checks.Leds.data_match = ((?:\S+\s)*\S+),\[\s*(.*?)\s*\]
+checks.Leds.data_labels = Location,Status
+checks.Leds.ok_condition = not( ( "%Location%" eq "FAULT" ) and ("%Status%" eq 
"ON") )
+checks.Leds.output_string = System LED '%Location%' status is '%Status%'
+
+checks.Disks.description = disks status
+checks.Disks.begin_match = ^Disk Status:
+checks.Disks.end_match = ^$
+checks.Disks.data_match = ^(.*?\d+)(?:.*?)\[PRESENT\]\s+\[\s*(\S+)\s*\]
+checks.Disks.data_labels = Disk,Fault
+checks.Disks.ok_condition = "%Fault%" eq "OFF"
+checks.Disks.output_string = Fault LED status '%Fault%' for disk '%Disk%'
+
+checks.Fans.description = fans status
+checks.Fans.begin_match = ^Fan Bank :
+checks.Fans.end_match = ^=
+checks.Fans.data_match = ^(\S+)\s+(\d+)\s+\[ENABLED\]\s+(\S+)
+checks.Fans.data_labels = Fan,Speed,Status
+checks.Fans.ok_condition = "%Status%" eq "OK"
+checks.Fans.output_string = Fan '%Fan%' status is '%Status%' (speed: %Speed% 
rpm)
+
+checks.PSU.description = power supplies status
+checks.PSU.begin_match = ^Power Supplies:
+checks.PSU.end_match = ^=
+checks.PSU.data_match = ^(\S+\d+)\s+(\S+)
+checks.PSU.data_labels = Supply,Status
+checks.PSU.ok_condition = "%Status%" eq "GOOD"
+checks.PSU.output_string = Power supply '%Supply%' status is '%Status%'
+
+
+[SunFire V210]
+system.match = ^System Configuration:.*Sun Fire V210
+system.checks = CPU,Fans,Temperatures,Current,Voltages,Leds,FRU
+
+checks.CPU.description = CPU status
+checks.CPU.begin_match = ^=+ CPUs =
+checks.CPU.end_match = ^$
+checks.CPU.data_match = ^\s*(\d+)\s+(?:.*?)\s+(\S+)\s+(\S+)\s*$
+checks.CPU.data_labels = CPU,Status,Location
+checks.CPU.ok_condition = "%Status%" eq "on-line"
+checks.CPU.output_string = CPU%CPU% ('%Location%') status is '%Status%'
+
+checks.Fans.description = fans status
+checks.Fans.begin_match = ^Fan Status:
+checks.Fans.end_match = :$
+checks.Fans.skip_match = ^Location
+checks.Fans.data_match = ^(\S+)\s+(\S+)\s+(\S+)
+checks.Fans.data_labels = Location,Sensor,Status
+checks.Fans.ok_condition = "%Status%" eq "okay"
+checks.Fans.output_string = Fan '%Location%/%Sensor%' status is '%Status%'
+
+checks.Leds.description = system leds status
+checks.Leds.begin_match = ^Led State:
+checks.Leds.end_match = :$
+checks.Leds.data_match = ^(\S+)\s+(?:SERVICE)\s+(\S+)
+checks.Leds.data_labels = Location,State
+checks.Leds.ok_condition = "%State%" eq "off"
+checks.Leds.output_string = Service indicator '%Location%' state is '%State%'
+
+checks.Temperatures.description = temperature sensors
+checks.Temperatures.begin_match = ^Temperature sensors:
+checks.Temperatures.end_match = :$
+checks.Temperatures.skip_match = ^Location
+checks.Temperatures.data_match = ^(\S+)\s+(\S+).*?(\S+)$
+checks.Temperatures.data_labels = Location,Sensor,Status
+checks.Temperatures.ok_condition = ( "%Status%" eq "okay" )
+checks.Temperatures.output_string = Temperature sensor '%Location%/%Sensor%' 
status is '%Status%'
+
+checks.Voltages.description = voltage sensors
+checks.Voltages.begin_match = ^Voltage sensors:
+checks.Voltages.end_match = :$
+checks.Voltages.skip_match = ^Location
+checks.Voltages.data_match = ^(\S+)\s+(\S+).*?(\S+)$
+checks.Voltages.data_labels = Location,Sensor,Status
+checks.Voltages.ok_condition = "%Status%" eq "okay"
+checks.Voltages.output_string = Voltage sensor '%Location%/%Sensor%' status is 
'%Status%'
+
+checks.Current.description = current sensors
+checks.Current.begin_match = ^Current sensors:
+checks.Current.end_match = :$
+checks.Current.skip_match = ^Location
+checks.Current.data_match = ^(\S+)\s+(\S+).*?(\S+)$
+checks.Current.data_labels = Location,Sensor,Status
+checks.Current.ok_condition = "%Status%" eq "okay"
+checks.Current.output_string = Current sensor '%Location%/%Sensor%' status is 
'%Status%'
+
+checks.FRU.description = FRU operational status
+checks.FRU.begin_match = ^Fru Operational Status:
+checks.FRU.end_match = ^$
+checks.FRU.skip_match = ^Location
+checks.FRU.data_match = ^(\S+)\s+(\S+)
+checks.FRU.data_labels = Location,Status
+checks.FRU.ok_condition = "%Status%" =~ m/present|okay/
+checks.FRU.output_string = FRU '%Location%' status is '%Status%'
+

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

_______________________________________________
devel mailing list
[email protected]
https://lists.opencsw.org/mailman/listinfo/devel

Reply via email to