summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSubhendu Ghosh <sghosh@users.sourceforge.net>2003-04-11 18:44:50 +0000
committerSubhendu Ghosh <sghosh@users.sourceforge.net>2003-04-11 18:44:50 +0000
commit1ca70cd0abd79c0d127f0476e75f8902e7200a3e (patch)
tree75fd8a874e06ce712f7d55b094795d2e814d5066 /plugins
parentd8a0b8512bfd62a4cec79964aa3af84a0430066b (diff)
downloadmonitoring-plugins-1ca70cd0abd79c0d127f0476e75f8902e7200a3e.tar.gz
patch 698384 - order of args to snmpget + print a bit of stderr
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@485 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_hpjd.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c
index 56384657..7fb1d5a7 100644
--- a/plugins/check_hpjd.c
+++ b/plugins/check_hpjd.c
@@ -112,8 +112,8 @@ main (int argc, char **argv)
112 HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); 112 HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY);
113 113
114 /* get the command to run */ 114 /* get the command to run */
115 sprintf (command_line, "%s -m : -v 1 %s -c %s %s", PATH_TO_SNMPGET, address, 115 sprintf (command_line, "%s -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community,
116 community, query_string); 116 address, query_string);
117 117
118 /* run the command */ 118 /* run the command */
119 child_process = spopen (command_line); 119 child_process = spopen (command_line);
@@ -261,9 +261,15 @@ main (int argc, char **argv)
261 } 261 }
262 262
263 /* WARNING if output found on stderr */ 263 /* WARNING if output found on stderr */
264 if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) 264 if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) {
265 result = max_state (result, STATE_WARNING); 265 result = max_state (result, STATE_WARNING);
266 /* remove CRLF */
267 if (input_buffer[strlen (input_buffer) - 1] == '\n')
268 input_buffer[strlen (input_buffer) - 1] = 0;
269 sprintf (error_message, "%s", input_buffer );
266 270
271 }
272
267 /* close stderr */ 273 /* close stderr */
268 (void) fclose (child_stderr); 274 (void) fclose (child_stderr);
269 275
@@ -281,7 +287,10 @@ main (int argc, char **argv)
281 287
282 /* might not be the problem, but most likely is.. */ 288 /* might not be the problem, but most likely is.. */
283 result = STATE_UNKNOWN; 289 result = STATE_UNKNOWN;
284 sprintf (error_message, "Timeout: No response from %s\n", address); 290 char *temp ;
291 asprintf (&temp, error_message);
292 sprintf (error_message, "%s : Timeout from host %s\n", temp, address );
293
285 } 294 }
286 295
287 /* if we had no read errors, check the printer status results... */ 296 /* if we had no read errors, check the printer status results... */