mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
mnc: add config/fetch handler
This commit is contained in:
parent
b95b1672c6
commit
bf25714e3a
@ -3,6 +3,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
char VERSION[] = "1.0.0";
|
char VERSION[] = "1.0.0";
|
||||||
@ -61,7 +62,7 @@ int main(int argc, char *argv[]) {
|
|||||||
line[LINE_MAX-1] = '\0';
|
line[LINE_MAX-1] = '\0';
|
||||||
|
|
||||||
cmd = strtok(line, " \t\n");
|
cmd = strtok(line, " \t\n");
|
||||||
arg = strtok(line, " \t\n");
|
arg = strtok(NULL, " \t\n");
|
||||||
|
|
||||||
if (!cmd || strlen(cmd) == 0) {
|
if (!cmd || strlen(cmd) == 0) {
|
||||||
printf("# empty cmd\n");
|
printf("# empty cmd\n");
|
||||||
@ -74,8 +75,18 @@ int main(int argc, char *argv[]) {
|
|||||||
return(0);
|
return(0);
|
||||||
} else if (strcmp(cmd, "list") == 0) {
|
} else if (strcmp(cmd, "list") == 0) {
|
||||||
printf("# not implem yet cmd: %s\n", cmd);
|
printf("# not implem yet cmd: %s\n", cmd);
|
||||||
} else if (strcmp(cmd, "config") == 0) {
|
} else if (
|
||||||
} else if (strcmp(cmd, "fetch") == 0) {
|
strcmp(cmd, "config") == 0 ||
|
||||||
|
strcmp(cmd, "fetch") == 0
|
||||||
|
) {
|
||||||
|
char cmdline[LINE_MAX];
|
||||||
|
if (! access(arg, X_OK)) {
|
||||||
|
printf("# unknown plugin: %s\n", arg);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
sprintf(cmdline, "exec %s/%s %s", plugin_dir, arg, cmd);
|
||||||
|
system(cmdline);
|
||||||
|
printf(".\n");
|
||||||
} else if (strcmp(cmd, "cap") == 0) {
|
} else if (strcmp(cmd, "cap") == 0) {
|
||||||
printf("cap ");
|
printf("cap ");
|
||||||
if (strlen(spoolfetch_dir)) {
|
if (strlen(spoolfetch_dir)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user