diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-18 20:59:46 (GMT) |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-09-18 20:59:46 (GMT) |
commit | 0e70e81133c25274fe2dd2309556b41357dd759b (patch) | |
tree | 9a680b36788ee1ad4e7ecc5ccfeb4494db9fdc72 /plugins/check_hpjd.c | |
parent | ce355c80cf6054bfa5e1dcf81f9e2183ef963ee1 (diff) | |
parent | 2ddc75e69db5a3dd379c896d8420c9af20ec1cee (diff) | |
download | monitoring-plugins-0e70e81133c25274fe2dd2309556b41357dd759b.tar.gz |
Merge branch 'master' into mysql_detect_mysqldumprefs/pull/1718/head
Diffstat (limited to 'plugins/check_hpjd.c')
-rw-r--r-- | plugins/check_hpjd.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index 6546556..c34bb08 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c | |||
@@ -66,7 +66,7 @@ void print_usage (void); | |||
66 | 66 | ||
67 | char *community = NULL; | 67 | char *community = NULL; |
68 | char *address = NULL; | 68 | char *address = NULL; |
69 | char *port = NULL; | 69 | unsigned int port = 0; |
70 | int check_paper_out = 1; | 70 | int check_paper_out = 1; |
71 | 71 | ||
72 | int | 72 | int |
@@ -121,8 +121,12 @@ main (int argc, char **argv) | |||
121 | HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); | 121 | HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); |
122 | 122 | ||
123 | /* get the command to run */ | 123 | /* get the command to run */ |
124 | sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s:%hd %s", PATH_TO_SNMPGET, community, | 124 | sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s:%u %s", |
125 | address, port, query_string); | 125 | PATH_TO_SNMPGET, |
126 | community, | ||
127 | address, | ||
128 | port, | ||
129 | query_string); | ||
126 | 130 | ||
127 | /* run the command */ | 131 | /* run the command */ |
128 | child_process = spopen (command_line); | 132 | child_process = spopen (command_line); |
@@ -349,6 +353,7 @@ process_arguments (int argc, char **argv) | |||
349 | usage2 (_("Port must be a positive short integer"), optarg); | 353 | usage2 (_("Port must be a positive short integer"), optarg); |
350 | else | 354 | else |
351 | port = atoi(optarg); | 355 | port = atoi(optarg); |
356 | break; | ||
352 | case 'D': /* disable paper out check*/ | 357 | case 'D': /* disable paper out check*/ |
353 | check_paper_out = 0; | 358 | check_paper_out = 0; |
354 | break; | 359 | break; |
@@ -380,11 +385,8 @@ process_arguments (int argc, char **argv) | |||
380 | community = strdup (DEFAULT_COMMUNITY); | 385 | community = strdup (DEFAULT_COMMUNITY); |
381 | } | 386 | } |
382 | 387 | ||
383 | if (port == NULL) { | 388 | if (port == 0) { |
384 | if (argv[c] != NULL ) | 389 | port = atoi(DEFAULT_PORT); |
385 | port = argv[c]; | ||
386 | else | ||
387 | port = atoi (DEFAULT_PORT); | ||
388 | } | 390 | } |
389 | 391 | ||
390 | return validate_arguments (); | 392 | return validate_arguments (); |