Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0 value now returns 'None' #8

Open
lekzz opened this issue Oct 15, 2020 · 3 comments
Open

0 value now returns 'None' #8

lekzz opened this issue Oct 15, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@lekzz
Copy link

lekzz commented Oct 15, 2020

After my distro removed python 1 and 2 i found you had already updated your script to python3. However after switching over, and updating everything to use -cred, it now returns 'None' where it used to return '0'.

This generates zabbix errors like:
"item "SERVER:zbxwmi["-action","get","-item","3","-fields","PercentProcessorTime","Win32_PerfFormattedData_PerfOS_Processor","-cred","{$WMI_AUTHFILE}",{HOST.HOST}]" became not supported: Value of type "string" is not suitable for value type "Numeric (unsigned)". Value "None"

$ sudo /etc/zabbix/externalscripts/zbxwmi -action get -item _Total -fields PercentProcessorTime Win32_PerfFormattedData_PerfOS_Processor -cred /etc/zabbix/wmi.pw SERVER

None

When it is able to read a real value it will become supported again and thus is constantly flip flopping.

If i change the type to text it won't flip flop but then graphs won't work.
On hosts with history using latest data with values there are no more 0's to be found in the history since the switch to the python3 script, while they do show before.
I tried setting the interval to 5m but that didn't change anything, but in history i can see 1m never was a problem before.

Nothing has changed on the windows machines.

@13hakta
Copy link
Owner

13hakta commented Nov 27, 2020

Resolved in latest update 0.1.3 with adding type hinting.
Option type must be added kind of -type n

@13hakta 13hakta added the bug Something isn't working label Nov 27, 2020
@lekzz
Copy link
Author

lekzz commented Dec 1, 2020

I updated to the new script and the -type setting, however the result is still the same.

375424:20201201:155006.495 item "SERVER:zbxwmi["-action","get","-item","13","-fields","PercentProcessorTime","Win32_PerfFormattedData_PerfOS_Processor","-type","n","-cred","{$WMI_AUTHFILE}",{HOST.HOST}]" became not supported: Value of type "string" is not suitable for value type "Numeric (unsigned)". Value "None"

$ sudo /etc/zabbix/externalscripts/zbxwmi -action get -item _Total -fields PercentProcessorTime Win32_PerfFormattedData_PerfOS_Processor -type n -cred /etc/zabbix/wmi.pw SERVER
2

$ sudo /etc/zabbix/externalscripts/zbxwmi -action get -item _Total -fields PercentProcessorTime Win32_PerfFormattedData_PerfOS_Processor -type n -cred /etc/zabbix/wmi.pw SERVER
None

@lekzz
Copy link
Author

lekzz commented May 28, 2021

Finally got around to doing some more testing and found that the problem is only with the "get" action, but it's working correctly with the "json" and "both "actions:

sudo /etc/zabbix/externalscripts/zbxwmi -action get -item "6" -fields PercentProcessorTime Win32_PerfFormattedData_PerfOS_Processor -t n -cred /etc/zabbix/wmi.pw SERVER
None

sudo /etc/zabbix/externalscripts/zbxwmi -action json -item "6" -fields PercentProcessorTime Win32_PerfFormattedData_PerfOS_Processor -t n -cred /etc/zabbix/wmi.pw SERVER
[{"Name": "6", "PercentProcessorTime": 0}]

sudo /etc/zabbix/externalscripts/zbxwmi -action both -item "6" -fields PercentProcessorTime Win32_PerfFormattedData_PerfOS_Processor -t n -cred /etc/zabbix/wmi.pw SERVER
{ "data": [ {"{#WMI.PERCENTPROCESSORTIME}": 0} ] }

So i ended up using json with the JSONPath preprocessor. However that preprocessor doesn't work with the [] brackets so i had to trim those first. Might be a seperate bug but unsure as this is the first time i worked with json data in zabbix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants