diff options
-rw-r--r-- | plugins/check_dns.c | 10 | ||||
-rw-r--r-- | plugins/check_smtp.c | 12 |
2 files changed, 13 insertions, 9 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index afc23a4..58c0a1b 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
@@ -78,6 +78,7 @@ main (int argc, char **argv) | |||
78 | char *temp_buffer = NULL; | 78 | char *temp_buffer = NULL; |
79 | int result = STATE_UNKNOWN; | 79 | int result = STATE_UNKNOWN; |
80 | double elapsed_time; | 80 | double elapsed_time; |
81 | long microsec; | ||
81 | struct timeval tv; | 82 | struct timeval tv; |
82 | int multi_address; | 83 | int multi_address; |
83 | 84 | ||
@@ -197,8 +198,9 @@ main (int argc, char **argv) | |||
197 | result = STATE_CRITICAL; | 198 | result = STATE_CRITICAL; |
198 | asprintf(&output, _("expected %s but got %s"), expected_address, address); | 199 | asprintf(&output, _("expected %s but got %s"), expected_address, address); |
199 | } | 200 | } |
200 | 201 | ||
201 | elapsed_time = delta_time (tv); | 202 | microsec = deltime (tv); |
203 | elapsed_time = (double)microsec / 1.0e6; | ||
202 | 204 | ||
203 | if (result == STATE_OK) { | 205 | if (result == STATE_OK) { |
204 | if (strchr (address, ',') == NULL) | 206 | if (strchr (address, ',') == NULL) |
@@ -206,8 +208,8 @@ main (int argc, char **argv) | |||
206 | else | 208 | else |
207 | multi_address = TRUE; | 209 | multi_address = TRUE; |
208 | 210 | ||
209 | printf (_("DNS ok - %.3f seconds response time, address%s %s|time=%.3f\n"), | 211 | printf (_("DNS ok - %.3f seconds response time, address%s %s|time=%ldus\n"), |
210 | elapsed_time, (multi_address==TRUE ? "es are" : " is"), address, elapsed_time); | 212 | elapsed_time, (multi_address==TRUE ? "es are" : " is"), address, microsec); |
211 | } | 213 | } |
212 | else if (result == STATE_WARNING) | 214 | else if (result == STATE_WARNING) |
213 | printf (_("DNS WARNING - %s\n"), | 215 | printf (_("DNS WARNING - %s\n"), |
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 41ed5f3..b35ebbc 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
@@ -59,6 +59,7 @@ main (int argc, char **argv) | |||
59 | { | 59 | { |
60 | int sd; | 60 | int sd; |
61 | double elapsed_time; | 61 | double elapsed_time; |
62 | long microsec; | ||
62 | int result = STATE_UNKNOWN; | 63 | int result = STATE_UNKNOWN; |
63 | char buffer[MAX_INPUT_BUFFER]; | 64 | char buffer[MAX_INPUT_BUFFER]; |
64 | char *from_str = NULL; | 65 | char *from_str = NULL; |
@@ -155,7 +156,8 @@ main (int argc, char **argv) | |||
155 | /* reset the alarm */ | 156 | /* reset the alarm */ |
156 | alarm (0); | 157 | alarm (0); |
157 | 158 | ||
158 | elapsed_time = delta_time (tv); | 159 | microsec = deltime (tv); |
160 | elapsed_time = (double)microsec / 1.0e6; | ||
159 | 161 | ||
160 | if (check_critical_time && elapsed_time > (double) critical_time) | 162 | if (check_critical_time && elapsed_time > (double) critical_time) |
161 | result = STATE_CRITICAL; | 163 | result = STATE_CRITICAL; |
@@ -163,11 +165,11 @@ main (int argc, char **argv) | |||
163 | result = STATE_WARNING; | 165 | result = STATE_WARNING; |
164 | 166 | ||
165 | if (verbose) | 167 | if (verbose) |
166 | printf (_("SMTP %s - %.3f sec. response time, %s|time=%.3f\n"), | 168 | printf (_("SMTP %s - %.3f sec. response time, %s|time=%ldus\n"), |
167 | state_text (result), elapsed_time, buffer, elapsed_time); | 169 | state_text (result), elapsed_time, buffer, microsec); |
168 | else | 170 | else |
169 | printf (_("SMTP %s - %.3f second response time|time=%.3f\n"), | 171 | printf (_("SMTP %s - %.3f second response time|time=%ldus\n"), |
170 | state_text (result), elapsed_time, elapsed_time); | 172 | state_text (result), elapsed_time, microsec); |
171 | 173 | ||
172 | return result; | 174 | return result; |
173 | } | 175 | } |