diff options
author | Matthias Eble <psychotrahe@users.sourceforge.net> | 2008-07-09 21:53:12 +0000 |
---|---|---|
committer | Matthias Eble <psychotrahe@users.sourceforge.net> | 2008-07-09 21:53:12 +0000 |
commit | be144b672094a11b6a670df9562e26e6a56ff03f (patch) | |
tree | 6ad84d3ac28b302694b8b7803fae67a3bb28988c /plugins/check_snmp.c | |
parent | a25083faf9c4149d82b9725b61bbc72dc956621c (diff) | |
download | monitoring-plugins-be144b672094a11b6a670df9562e26e6a56ff03f.tar.gz |
check_snmp now only prints perfdata for non numeric values (Joerg Linge #1867716)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2021 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r-- | plugins/check_snmp.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 0acade25..544c5c0b 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -228,14 +228,14 @@ main (int argc, char **argv) strncat(perfstr, "| ", sizeof(perfstr)-strlen(perfstr)-1); while (ptr) { - char *foo; + char *foo, *ptr2; unsigned int copylen; foo = strstr (ptr, delimiter); copylen = foo-ptr; if (copylen > sizeof(perfstr)-strlen(perfstr)-1) copylen = sizeof(perfstr)-strlen(perfstr)-1; - strncat(perfstr, ptr, copylen); + ptr2 = ptr; ptr = foo; if (ptr == NULL) @@ -368,11 +368,15 @@ main (int argc, char **argv) i++; - strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1); - strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1); - if (type) - strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); - strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1); + if (is_numeric(show)) { + strncat(perfstr, ptr2, copylen); + strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1); + strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1); + + if (type) + strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1); + strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1); + } } /* end while (ptr) */ |