Closed zetheroo closed 5 years ago
don't test as root
, test as zabbix
user. Or enable debug Logging on agent - you will probably see there why collected value is not a json.
Ok, so we sorted out the permissions issue and got this working 100% with Debian (ProxmoxVE), but for FreeNAS it took a whole lot more digging to figure out the solution ... which was ...
adding
zabbix ALL=(ALL) NOPASSWD: /usr/local/sbin/smartctl
zabbix ALL=(ALL) NOPASSWD: /usr/local/etc/zabbix34/scripts/smartctl-disks-discovery.pl
to visudo.
Isn't visudo mentioned in README?:
Cmnd_Alias SMARTCTL = /usr/sbin/smartctl
Cmnd_Alias SMARTCTL_DISCOVERY = /etc/zabbix/scripts/smartctl-disks-discovery.pl
zabbix ALL= (ALL) NOPASSWD: SMARTCTL, SMARTCTL_DISCOVERY
Defaults!SMARTCTL !logfile, !syslog, !pam_session
Defaults!SMARTCTL_DISCOVERY !logfile, !syslog, !pam_session
Glad that you sorted it that out
Hi, @zetheroo I have also the same problem like you under proxmox, would you like to tell me whats your solution?
Machine: Debian Stretch (proxmox, latest updates) Zabbix Server, Proxy and Agent versions: 4.0.8
Output from zabbix_get from the proxy:
root@dvalin-zabbix-proxy:/# zabbix_get -s192.168.21.10 -p10050 -kuHDD.discovery
{
"data":[
{
"{#DISKMODEL}":"Corsair Force GT",
"{#DISKSN}":"1151820200000689052E",
"{#DISKNAME}":"/dev/sda",
"{#DISKCMD}":"/dev/sda -d sat",
"{#SMART_ENABLED}":"1",
"{#DISKTYPE}":"1"
},
{
"{#DISKMODEL}":"SAMSUNG SSD PM830 2.5" 7mm 256GB",
"{#DISKSN}":"S0TZNSAD115314",
"{#DISKNAME}":"/dev/sdb",
"{#DISKCMD}":"/dev/sdb -d sat",
"{#SMART_ENABLED}":"1",
"{#DISKTYPE}":"1"
}
]
}
If my understanding is correct, the discovery script is running fine, so no permission issues, but I also get the error "Value should be a JSON object" in the discovery rules...
Hoping for a solution, because I don't really know how to debug it further :/
EDIT : zabbix_get -s 192.168.21.10 -k uHDD.get[/dev/sda] works, and returns the S.M.A.R.T Attributes
EDIT nr.2 : I think I found a bug in the discovery script which causes my problems. I did run json output from above through https://jsonlint.com/ and it found a problem in line 13:
"{#DISKMODEL}":"SAMSUNG SSD PM830 2.5" 7mm 256GB",
It looks like the quotation mark from 2.5" is interpreted as the end of the datafield and because there is no following comma, its not valid json...
I don't know perl, so I can't really try to fix it, but I hope that @v-zhuravlev maybe can fix that :/
Thank you, I added escaping of quotes in #100
I saw there was a closed Issue for this, and I commented there, but am not sure if anyone is notified about comments on closed issues.
I am experiencing this issue on a Debian Stretch (PVE) system running zabbix_agent 4.0.7
root@proxsat:/etc/zabbix/scripts# ./smartctl-disks-discovery.pl { "data":[
}
Also on a FreeNAS system with zabbix_agent 3.2. So far it's only working on the Zabbix Server (Ubuntu 18.04) itself.
Update: On another system (Ubuntu 18.04) with zabbix_agent 4.0.7 it works without a hitch.
[root@hive /etc/zabbix/scripts]# ./smartctl-disks-discovery.pl { "data":[
} So far the only systems it works on are Ubuntu systems.