mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
refactor code
Added common functions autoconf_check_readable and fail. Added some TODOs for later completion. Updated messages from upstream plugins.
This commit is contained in:
parent
e71641b88f
commit
bb7bf0bcd7
15 changed files with 97 additions and 166 deletions
|
@ -23,21 +23,14 @@ int open_inodes(int argc, char **argv) {
|
|||
print_warncrit("max");
|
||||
return 0;
|
||||
}
|
||||
if(!strcmp(argv[1], "autoconf")) {
|
||||
if(0 == access(FS_INODE_NR, R_OK))
|
||||
return writeyes();
|
||||
else
|
||||
return writeno(FS_INODE_NR " not readable");
|
||||
}
|
||||
}
|
||||
if(!(f=fopen(FS_INODE_NR, "r"))) {
|
||||
fputs("cannot open " FS_INODE_NR "\n", stderr);
|
||||
return 1;
|
||||
if(!strcmp(argv[1], "autoconf"))
|
||||
return autoconf_check_readable(FS_INODE_NR);
|
||||
}
|
||||
if(!(f=fopen(FS_INODE_NR, "r")))
|
||||
return fail("cannot open " FS_INODE_NR);
|
||||
if(2 != fscanf(f, "%d %d", &nr, &freen)) {
|
||||
fclose(f);
|
||||
fputs("cannot read from " FS_INODE_NR "\n", stderr);
|
||||
return 1;
|
||||
return fail("cannot read from " FS_INODE_NR);
|
||||
}
|
||||
fclose(f);
|
||||
printf("used.value %d\nmax.value %d\n", nr-freen, nr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue