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.

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.

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

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



Popular posts from this blog

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

Fedora 19 with kernel 3.10 fail to install vmplayer module.

Boot Acronis from PXE