Hi

-i don't use {#DEV}, and it's a uci bug, i should just suppress it?

-for the wifi.discovery i'm always using phy instead of macaddress in wireless 
config (so i can flash a spare router quickly). you can suppress the {#PHY} 
part, or find another way? (don't use it i think)

-for the txpower i may use the same trick as with bitrate
-for bitrate if there is no client value is nil, so i put 0 for default value.

I will check later for the other value (you're getting too many nil for me)

what's your wifi router? 

Thanks again
Etienne

Stefan Hellermann <ste...@the2masters.de> a écrit :

>Additional comments, now I tested your UserParameters.
>
>> 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.."]}")'
>
>I get:
>{"data":[{"{#IF}":"lo", "{#NET}":"loopback",
>"{#DEV}":"lo"},{"{#IF}":"br-lan", "{#NET}":"lan", "{#DEV}":"eth0
>eth1"}]}
>
>In the last entry the wifi device wlan0 is missing.
># brctl show
>bridge name    bridge id               STP enabled     interfaces
>br-lan         8000.f4ec38f0f1c8       no              eth0
>                                                       eth1
>                                                       wlan0
>
>
>
>
>> +
>> +
>> +
>> Index: files/mac80211
>> ===================================================================
>> --- files/mac80211    (révision 0)
>> +++ files/mac80211    (révision 0)
>> @@ -0,0 +1,26 @@
>> +#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
>> +
>> +# If you want to know the exact meaning of an UserParameter, you can search 
>> in the ieee80211 standard:
>> +# http://standards.ieee.org/getieee802/download/802.11-2012.pdf
>> +# exemple: for mac80211.ACKFailureCount search for dot11ACKFailureCount 
>> (page 2145)
>> +
>> +#automatically discover mac80211 phy (phy0 ...)
>> +UserParameter=mac80211.phydiscovery,for phy in $(ls 
>> /sys/kernel/debug/ieee80211/); do list="$list,"'{"{#PHY}":"'$phy'"}'; done; 
>> echo '{"data":['${list#,}']}'
>> +
>> +#phy statistics (you need #PHY as parameter)
>> +#by default /sys/kernel/debug/ieee80211/ files are readable by root only
>> +UserParameter=mac80211.ACKFailureCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/dot11ACKFailureCount
>> +UserParameter=mac80211.FCSErrorCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/dot11FCSErrorCount
>> +UserParameter=mac80211.RTSFailureCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/dot11RTSFailureCount
>> +UserParameter=mac80211.RTSSuccessCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/dot11RTSSuccessCount
>> +UserParameter=mac80211.FailedCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/failed_count
>> +UserParameter=mac80211.FrameDuplicateCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/frame_duplicate_count
>> +UserParameter=mac80211.MulticastReceivedFrameCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/multicast_received_frame_count
>> +UserParameter=mac80211.MulticastTransmittedFrameCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/multicast_transmitted_frame_count
>> +UserParameter=mac80211.MultipleRetryCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/multiple_retry_count
>> +UserParameter=mac80211.ReceivedFragmentCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/received_fragment_count
>> +UserParameter=mac80211.RetryCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/retry_count
>> +UserParameter=mac80211.TransmittedFragmentCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/transmitted_fragment_count
>> +UserParameter=mac80211.TransmittedFrameCount[*],cat 
>> /sys/kernel/debug/ieee80211/$1/statistics/transmitted_frame_count
>
>All ok!
>
>> Index: files/wifi
>> ===================================================================
>> --- files/wifi    (révision 0)
>> +++ files/wifi    (révision 0)
>> @@ -0,0 +1,23 @@
>> +#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=wifi.discovery,lua -l uci -l iwinfo -e 'x = uci.cursor(nil, 
>> "/var/state");list = "{\"data\":[";x:foreach("wireless", "wifi-iface", 
>> function(s) list=list.."{\"{#IF}\":\""..s.ifname.."\", 
>> \"{#SSID}\":\""..s.ssid.."\", \"{#NET}\":\""..s.network.."\", 
>> \"{#DEV}\":\""..s.device.."\", 
>> \"{#TYPE}\":\""..x:get("wireless",s.device,"type").."\", 
>> \"{#PHY}\":\""..x:get("wireless",s.device,"phy").."\", 
>> \"{#HWMODE}\":\""..x:get("wireless",s.device,"hwmode").."\", 
>> \"{#CHANNEL}\":\""..x:get("wireless",s.device,"channel").."\", 
>> \"{#BSSID}\":\""..iwinfo[iwinfo.type(s.ifname)].bssid(s.ifname).."\"}," 
>> end); list=string.gsub(list,",$",""); print(list.."]}")'
>
>I had to enlarge CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_MAX_LEN to test
>this on the console, but then I get this error:
>
># lua -l uci -l iwinfo -e 'x = uci.cursor(nil, "/var/state");list =
>"{\"data\":[";x:foreach("wireless", "wifi-iface", funct
>ion(s) list=list.."{\"{#IF}\":\""..s.ifname.."\",
>\"{#SSID}\":\""..s.ssid.."\", \"{#NET}\":\""..s.network.."\",
>\"{#DEV}\":\""..s.device.."\
>", \"{#TYPE}\":\""..x:get("wireless",s.device,"type").."\",
>\"{#PHY}\":\""..x:get("wireless",s.device,"phy").."\",
>\"{#HWMODE}\":\""..x:get(
>"wireless",s.device,"hwmode").."\",
>\"{#CHANNEL}\":\""..x:get("wireless",s.device,"channel").."\",
>\"{#BSSID}\":\""..iwinfo[iwinfo.type(s.if
>name)].bssid(s.ifname).."\"}," end); list=string.gsub(list,",$","");
>print(list.."]}")'
>lua: (command line):1: attempt to concatenate a nil value
>stack traceback:
>       [C]: in function 'foreach'
>       (command line):1: in main chunk
>       [C]: ?
>
>Can you check this? my config:
># uci show wireless
>wireless.radio0=wifi-device
>wireless.radio0.type=mac80211
>wireless.radio0.channel=1
>wireless.radio0.macaddr=f4:ec:38:f0:f1:c9
>wireless.radio0.hwmode=11ng
>wireless.radio0.htmode=HT20
>wireless.radio0.ht_capab=SHORT-GI-40 TX-STBC RX-STBC1 DSSS_CCK-40
>wireless.radio0.country=DE
>wireless.radio0.log_level=3
>wireless.@wifi-iface[0]=wifi-iface
>wireless.@wifi-iface[0].device=radio0
>wireless.@wifi-iface[0].network=lan
>wireless.@wifi-iface[0].mode=ap
>wireless.@wifi-iface[0].ssid=myssid
>wireless.@wifi-iface[0].rsn_preauth=1
>wireless.@wifi-iface[0].encryption=psk2
>wireless.@wifi-iface[0].key=[deleted]
>
>
>> +
>> +
>> +#iwinfo info (you need #IF as parameter)
>> +UserParameter=iwinfo.channel[*],lua -l iwinfo -e 
>> "print(iwinfo[iwinfo.type('$1')].channel('$1'))"
>> +UserParameter=iwinfo.frequency[*],lua -l iwinfo -e 
>> "print(iwinfo[iwinfo.type('$1')].frequency('$1'))"
>> +UserParameter=iwinfo.txpower[*],lua -l iwinfo -e 
>> "print(iwinfo[iwinfo.type('$1')].txpower('$1'))"
>
>I get nil here
>
>> +UserParameter=iwinfo.bitrate[*],lua -l iwinfo -e "local b = 
>> iwinfo[iwinfo.type('$1')].bitrate('$1'); print(b or '0')"
>
>what does 0 mean?
>
>> +UserParameter=iwinfo.signal[*],lua -l iwinfo -e "local s = 
>> iwinfo[iwinfo.type('$1')].signal('$1'); print(s or '-255')"
>
>okay, this is an AP without clients, so this is expected to be unavailable
>
>> +UserParameter=iwinfo.noise[*],lua -l iwinfo -e 
>> "print(iwinfo[iwinfo.type('$1')].noise('$1'))"
>
>nil again?
>
>> +UserParameter=iwinfo.quality[*],lua -l iwinfo -e 
>> "print(iwinfo[iwinfo.type('$1')].quality('$1'))"
>
>0? is there some documentation about this values?
>
>> +UserParameter=iwinfo.quality_max[*],lua -l iwinfo -e 
>> "print(iwinfo[iwinfo.type('$1')].quality_max('$1'))"
>> +UserParameter=iwinfo.mode[*],lua -l iwinfo -e 
>> "print(iwinfo[iwinfo.type('$1')].mode('$1'))"
>
>result is "unknown". It should be AP.
>
>> +UserParameter=iwinfo.ssid[*],lua -l iwinfo -e 
>> "print(iwinfo[iwinfo.type('$1')].ssid('$1'))"
>
>nil again, should be "myssid"
>
>> +UserParameter=iwinfo.bssid[*],lua -l iwinfo -e 
>> "print(iwinfo[iwinfo.type('$1')].bssid('$1'))"
>
>another nil
>
>> +UserParameter=iwinfo.country[*],lua -l iwinfo -e 
>> "print(iwinfo[iwinfo.type('$1')].country('$1'))"
>> +UserParameter=iwinfo.nbusers[*],lua -l iwinfo -e 
>> "print(#iwinfo[iwinfo.type('$1')].assoclist('$1'))"
>
>0, this is expected, haven't tried with connected clients.
>
>> +UserParameter=iwinfo.encryption[*],lua -l iwinfo -e "local e = 
>> iwinfo[iwinfo.type('$1')].encryption('$1'); print(e and e.description or 
>> 'None')"
>
>result: "None". This is wrong, it should be psk2
>
>> +UserParameter=iwinfo.hwmode[*],lua -l iwinfo -e "local 
>> x=iwinfo[iwinfo.type('$1')].hwmodelist('$1'); print((x.a and 'a' or 
>> '')..(x.b and 'b' or '')..(x.g and 'g' or '')..(x.n and 'n' or ''))"
>
>> Index: Makefile
>> ===================================================================
>> --- Makefile    (révision 34787)
>> +++ Makefile    (copie de travail)
>> @@ -9,7 +9,7 @@
>>
>>  PKG_NAME:=zabbix
>>  PKG_VERSION:=2.0.3
>> -PKG_RELEASE:=1
>> +PKG_RELEASE:=2
>>
>>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
>>  PKG_SOURCE_URL:=@SF/zabbix
>> @@ -41,6 +41,24 @@
>>    TITLE+= agentd
>>  endef
>>
>> +define Package/zabbix-extra-mac80211
>> +  $(call Package/zabbix/Default)
>> +  TITLE+= discovery/userparameters for mac80211
>> +  DEPENDS += +zabbix-agentd @PACKAGE_MAC80211_DEBUGFS
>
>I tried this, but without CONFIG_KERNEL_DEBUG_FS=y set it does not
>work. I think PACKAGE_MAC80211_DEBUGFS should select
>CONFIG_KERNEL_DEBUG_FS automatically.
>
>Regards,
>Stefan Hellermann
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to