[nagiosplug] plugins/check_snmp: Show snmp error when we fail ...
"Nagios Plugin Development" <[email protected]> Sat, 3 Nov 2012 02:30:30 +0000
| Newsgroups | gmane.network.nagios.plugins.cvs |
|---|---|
| Message-ID | <[email protected]> |
Module: nagiosplug
Branch: master
Commit: c537d71a3af67d0df4e1e015f6b9dcbb505f08d2
Author: Andreas Ericsson <[email protected]>
Committer: Thomas Guyot-Sionnest <[email protected]>
Date: Fri Nov 2 14:52:34 2012 +0100
URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=c537d71
plugins/check_snmp: Show snmp error when we fail to parse its output
Dying without a hint of what went wrong is just plain annoying. With
this patch we at least get a hint.
While at it, we fix the string offset so the output we're interested
in doesn't keep the equal sign that snmpget prints.
Signed-off-by: Andreas Ericsson <[email protected]>
---
plugins/check_snmp.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 0ddfb94..8a8ee18 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -419,7 +419,7 @@ main (int argc, char **argv)
show = strstr (response, "Timeticks: ");
}
else
- show = response;
+ show = response + 3;
iresult = STATE_DEPENDENT;
@@ -428,7 +428,7 @@ main (int argc, char **argv)
if (thlds[i]->warning || thlds[i]->critical || calculate_rate) {
ptr = strpbrk (show, "0123456789");
if (ptr == NULL)
- die (STATE_UNKNOWN,_("No valid data returned"));
+ die (STATE_UNKNOWN,_("No valid data returned (%s)\n"), show);
response_value[i] = strtod (ptr, NULL);
if(calculate_rate) {
------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d