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

Microsoft Azure Backup encountered and internal error. (ID: 130001)

Boot Acronis from PXE

Fedora 19 with kernel 3.10 fail to install vmplayer module.