returned value differ : from shell or from snmpd

Pierre LEBRECH <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hello,

snmpd works on a Debian GNU/Linux machine. I have installed shell scripts. I want to be able to monitor the
RAID status of an hardware RAID (LSI) with SNMP.

here is the line I have in snmpd.conf :

############################## CUT
exec .1.3.6.1.4.1.2021.8.5.101.1 check_raid /bin/bash /usr/local/bin/check_raid.sh
############################## CUT

In a root shell, I have this output :
############################## CUT
# /usr/local/bin/check_raid.sh
OK: LSI Megaraid 1030 Volume State Optimal
############################## CUT

In an snmp user's shell, I have this output : (works with sudo)
############################## CUT
$ /usr/local/bin/check_raid.sh
OK: LSI Megaraid 1030 Volume State Optimal
############################## CUT

But now with SNMP, in a root shell, I have this :
############################## CUT
# snmpwalk -v 2c -On -c public 127.0.0.1 .1.3.6.1.4.1.2021.8.5
.1.3.6.1.4.1.2021.8.5.101.1.1.1 = INTEGER: 1
.1.3.6.1.4.1.2021.8.5.101.1.2.1 = STRING: "check_raid"
.1.3.6.1.4.1.2021.8.5.101.1.3.1 = STRING: "/bin/bash /usr/local/bin/check_raid.sh"
.1.3.6.1.4.1.2021.8.5.101.1.100.1 = INTEGER: 0
.1.3.6.1.4.1.2021.8.5.101.1.101.1 = STRING: "CRITICAL: NO RAID FOUND"
.1.3.6.1.4.1.2021.8.5.101.1.102.1 = INTEGER: 0
.1.3.6.1.4.1.2021.8.5.101.1.103.1 = ""
############################## CUT

Where does this difference come from?

Here is an extract of the python script :
############################## CUT
if is_3ware():
        print check_3ware()
    elif is_linuxraid():
        print check_linuxraid()
    elif is_lsi1030():
        print check_lsi1030()
    elif is_i2o():
        print check_i2o()
    else:
        print "CRITICAL: NO RAID FOUND"
############################## CUT

Note : I thougt the problem came from the PATH. So I wrote the following script. Here is the full content of
/usr/local/bin/check_raid.sh :
############################## CUT
#!/bin/bash

export PATH=/usr/local/bin:/usr/bin:/bin
/usr/local/bin/check_raid
############################## CUT

So, why the returned value differ ?
* With the script directly from a shell : returned value = OK: LSI Megaraid 1030 Volume State Optimal
* With SNMP : returned value = CRITICAL: NO RAID FOUND

Thank you for your help.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.