snmpget timeout when being run from a script

Krzysztof Szarlej <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAN=rFgW7O5QUC_oAZZ0y_AAQArCegRwwzjTsnO5gnEiA1qNK3g@mail.gmail.com>
Hi all!

I have a strange problem. I want to monitor my Synology NAS Device. I
created in snmpd.conf an exec statement for my sample script that has to
run one snmpget and multiply the result by 4 to give me the correct value:

exec synology_disk_usage /opt/bin/bash /usr/bin/diskusage.sh

And the script looks like

- -
#!/opt/bin/bash

value=`snmpget -v 1 -c public localhost
HOST-RESOURCES-MIB::hrStorageSize.33 -O Qve`
echo "$value * 4" | bc
- -

When I run it just from the shell then everything looks good:

- -
bash-3.2# /usr/bin/diskusage.sh
956787604
- -

But when I make an snmpwalk then the OID that should take the value out of
the script gets snmp timeout:

- -
bash-3.2# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.8.1
iso.3.6.1.4.1.2021.8.1.1.1 = INTEGER: 1
iso.3.6.1.4.1.2021.8.1.2.1 = STRING: "synology_disk_usage"
iso.3.6.1.4.1.2021.8.1.3.1 = STRING: "/opt/bin/bash"
Timeout: No Response from localhost
- -

The problem must be related to the snmpget because when I comment the
snmpget in script, and for example add line

value=123

then the snmpwalk show me correct value (123 multiplied by 4). Any ideas
why this can occcur? I am fighting with it since yesterday and I have no
idea why is that.

Regards,
Krzysztof!

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho

_______________________________________________
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.