diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2002-11-07 14:30:08 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2002-11-07 14:30:08 +0000 |
commit | fb59d108e9c72ad2782ae4bc0967f24c96bca03a (patch) | |
tree | 744a538c754249cfa4713b85d420fc310ec97c90 /plugins/check_snmp.c | |
parent | 3d88b61d1048c7117e79ba4ea78dc29ea058e814 (diff) | |
download | monitoring-plugins-fb59d108e9c72ad2782ae4bc0967f24c96bca03a.tar.gz |
bugfixes to command format and (null) text created by asprintf switch
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@171 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r-- | plugins/check_snmp.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 38ce940b..4a51a294 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -155,7 +155,7 @@ int errcode, excode; char *server_address = NULL; char *community = NULL; -char *oid = NULL; +char *oid = ""; char *label = NULL; char *units = NULL; char *port = NULL; @@ -189,7 +189,7 @@ main (int argc, char **argv) char input_buffer[MAX_INPUT_BUFFER]; char *command_line = NULL; char *response = NULL; - char *outbuff = NULL; + char *outbuff = ""; char *output = NULL; char *ptr = NULL; char *p2 = NULL; @@ -197,7 +197,6 @@ main (int argc, char **argv) labels = malloc (labels_size); unitv = malloc (unitv_size); - outbuff = strscpy (outbuff, ""); for (i = 0; i < MAX_OIDS; i++) eval_method[i] = CHECK_UNDEF; i = 0; @@ -206,8 +205,8 @@ main (int argc, char **argv) usage ("Incorrect arguments supplied\n"); /* create the command line to execute */ - asprintf (&command_line, "%s -p %s -m ALL -v 1 %s -c %s %s", - PATH_TO_SNMPGET, port, server_address, community, oid); + asprintf (&command_line, "%s -m ALL -v 1 -c %s %s:%s %s", + PATH_TO_SNMPGET, community, server_address, port, oid); if (verbose) printf ("%s\n", command_line); @@ -368,9 +367,9 @@ main (int argc, char **argv) result = max_state (result, STATE_WARNING); if (nunits > 0) - printf ("%s %s -%s\n", label, state_text (result), outbuff); - else printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); + else + printf ("%s %s -%s\n", label, state_text (result), outbuff); return result; } |