Zabbix Agent custom key, error "Not all processes could is identified, non-owned process info won't be shown, you would has to be root to see it all "
Environment: Centos 6.4 X64, Zabbix agent 2.4.2,yum mode installation
Added a monitoring item to the ZABBIX_AGENTD.CONF to count the current number of TCP connections in the system
Userparameter=custom.tcp.count[*],netstat-antpl | Grep-i $ | Wc-l
After restarting the agent process, discover that the value in the monitor is 0 and use the command to verify that the key is correctly defined:
./zabbix_get-s 10.21.1.88-p 10050-k custom.tcp.count[time_wait]
The error message is returned as follows: [This message can be seen in the log]
(Not all processes could is identified, non-owned process info is not being shown, you would has to be root to see it all.) )
The Zabbix agent is a Yum installation, and the service starts with a Zabbix user, and the initial suspicion should be that the Zabbix user right cannot execute the command in the custom key in the configuration file properly. After verification, it turns out that the-p parameter in Netstat-lantup is required to be used by the root user.
Workaround 1:
Cancel the "-P" parameter in Netstat, after restarting the agent, the data is OK
Solution 2: Elevate Zabbix user Rights
Taking into account the monitoring system, you may also encounter similar actions that require elevated privileges, so use sudo to elevate user rights.
* Note *:
1. It is best to configure using the Visudo-f/etc/sudoers command. Although Visudo is also called VI to edit, but the save will be a grammar check, there is a hint of error. 2./etc/sudoers file is 440 read-only permission, change the permissions to 640 before modification, and then restore the permissions to 440
Edit/etc/sudoers File
#注释掉此行Defaults requiretty #在最后加入如下行: Zabbix all= (All) nopasswd:/bin/netstat# "nopasswd" means that the Zabbix user does not need to enter a password when executing the command; # "/ Bin/netstat ", is the command that Zabbix user can execute as root, if there are more than one, separate with commas, the advantage is to do fine control of permissions
For specific use of the sudo command, refer to: http://www.centoscn.com/CentOS/help/2014/0408/2741.html
This article is from the "Endless Life" blog, make sure to keep this source http://holiday98.blog.51cto.com/2088075/1586566
Zabbix Agent custom Key execution error