Hi, > This patch add 3 extra packages for zabbix-agentd: > 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) and > many userparameters (using libiwinfo) > zabbix-extra-mac80211: a phy (phy0) detection rule and userparameters for > mac80211 devices
Who would want mac80211 and not wifi? or the other way around? I think it's okay to put them into the same package. > > With each packages come a startup script to set rights so that you can still > run zabbix as non root user. You add 3 startup scripts which all check and add the user zabbix. Doesn't look to nice to me. And then the startup scripts only change permissions, they don't start anything. More comments below. > Ready to use templates are available here: > http://wiki.openwrt.org/doc/howto/zabbix Nice! > > Please delete files/zabbix_agentd.conf, it's an empty file. > > Signed-off-by: Etienne CHAMPETIER <[email protected]> > > Index: files/zabbix_extra_wifi.init > =================================================================== > --- files/zabbix_extra_wifi.init (révision 0) > +++ files/zabbix_extra_wifi.init (révision 0) > @@ -0,0 +1,18 @@ > +#!/bin/sh /etc/rc.common > +# Copyright (C) 2008-2011 OpenWrt.org > + > +START=59 > + > +CONFIG=/etc/zabbix_agentd.conf > + > +start() { > + grep -q "^AllowRoot=1" ${CONFIG} || { > + user_exists zabbix 53 || user_add zabbix 53 > + group_exists zabbix 53 || group_add zabbix 53 > + [ -d /var/state ] && { > + chown -R root:zabbix /var/state/ > + chmod -R g+r /var/state/ > + } > + } > +} > + Are you sure it's save to do this? This folder is not owned by zabbix. If other packages start to do the same, then we will get into trouble. I think it's a bad idea. We could make this folder readable for others. But I think it's better to run zabbix as root. > Index: files/network > =================================================================== > --- files/network (révision 0) > +++ files/network (révision 0) > @@ -0,0 +1,8 @@ > +#tested with ath9k/zabbix 2.0.3-2.0.4/openwrt AA rc1 > +#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates > + > +# > +UserParameter=netowrt.discovery,lua -l uci -e 'x = uci.cursor(nil, > "/var/state");list = "{\"data\":[";x:foreach("network", "interface", > function(s) list=list.."{\"{#IF}\":\""..s.ifname.."\", > \"{#NET}\":\""..s[".name"].."\", \"{#DEV}\":\""..s.device.."\"}," end); > list=string.gsub(list,",$",""); print(list.."]}")' Would it be possible to get this info without lua? I thought about 'uci show network | grep ".ifname=" | sed something'. Then we don't need this additional dependency and could maybe even include this in the zabbix-agentd package. What do you do with the detected interface names? [snip] > Index: files/zabbix_extra_mac80211.init > =================================================================== > --- files/zabbix_extra_mac80211.init (révision 0) > +++ files/zabbix_extra_mac80211.init (révision 0) > @@ -0,0 +1,18 @@ > +#!/bin/sh /etc/rc.common > +# Copyright (C) 2008-2011 OpenWrt.org > + > +START=59 > + > +CONFIG=/etc/zabbix_agentd.conf > + > +start() { > + grep -q "^AllowRoot=1" ${CONFIG} || { > + user_exists zabbix 53 || user_add zabbix 53 > + group_exists zabbix 53 || group_add zabbix 53 > + [ -d /sys/kernel/debug/ieee80211 ] && { > + chown -R root:zabbix /sys/kernel/debug/ieee80211/ > + chmod -R g+r /sys/kernel/debug/ieee80211/ > + } > + } > +} > + Is this actually possible? Again, I think it's better to run zabbix as root. Or maybe "chmod -R o+r". Your solution doesn't scale to many packages wanting to do the same. [snip] > +define Package/zabbix-extra-mac80211/postinst > +[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/zabbix_extra_mac80211 enable > +exit 0 > +endef > + > +define Package/zabbix-extra-network/postinst > +[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/zabbix_extra_network enable > +exit 0 > +endef > + > +define Package/zabbix-extra-wifi/postinst > +[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/zabbix_extra_wifi enable > +exit 0 > +endef Is this really needed? To sum it up: I like your rules, but would like to know if lua is needed. Further I think the startup scripts are a bad idea and we should just run zabbix as root. I have to run your rules on a router with wifi devices to test them, I have not done it till now. Regards, Stefan Hellermann _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
