diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2004-03-14 04:09:19 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2004-03-14 04:09:19 +0000 |
commit | 4e318b9277ba5209fab447da5afa3c0a22a681d9 (patch) | |
tree | 65e99d3a8181584d75726390c5968270c21afa63 /plugins | |
parent | b86b521b38a993b49e03f827859aea672fdfa806 (diff) | |
download | monitoring-plugins-4e318b9277ba5209fab447da5afa3c0a22a681d9.tar.gz |
use fperfdata
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@849 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_ldap.c | 14 | ||||
-rw-r--r-- | plugins/check_load.c | 6 | ||||
-rw-r--r-- | plugins/check_mrtgtraf.c | 16 | ||||
-rw-r--r-- | plugins/check_pgsql.c | 16 | ||||
-rw-r--r-- | plugins/check_smtp.c | 4 | ||||
-rw-r--r-- | plugins/check_tcp.c | 10 | ||||
-rw-r--r-- | plugins/check_ups.c | 8 |
7 files changed, 37 insertions, 37 deletions
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index b21351b7..207b98ed 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c | |||
@@ -51,8 +51,8 @@ int ld_port = DEFAULT_PORT; | |||
51 | #ifdef HAVE_LDAP_SET_OPTION | 51 | #ifdef HAVE_LDAP_SET_OPTION |
52 | int ld_protocol = DEFAULT_PROTOCOL; | 52 | int ld_protocol = DEFAULT_PROTOCOL; |
53 | #endif | 53 | #endif |
54 | int warn_time = UNDEFINED; | 54 | double warn_time = UNDEFINED; |
55 | int crit_time = UNDEFINED; | 55 | double crit_time = UNDEFINED; |
56 | struct timeval tv; | 56 | struct timeval tv; |
57 | 57 | ||
58 | int | 58 | int |
@@ -135,9 +135,9 @@ main (int argc, char *argv[]) | |||
135 | printf (_("LDAP %s - %.3f seconds response time|%s\n"), | 135 | printf (_("LDAP %s - %.3f seconds response time|%s\n"), |
136 | state_text (status), | 136 | state_text (status), |
137 | elapsed_time, | 137 | elapsed_time, |
138 | perfdata ("time", microsec, "us", | 138 | fperfdata ("time", elapsed_time, "s", |
139 | warn_time, warn_time, | 139 | (int)warn_time, warn_time, |
140 | crit_time, crit_time, | 140 | (int)crit_time, crit_time, |
141 | TRUE, 0, FALSE, 0)); | 141 | TRUE, 0, FALSE, 0)); |
142 | 142 | ||
143 | return status; | 143 | return status; |
@@ -218,10 +218,10 @@ process_arguments (int argc, char **argv) | |||
218 | ld_passwd = optarg; | 218 | ld_passwd = optarg; |
219 | break; | 219 | break; |
220 | case 'w': | 220 | case 'w': |
221 | warn_time = atoi (optarg); | 221 | warn_time = strtod (optarg, NULL); |
222 | break; | 222 | break; |
223 | case 'c': | 223 | case 'c': |
224 | crit_time = atoi (optarg); | 224 | crit_time = strtod (optarg, NULL); |
225 | break; | 225 | break; |
226 | #ifdef HAVE_LDAP_SET_OPTION | 226 | #ifdef HAVE_LDAP_SET_OPTION |
227 | case '2': | 227 | case '2': |
diff --git a/plugins/check_load.c b/plugins/check_load.c index ba942c5c..fc7e9496 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c | |||
@@ -152,9 +152,9 @@ main (int argc, char **argv) | |||
152 | "%s - %s|%s %s %s\n", | 152 | "%s - %s|%s %s %s\n", |
153 | state_text (result), | 153 | state_text (result), |
154 | status_line, | 154 | status_line, |
155 | perfdata ("load1", la1, "", wload1, wload1, cload1, cload1, TRUE, 0, FALSE, 0), | 155 | fperfdata ("load1", la1, "", (int)wload1, wload1, (int)cload1, cload1, TRUE, 0, FALSE, 0), |
156 | perfdata ("load5", la5, "", wload5, wload5, cload5, cload5, TRUE, 0, FALSE, 0), | 156 | fperfdata ("load5", la5, "", (int)wload5, wload5, (int)cload5, cload5, TRUE, 0, FALSE, 0), |
157 | perfdata ("load15", la15, "", wload15, wload15, cload15, cload15, TRUE, 0, FALSE, 0)); | 157 | fperfdata ("load15", la15, "", (int)wload15, wload15, (int)cload15, cload15, TRUE, 0, FALSE, 0)); |
158 | return STATE_OK; | 158 | return STATE_OK; |
159 | } | 159 | } |
160 | 160 | ||
diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c index cdb50f31..d23b76d0 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c | |||
@@ -179,14 +179,14 @@ main (int argc, char **argv) | |||
179 | (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, | 179 | (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate, |
180 | incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"), | 180 | incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"), |
181 | adjusted_outgoing_rate, outgoing_speed_rating, | 181 | adjusted_outgoing_rate, outgoing_speed_rating, |
182 | perfdata("in", (long) adjusted_incoming_rate, incoming_speed_rating, | 182 | fperfdata("in", adjusted_incoming_rate, incoming_speed_rating, |
183 | (int) incoming_warning_threshold, (long) incoming_warning_threshold, | 183 | (int)incoming_warning_threshold, incoming_warning_threshold, |
184 | (int) incoming_critical_threshold, (long) incoming_critical_threshold, | 184 | (int)incoming_critical_threshold, incoming_critical_threshold, |
185 | TRUE, 0, TRUE, (long) incoming_speed_rating), | 185 | TRUE, 0, FALSE, 0), |
186 | perfdata("in", (long) adjusted_outgoing_rate, outgoing_speed_rating, | 186 | fperfdata("in", adjusted_outgoing_rate, outgoing_speed_rating, |
187 | (int) outgoing_warning_threshold, (long) outgoing_warning_threshold, | 187 | (int)outgoing_warning_threshold, outgoing_warning_threshold, |
188 | (int) outgoing_critical_threshold, (long) outgoing_critical_threshold, | 188 | (int)outgoing_critical_threshold, outgoing_critical_threshold, |
189 | TRUE, 0, TRUE, (long) outgoing_speed_rating)); | 189 | TRUE, 0, FALSE, 0)); |
190 | 190 | ||
191 | printf (_("Traffic %s - %s\n"), state_text(result), error_message); | 191 | printf (_("Traffic %s - %s\n"), state_text(result), error_message); |
192 | 192 | ||
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 00b051be..22a5b811 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c | |||
@@ -45,8 +45,8 @@ char *pgtty = NULL; | |||
45 | char dbName[NAMEDATALEN] = DEFAULT_DB; | 45 | char dbName[NAMEDATALEN] = DEFAULT_DB; |
46 | char *pguser = NULL; | 46 | char *pguser = NULL; |
47 | char *pgpasswd = NULL; | 47 | char *pgpasswd = NULL; |
48 | int twarn = DEFAULT_WARN; | 48 | double twarn = (double)DEFAULT_WARN; |
49 | int tcrit = DEFAULT_CRIT; | 49 | double tcrit = (double)DEFAULT_CRIT; |
50 | 50 | ||
51 | PGconn *conn; | 51 | PGconn *conn; |
52 | /*PGresult *res;*/ | 52 | /*PGresult *res;*/ |
@@ -168,8 +168,8 @@ main (int argc, char **argv) | |||
168 | PQfinish (conn); | 168 | PQfinish (conn); |
169 | printf (_("PGSQL: %s - database %s (%d sec.)|%s\n"), | 169 | printf (_("PGSQL: %s - database %s (%d sec.)|%s\n"), |
170 | state_text(status), dbName, elapsed_time, | 170 | state_text(status), dbName, elapsed_time, |
171 | perfdata("time", (long)elapsed_time, "s", | 171 | fperfdata("time", elapsed_time, "s", |
172 | twarn, (long)twarn, tcrit, (long)tcrit, TRUE, 0, FALSE,0)); | 172 | (int)twarn, twarn, (int)tcrit, tcrit, TRUE, 0, FALSE,0)); |
173 | return status; | 173 | return status; |
174 | } | 174 | } |
175 | 175 | ||
@@ -221,16 +221,16 @@ process_arguments (int argc, char **argv) | |||
221 | timeout_interval = atoi (optarg); | 221 | timeout_interval = atoi (optarg); |
222 | break; | 222 | break; |
223 | case 'c': /* critical time threshold */ | 223 | case 'c': /* critical time threshold */ |
224 | if (!is_integer (optarg)) | 224 | if (!is_nonnegative (optarg)) |
225 | usage2 (_("Invalid critical threshold"), optarg); | 225 | usage2 (_("Invalid critical threshold"), optarg); |
226 | else | 226 | else |
227 | tcrit = atoi (optarg); | 227 | tcrit = strtod (optarg, NULL); |
228 | break; | 228 | break; |
229 | case 'w': /* warning time threshold */ | 229 | case 'w': /* warning time threshold */ |
230 | if (!is_integer (optarg)) | 230 | if (!is_nonnegative (optarg)) |
231 | usage2 (_("Invalid critical threshold"), optarg); | 231 | usage2 (_("Invalid critical threshold"), optarg); |
232 | else | 232 | else |
233 | twarn = atoi (optarg); | 233 | twarn = strtod (optarg, NULL); |
234 | break; | 234 | break; |
235 | case 'H': /* host */ | 235 | case 'H': /* host */ |
236 | if (!is_host (optarg)) | 236 | if (!is_host (optarg)) |
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 8f9ec8bb..314f59b1 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
@@ -228,8 +228,8 @@ main (int argc, char **argv) | |||
228 | state_text (result), elapsed_time, | 228 | state_text (result), elapsed_time, |
229 | verbose?", ":"", verbose?buffer:"", | 229 | verbose?", ":"", verbose?buffer:"", |
230 | perfdata ("time", microsec, "us", | 230 | perfdata ("time", microsec, "us", |
231 | check_warning_time, (long)(1000000*warning_time), | 231 | (int)check_warning_time, warning_time, |
232 | check_critical_time, (long)(1000000*critical_time), | 232 | (int)check_critical_time, critical_time, |
233 | TRUE, 0, FALSE, 0)); | 233 | TRUE, 0, FALSE, 0)); |
234 | 234 | ||
235 | return result; | 235 | return result; |
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 55ce8984..9bb161a9 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
@@ -332,11 +332,11 @@ main (int argc, char **argv) | |||
332 | if (status && strlen(status) > 0) | 332 | if (status && strlen(status) > 0) |
333 | printf (" [%s]", status); | 333 | printf (" [%s]", status); |
334 | 334 | ||
335 | printf (" |%s\n", perfdata ("time", microsec, "us", | 335 | printf (" |%s\n", fperfdata ("time", elapsed_time, "s", |
336 | TRUE, warning_time*1000, | 336 | TRUE, warning_time, |
337 | TRUE, critical_time*1000, | 337 | TRUE, critical_time, |
338 | TRUE, 0, | 338 | TRUE, 0, |
339 | TRUE, socket_timeout*1000)); | 339 | TRUE, socket_timeout)); |
340 | 340 | ||
341 | return result; | 341 | return result; |
342 | } | 342 | } |
@@ -481,7 +481,7 @@ process_arguments (int argc, char **argv) | |||
481 | else | 481 | else |
482 | maxbytes = atoi (optarg); | 482 | maxbytes = atoi (optarg); |
483 | case 'q': | 483 | case 'q': |
484 | server_quit = optarg; | 484 | asprintf(&server_quit, "%s\r\n", optarg); |
485 | break; | 485 | break; |
486 | case 'r': | 486 | case 'r': |
487 | if (!strncmp(optarg,"ok",2)) | 487 | if (!strncmp(optarg,"ok",2)) |
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 116e888c..f88e9e9f 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
@@ -167,13 +167,13 @@ main (int argc, char **argv) | |||
167 | result = max_state (result, STATE_WARNING); | 167 | result = max_state (result, STATE_WARNING); |
168 | } | 168 | } |
169 | asprintf (&data, "%s", | 169 | asprintf (&data, "%s", |
170 | perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | 170 | fperfdata ("voltage", ups_utility_voltage, "V", |
171 | check_warn, (long)(1000*warning_value), | 171 | check_warn, warning_value, |
172 | check_crit, (long)(1000*critical_value), | 172 | check_crit, critical_value, |
173 | TRUE, 0, FALSE, 0)); | 173 | TRUE, 0, FALSE, 0)); |
174 | } else { | 174 | } else { |
175 | asprintf (&data, "%s", | 175 | asprintf (&data, "%s", |
176 | perfdata ("voltage", (long)(1000*ups_utility_voltage), "mV", | 176 | fperfdata ("voltage", ups_utility_voltage, "V", |
177 | FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); | 177 | FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0)); |
178 | } | 178 | } |
179 | } | 179 | } |