mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-08-04 07:04:02 +00:00
made more paths be macros
This commit is contained in:
parent
339b8f43a9
commit
611bfb0580
5 changed files with 40 additions and 26 deletions
|
@ -3,6 +3,8 @@
|
|||
#include <stdlib.h>
|
||||
#include "common.h"
|
||||
|
||||
#define PROC_LOADAVG "/proc/loadavg"
|
||||
|
||||
int load(int argc, char **argv) {
|
||||
FILE *f;
|
||||
int warn, crit;
|
||||
|
@ -32,12 +34,12 @@ int load(int argc, char **argv) {
|
|||
if(!strcmp(argv[1], "autoconf"))
|
||||
return writeyes();
|
||||
}
|
||||
if(!(f=fopen("/proc/loadavg", "r"))) {
|
||||
fputs("cannot open /proc/loadavg\n", stderr);
|
||||
if(!(f=fopen(PROC_LOADAVG, "r"))) {
|
||||
fputs("cannot open " PROC_LOADAVG "\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
if(1 != fscanf(f, "%*f %f", &val)) {
|
||||
fputs("cannot read from /proc/loadavg\n", stderr);
|
||||
fputs("cannot read from " PROC_LOADAVG "\n", stderr);
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue