Re: snmpget timeout when being run from a script

Bill Fenner <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAF4SogZcNRt3pxmLt60CsJHW_DfCU0c7fUnUuLO9tb=PobiDvQ@mail.gmail.com>
The exec handler is synchronous, so snmpd is stuck waiting for the script
to return a value.  It can't handle the request from the script while it's
waiting like this.

If your agent has the DISMAN-EXPRESSION-MIB support compiled in, in theory
it can do simple math like this.  In practice I've never used it.

  Bill

On Tue, Oct 21, 2014 at 11:51 AM, Krzysztof Szarlej <[email protected]>
wrote:

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

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