Closed tessierp closed 3 years ago
Hi, I remember that I had a similar issue and in my case I think it was caused by the 12h delay for the discovery. After decreasing it temporarily or executing it manually the different items were created and filled with data as expected.
Regard, Martin
Hi,
Yeah I went and checked if there was something in there and found that
You can manually launch a discovery via the screen "Configuration -> Hosts", select your host and then under "Discovery Rules":
For more details see: https://www.zabbix.com/documentation/current/manual/config/items/check_now
@tessierp
Hi,
Did you fix the problem?
If not:
/opt/zabbix/smartctl-storage-discovery.sh
?You can manually launch a discovery via the screen "Configuration -> Hosts", select your host and then under "Discovery Rules":
For more details see: https://www.zabbix.com/documentation/current/manual/config/items/check_now
I tried but it didn't fix anything so I guess my problem is elsewhere. All I get is the version for some reason.
@tessierp
Hi,
Did you fix the problem?
If not:
- What OS?
- What interface are the disks connected?
- What is the output of this discovery file(execute on host(Promox)):
/opt/zabbix/smartctl-storage-discovery.sh
?
Hi there,
In answer to your questions
UserParam Configuration : UserParameter=storage.discovery[],/etc/zabbix/scripts/smartctl-storage-discovery.sh UserParameter=storage.get[],smartctl -i -H -A -l error -l background $1 UserParameter=smartctl.version,smartctl --version | grep -Eo "^smartctl\s[0-9.[:space:]\r-]+" | sed -e 's/^smartctl\s//'
Please note that Proxmox does not use SUDO and it is not required since the system is installed as root only. This is by default and why sudo is not present.
Here is the output from the script :
{ "data": [{ "{#STORAGE.SN}": "W6A1F78F", "{#STORAGE.MODEL}": "ST3000VN000-1HJ166", "{#STORAGE.NAME}": "/dev/sda", "{#STORAGE.CMD}": "/dev/sda -dsat", "{#STORAGE.SMART}": "1", "{#STORAGE.TYPE}": "0" }, { "{#STORAGE.SN}": "W6A1M44S", "{#STORAGE.MODEL}": "ST3000VN000-1HJ166", "{#STORAGE.NAME}": "/dev/sdb", "{#STORAGE.CMD}": "/dev/sdb -dsat", "{#STORAGE.SMART}": "1", "{#STORAGE.TYPE}": "0" }, { "{#STORAGE.SN}": "S21HNXAG725504A", "{#STORAGE.MODEL}": "Samsung SSD 850 EVO 500GB", "{#STORAGE.NAME}": "/dev/sdc", "{#STORAGE.CMD}": "/dev/sdc -dsat", "{#STORAGE.SMART}": "1", "{#STORAGE.TYPE}": "1" }, { "{#STORAGE.SN}": "20242A800218", "{#STORAGE.MODEL}": "WDC WDS250G2B0B", "{#STORAGE.NAME}": "/dev/sdd", "{#STORAGE.CMD}": "/dev/sdd -dsat", "{#STORAGE.SMART}": "1", "{#STORAGE.TYPE}": "1" }] }
I tried but it didn't fix anything so I guess my problem is elsewhere. All I get is the version for some reason.
When "Execute now" in "Discovery roles":
An image is worth a thousand words. I don't see any errors.
Wait, an error occurred : Invalid discovery rule value: cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: 'sh: 1: /opt/zabbix/smartctl-storage-discovery.sh: not found'
So something is still pointing to /opt/zabbix. I will have to put everything in there then.
Please note that Proxmox does not use SUDO and it is not required since the system is installed as root only. This is by default and why sudo is not present.
SUDO need for the "zabbix-agent" because it is executed user "zabbix"
Wait, an error occurred : Invalid discovery rule value: cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: 'sh: 1: /opt/zabbix/smartctl-storage-discovery.sh: not found'
SUDO need for the "zabbix-agent" because it is executed user "zabbix"
Wait, an error occurred : Invalid discovery rule value: cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: 'sh: 1: /opt/zabbix/smartctl-storage-discovery.sh: not found'
SUDO need for the "zabbix-agent" because it is executed user "zabbix"
OK, I will install SUDO and see if it helps.
SUDO need for the "zabbix-agent" because it is executed user "zabbix"
Add in /etc/sudoers
Alright seems like adding the script in /opt/zabbix and enabling sudo made this work.
I would have a suggestion. For the UserParameter part. Instead of adding everything in zabbix_agentd.conf, I would suggest users instead enable an include 'Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf' and create a file in there called 'userparameter_smartctl.conf' and put the code there instead. That way it makes it more modular. Anyways not a requirement just a suggestion.
Thanks for the help everyone!
Alright seems like adding the script in /opt/zabbix and enabling sudo made this work.
I would have a suggestion. For the UserParameter part. Instead of adding everything in zabbix_agentd.conf, I would suggest users instead enable an include 'Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf' and create a file in there called 'userparameter_smartctl.conf' and put the code there instead. That way it makes it more modular. Anyways not a requirement just a suggestion.
Thanks for the help everyone!
I agree with you. we also use "UserParameter" in the "zabbix_agentd.conf.d/*.conf" file.
The manual is understandable. Thanks.
Thanks for the help @nikimaxim !
Hi,
I have installed everything on the Promox HOST, am able to get information on all my HDDs and SSDs and the zabbix-agent starts without any issues however, the only information I get on Zabbix Server 5.0 is "Smartctl version", nothing else gets sent no matter what I do.
This comes from the Promox host where the agent is installed so the setup there appears to be good :