summaryrefslogtreecommitdiffstats
path: root/plugins/check_ide_smart.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_ide_smart.c')
-rw-r--r--plugins/check_ide_smart.c34
1 files changed, 4 insertions, 30 deletions
diff --git a/plugins/check_ide_smart.c b/plugins/check_ide_smart.c
index 47605e9..0160d98 100644
--- a/plugins/check_ide_smart.c
+++ b/plugins/check_ide_smart.c
@@ -166,7 +166,6 @@ enum SmartCommand
166 166
167char *get_offline_text (int); 167char *get_offline_text (int);
168int smart_read_values (int, values_t *); 168int smart_read_values (int, values_t *);
169int values_not_passed (values_t *, thresholds_t *);
170int nagios (values_t *, thresholds_t *); 169int nagios (values_t *, thresholds_t *);
171void print_value (value_t *, threshold_t *); 170void print_value (value_t *, threshold_t *);
172void print_values (values_t *, thresholds_t *); 171void print_values (values_t *, thresholds_t *);
@@ -234,10 +233,10 @@ main (int argc, char *argv[])
234 break; 233 break;
235 case 'h': 234 case 'h':
236 print_help (); 235 print_help ();
237 return STATE_OK; 236 return STATE_UNKNOWN;
238 case 'V': 237 case 'V':
239 print_revision (progname, NP_VERSION); 238 print_revision (progname, NP_VERSION);
240 return STATE_OK; 239 return STATE_UNKNOWN;
241 default: 240 default:
242 usage5 (); 241 usage5 ();
243 } 242 }
@@ -249,7 +248,7 @@ main (int argc, char *argv[])
249 248
250 if (!device) { 249 if (!device) {
251 print_help (); 250 print_help ();
252 return STATE_OK; 251 return STATE_UNKNOWN;
253 } 252 }
254 253
255 fd = open (device, OPEN_MODE); 254 fd = open (device, OPEN_MODE);
@@ -284,7 +283,7 @@ get_offline_text (int status)
284 return offline_status_text[i].text; 283 return offline_status_text[i].text;
285 } 284 }
286 } 285 }
287 return "UNKNOW"; 286 return "UNKNOWN";
288} 287}
289 288
290 289
@@ -340,31 +339,6 @@ smart_read_values (int fd, values_t * values)
340 339
341 340
342int 341int
343values_not_passed (values_t * p, thresholds_t * t)
344{
345 value_t * value = p->values;
346 threshold_t * threshold = t->thresholds;
347 int failed = 0;
348 int passed = 0;
349 int i;
350 for (i = 0; i < NR_ATTRIBUTES; i++) {
351 if (value->id && threshold->id && value->id == threshold->id) {
352 if (value->value < threshold->threshold) {
353 ++failed;
354 }
355 else {
356 ++passed;
357 }
358 }
359 ++value;
360 ++threshold;
361 }
362 return (passed ? -failed : 2);
363}
364
365
366
367int
368nagios (values_t * p, thresholds_t * t) 342nagios (values_t * p, thresholds_t * t)
369{ 343{
370 value_t * value = p->values; 344 value_t * value = p->values;