added RSA II support for SNMP monitoring

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@636 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2008-02-29 16:51:03 +00:00
parent e4be025229
commit bbd920a50c
2 changed files with 14 additions and 27 deletions

View File

@ -129,6 +129,7 @@ sub configSNMP {
# then stop it and restart it again so that it reads our new
# snmptrapd.conf configuration file. Then the process
chomp(my $pid= `/bin/ps -ef | /bin/grep snmptrapd | /bin/grep -v grep | /bin/awk '{print \$2}'`);
print "pid=$pid here\n";
if($pid){
`/bin/kill -9 $pid`;
}
@ -177,14 +178,14 @@ sub stop {
}
}
# now check to see if the daemon is running. If it is then we need to restart
# now check to see if the daemon is running. If it is then we need to resart or stop?
# it with the new snmptrapd.conf file that will not forward events to RMC.
my $pid="";
chomp($pid= `/bin/ps -ef | /bin/grep snmptrapd | /bin/grep -v grep | /bin/awk '{print $\2}'`);
chomp(my $pid= `/bin/ps -ef | /bin/grep snmptrapd | /bin/grep -v grep | /bin/awk '{print \$2}'`);
print "pid=$pid\n";
if($pid){
`/bin/kill -9 $pid`;
# start it up again!
system("/usr/sbin/snmptrapd");
#system("/usr/sbin/snmptrapd");
}
return (0, "stopped");

View File

@ -21,8 +21,7 @@ my $info;
my $severity_type;
my $severity;
my $host=<STDIN>;
my $host=<STDIN>;
chomp($host);
my $ip=<STDIN>;
chomp($ip);
@ -31,6 +30,7 @@ my $holder;
my $begin=1;
my $pair;
while ($temp=<STDIN>) {
chomp($temp);
my $temp1=$temp; #save the one with quotes
@ -58,22 +58,20 @@ while ($temp=<STDIN>) {
}
}
print "pair=$pair\n";
@a=split(/ /, $pair);
$oid=shift @a;
$value=join(' ', @a);
$message .= " $oid=$value\n";
#for BladeCenter MM traps, creat a brief message
if ($oid =~ /BLADESPPALT-MIB::spTrapAppId/) {
#for BladeCenter MM traps and RSA II traps, creat a brief message
if ($oid =~ /BLADESPPALT-MIB::spTrapAppId|RSASPPALT-MIB::ibmSpTrapAppId/) {
$briefmsg .= " App ID: $value\n";
}
elsif ($oid =~ /BLADESPPALT-MIB::spTrapAppType/) {
$briefmsg .= " Alert Type: $value\n";
elsif ($oid =~ /BLADESPPALT-MIB::spTrapAppType|RSASPPALT-MIB::ibmSpTrapAppType/) {
$briefmsg .= " App Alert Type: $value\n";
}
elsif ($oid =~ /BLADESPPALT-MIB::spTrapMsgText/) {
elsif ($oid =~ /BLADESPPALT-MIB::spTrapMsgText|RSASPPALT-MIB::ibmSpTrapMsgText/) {
$briefmsg .= " Message: $value\n";
}
elsif ($oid =~ /BLADESPPALT-MIB::spTrapBladeName/) {
@ -87,7 +85,7 @@ while ($temp=<STDIN>) {
elsif (($oid =~ /BLADESPPALT-MIB::spTrapSourceId/)) {
$briefmsg .= " Error Source=$value\n";
}
elsif ($oid =~ /BLADESPPALT-MIB::spTrapPriority/) {
elsif ($oid =~ /BLADESPPALT-MIB::spTrapPriority|RSASPPALT-MIB::ibmSpTrapPriority/) {
# Critical Alert(0), Major(1), Non-Critical Alert(2), System Alert(4),
# Recovery Alert(8), Informational Only Alert(255)
if ($value==0) {
@ -112,19 +110,7 @@ while ($temp=<STDIN>) {
}
#elsif ($oid =~ /enterprises\.3183\.1\.1\.1/) { #IPMI starts here
# ;
# } elsif ($oid =~ /enterprises\.2\.6\.158\.1\.1\.3/) { #RSA starts here, TODO: get MIB, change here
# $briefmsg .= " Node: $value\n";
# } elsif ($oid =~ /enterprises\.2\.6\.158\.1\.1\.7/) {
# $briefmsg .= " Message: $value\n";
# } elsif ($oid =~ /enterprises\.2\.6\.158\.1\.1\.5/) {
# $briefmsg .= " Alert Type: $value\n";
# } elsif ($oid =~ /enterprises\.2\.6\.158\.2\.1\.1\.3/) {
# $briefmsg .= " Node: $value\n";
# } elsif ($oid =~ /enterprises\.2\.6\.158\.2\.1\.1\.9/) {
# $briefmsg .= " Message: $value\n";
# } elsif ($oid =~ /enterprises\.2\.6\.158\.2\.1\.1\.7/) {
# $briefmsg .= " Alert Type: $value\n";
# }
# }
}
if ($node1) {$info= getMoreInfo($node1);}