Using zabbit agent, not able to retrieve value from nmap command.

Recently I've playing with zabbix installation and I faced this issue.

From the Zabbix agent issue command

zabbix_agentd -s zabbix-agent -k "openvpn[x.x.x.x]"

manage to retrieve text value.

But from the zabbix server issue command

zabbix_get -s zabbix-agent -k "openvpn[x.x.x.x]"

empty value return from the zabbix agent.

The zabbix script look like this.

Timeout=30
UserParameter=openvpn[*],nmap -sT $1 -p 443 |grep 443 | awk -F " " '{print $$2}'

After searching the around, i found the solution.

First add the capabilities to Nmap.

sudo setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip /usr/bin/nmap

Then add additional parameter into the script.

Timeout=30
UserParameter=openvpn[*],nmap --privileged -sT $1 -p 10443 |grep 10443 | awk -F " " '{print $$2}'

Once the agent restarted, the script will be working again.



---

Comments

Popular posts from this blog

Setup mail server with ldap authentication in docker

Install VMware workstation 11 on Fedora 21 with kernel 3.17

How to allow non root user to execute hping command ?