d8a5c20913
zabbix-extra-network: a detection rule with the ifname (eth0.1) and the network name (wan). zabbix-extra-wifi: an universal detection rule for wifi (using libuci-lua) and many userparameters (using libiwinfo-lua) zabbix-extra-mac80211: a phy (phy0) detection rule and userparameters for mac80211 devices zabbix-extra-network and zabbix-extra-wifi will work as non root user if /etc/config/wireless and /etc/config/network are world-readeable (default) (see http://nbd.name/gitweb.cgi?p=uci.git;a=commit;h=07d6fd66f6a20e35490bc8b55d26fdb389016120) zabbix-extra-mac80211 come with a suid helper so that you can still run zabbix as non root user. Ready to use templates are available here: http://wiki.openwrt.org/doc/howto/zabbix Please delete files/zabbix_agentd.conf, it's an empty file. Signed-off-by: Etienne CHAMPETIER <etienne.champetier@free.fr> git-svn-id: svn://svn.openwrt.org/openwrt/packages@36740 3c298f89-4303-0410-b956-a3cf2f4a3e73
33 lines
840 B
C
33 lines
840 B
C
#define _GNU_SOURCE
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
if(argc == 3) {
|
|
char *phy = NULL;
|
|
char *stat = NULL;
|
|
char *filename = NULL;
|
|
FILE *f = NULL;
|
|
phy = basename(argv[1]);
|
|
stat = basename(argv[2]);
|
|
if(asprintf(&filename, "/sys/kernel/debug/ieee80211/%s/statistics/%s", phy, stat) > 0)
|
|
f = fopen(filename, "r");
|
|
|
|
if(f != NULL) {
|
|
char temp[256];
|
|
while (fgets(temp, 256, f) != NULL)
|
|
printf("%s",temp);
|
|
|
|
fclose(f);
|
|
}
|
|
free(filename);
|
|
} else {
|
|
fprintf(stderr, "Usage: %s PHY STAT\n",argv[0]);
|
|
fprintf(stderr, " cat /sys/kernel/debug/ieee80211/PHY/statistics/STAT as root\n");
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|