summaryrefslogtreecommitdiffstats
path: root/plugins/check_load.c
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2024-04-07 00:51:58 (GMT)
committerGitHub <noreply@github.com>2024-04-07 00:51:58 (GMT)
commit7da628699564ffb21eade261921b5098728d65f2 (patch)
tree0471765c0fd25d2e57a320c080071413e587d8c9 /plugins/check_load.c
parentd3faf13961c61b3ad69b47960124d3269c5f335e (diff)
downloadmonitoring-plugins-7da628699564ffb21eade261921b5098728d65f2.tar.gz
check_load: remove unused code (#1998)
adaugherity noticed in issue #1965, that HAVE_PROC_LOADAVG is never defined since the symbol was removed from configure quite some time ago. This commit removes the dead code which would be used when the symbol would have been defined.
Diffstat (limited to 'plugins/check_load.c')
-rw-r--r--plugins/check_load.c26
1 files changed, 0 insertions, 26 deletions
diff --git a/plugins/check_load.c b/plugins/check_load.c
index 313df8a..1431d13 100644
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
@@ -110,10 +110,6 @@ main (int argc, char **argv)
110 double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about uninitialized arrays */ 110 double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about uninitialized arrays */
111#ifndef HAVE_GETLOADAVG 111#ifndef HAVE_GETLOADAVG
112 char input_buffer[MAX_INPUT_BUFFER]; 112 char input_buffer[MAX_INPUT_BUFFER];
113# ifdef HAVE_PROC_LOADAVG
114 FILE *fp;
115 char *str, *next;
116# endif
117#endif 113#endif
118 114
119 setlocale (LC_ALL, ""); 115 setlocale (LC_ALL, "");
@@ -132,23 +128,6 @@ main (int argc, char **argv)
132 if (result != 3) 128 if (result != 3)
133 return STATE_UNKNOWN; 129 return STATE_UNKNOWN;
134#else 130#else
135# ifdef HAVE_PROC_LOADAVG
136 fp = fopen (PROC_LOADAVG, "r");
137 if (fp == NULL) {
138 printf (_("Error opening %s\n"), PROC_LOADAVG);
139 return STATE_UNKNOWN;
140 }
141
142 while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) {
143 str = (char *)input_buffer;
144 for(i = 0; i < 3; i++) {
145 la[i] = strtod(str, &next);
146 str = next;
147 }
148 }
149
150 fclose (fp);
151# else
152 child_process = spopen (PATH_TO_UPTIME); 131 child_process = spopen (PATH_TO_UPTIME);
153 if (child_process == NULL) { 132 if (child_process == NULL) {
154 printf (_("Error opening %s\n"), PATH_TO_UPTIME); 133 printf (_("Error opening %s\n"), PATH_TO_UPTIME);
@@ -175,18 +154,13 @@ main (int argc, char **argv)
175 printf (_("Error code %d returned in %s\n"), result, PATH_TO_UPTIME); 154 printf (_("Error code %d returned in %s\n"), result, PATH_TO_UPTIME);
176 return STATE_UNKNOWN; 155 return STATE_UNKNOWN;
177 } 156 }
178# endif
179#endif 157#endif
180 158
181 if ((la[0] < 0.0) || (la[1] < 0.0) || (la[2] < 0.0)) { 159 if ((la[0] < 0.0) || (la[1] < 0.0) || (la[2] < 0.0)) {
182#ifdef HAVE_GETLOADAVG 160#ifdef HAVE_GETLOADAVG
183 printf (_("Error in getloadavg()\n")); 161 printf (_("Error in getloadavg()\n"));
184#else 162#else
185# ifdef HAVE_PROC_LOADAVG
186 printf (_("Error processing %s\n"), PROC_LOADAVG);
187# else
188 printf (_("Error processing %s\n"), PATH_TO_UPTIME); 163 printf (_("Error processing %s\n"), PATH_TO_UPTIME);
189# endif
190#endif 164#endif
191 return STATE_UNKNOWN; 165 return STATE_UNKNOWN;
192 } 166 }