From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- .../297946-patch-plugins__check_nt.c.txt | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 web/attachments/297946-patch-plugins__check_nt.c.txt (limited to 'web/attachments/297946-patch-plugins__check_nt.c.txt') diff --git a/web/attachments/297946-patch-plugins__check_nt.c.txt b/web/attachments/297946-patch-plugins__check_nt.c.txt new file mode 100644 index 0000000..a004ad4 --- /dev/null +++ b/web/attachments/297946-patch-plugins__check_nt.c.txt @@ -0,0 +1,77 @@ +--- plugins/check_nt.c.orig 2008-10-19 14:39:43.000000000 +0200 ++++ plugins/check_nt.c 2008-10-19 14:47:19.000000000 +0200 +@@ -97,6 +97,8 @@ + char *temp_string_perf=NULL; + char *description=NULL,*counter_unit = NULL; + char *minval = NULL, *maxval = NULL, *errcvt = NULL; ++ char *fds=NULL; ++ char *tds=NULL; + + double total_disk_space=0; + double free_disk_space=0; +@@ -218,33 +220,41 @@ + else { + asprintf(&send_buffer,"%s&4&%s", req_password, value_list); + fetch_data (server_address, server_port, send_buffer); +- free_disk_space=atof(strtok(recv_buffer,"&")); +- total_disk_space=atof(strtok(NULL,"&")); +- percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100; +- warning_used_space = ((float)warning_value / 100) * total_disk_space; +- critical_used_space = ((float)critical_value / 100) * total_disk_space; +- +- if (free_disk_space>=0) { +- asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"), +- value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, +- percent_used_space, free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); +- asprintf(&temp_string_perf,_("'%s:\\ Used Space'=%.2fGb;%.2f;%.2f;0.00;%.2f"), value_list, +- (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824, +- critical_used_space / 1073741824, total_disk_space / 1073741824); ++ fds=strtok(recv_buffer,"&"); ++ tds=strtok(NULL,"&"); + +- if(check_critical_value==TRUE && percent_used_space >= critical_value) +- return_code=STATE_CRITICAL; +- else if (check_warning_value==TRUE && percent_used_space >= warning_value) +- return_code=STATE_WARNING; +- else +- return_code=STATE_OK; +- +- output_message = strdup (temp_string); +- perfdata = temp_string_perf; ++ if (fds != NULL) ++ free_disk_space=atof(fds); ++ if (tds != NULL) ++ total_disk_space=atof(tds); ++ ++ if (total_disk_space>0) { ++ percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100; ++ warning_used_space = ((float)warning_value / 100) * total_disk_space; ++ critical_used_space = ((float)critical_value / 100) * total_disk_space; ++ ++ if (free_disk_space>=0) { ++ asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"), ++ value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, ++ percent_used_space, free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); ++ asprintf(&temp_string_perf,_("'%s:\\ Used Space'=%.2fGb;%.2f;%.2f;0.00;%.2f"), value_list, ++ (total_disk_space - free_disk_space) / 1073741824, warning_used_space / 1073741824, ++ critical_used_space / 1073741824, total_disk_space / 1073741824); ++ ++ if(check_critical_value==TRUE && percent_used_space >= critical_value) ++ return_code=STATE_CRITICAL; ++ else if (check_warning_value==TRUE && percent_used_space >= warning_value) ++ return_code=STATE_WARNING; ++ else ++ return_code=STATE_OK; ++ ++ output_message = strdup (temp_string); ++ perfdata = temp_string_perf; ++ } + } else { +- output_message = strdup (_("Free disk space : Invalid drive ")); +- return_code=STATE_UNKNOWN; +- } ++ output_message = strdup (_("Free disk space : Invalid drive ")); ++ return_code=STATE_UNKNOWN; ++ } + } + break; -- cgit v1.2.3-74-g34f1