Arash Shams
Arash Shams

Reputation: 186

userparameters and ZBX_NOTSUPPORTED

I want to ping an external ip from all of my servers that run zabbix agent.

I searched and find some articles about zabbix user parameters. In /etc/zabbix/zabbix_agentd.conf.d/ I created a file named userparameter_ping.conf with following content:

UserParameter=checkip[*],ping -c4 8.8.8.8 && echo 0 || echo 1

I created an item named checkip in zabbix server with a graph but got no data. After some another digging I found zabbix_get and tested my userparameter but I got the error : ZBX_NOTSUPPORTED

# zabbix_get -s 172.20.4.43 -p 10050 -k checkip

my zabbix version :

Zabbix Agent (daemon) v2.4.5 (revision 53282) (21 April 2015)

Does anybody know what I can do to address this?

Upvotes: 3

Views: 21250

Answers (5)

DustWolf
DustWolf

Reputation: 586

For those who may be experiencing other issues with the same error message.

It is important to run zabbix_agentd with the -c parameter:

 ./sbin/zabbix_agentd -c zabbix_agentd.conf --test checkip["8.8.8.8"]

Otherwise zabbix might not pick up on the command and will thus yield ZBX_NOTSUPPORTED.

It also helps to isolate the command into a script file, as Zabbix will butcher in-line commands in UserParameter= much more than you'd expect.

Upvotes: 0

mojdeh
mojdeh

Reputation: 184

I defined two user parameters like this for sync checking between to samba DCs.

/etc/zabbix/zabbix_agentd.d/userparameter_samba.conf:

UserParameter=syncma, sudo samba-tool drs replicate smb1 smb2 cn=schema,cn=configuration,dc=domain,dc=com
UserParameter=syncam, sudo samba-tool drs replicate smb2 smb1 cn=schema,cn=configuration,dc=domain,dc=com

and also provided sudoer access for Zabbix user to execute the command. /etc/sudoers.d/zabbix:

Defaults:zabbix !syslog
Defaults:zabbix !requiretty

zabbix ALL=(ALL) NOPASSWD: /usr/bin/samba-tool
zabbix ALL=(ALL) NOPASSWD: /usr/bin/systemctl

And "EnableRemoteCommands" is enabled on my zabbix_aganetd.conf, sometimes when I run zabbix_get -s CLIENT_IP -p10050 -k syncma or zabbix_get -s CLIENT_IP -p10050 -k syncam I get the error ZBX_NOTSUPPORTED: Timeout while executing a shell script. but after executing /sbin/zabbix_agentd -t syncam on the client, Zabbix server just responses normally.

Replicate from smb2 to smb1 was successful.

and when it has a problem I get below error on my zabbix.log

failed to kill [ sudo samba-tool drs replicate smb1 smb2 cn=schema,cn=configuration,dc=domain,dc=com]: [1] Operation not permitted

It seems like it is a permission error! but It just resolved after executing /sbin/zabbix_agentd -t syncam but I am not sure the error is gone permanently or will happen at the next Zabbix item check interval.

Upvotes: -1

Jairo Alves
Jairo Alves

Reputation: 534

If you need more than 30s for the execution, you can use the nohup (command..) & combo to curb the timeout restriction.

That way, if you generate some file with the results, in the next pass, you can read the file and get back the results without any need to wait at all.

Upvotes: 0

Arash Shams
Arash Shams

Reputation: 186

After some change and talks with folks in mailing list finally it worked but how :

first i created a file in :

/etc/zabbix/zabbix_agentd.conf.d/

and add this line :

 UserParameter=checkip[*],ping -W1 -c2 $1 >/dev/null 2>&1 && echo 0 || echo 1

and run this command :

    ./sbin/zabbix_agentd -t checkip["8.8.8.8"]
checkip[8.8.8.8]                              [t|0]

so everything done but Timeout option is very important for us :

add time out in /etc/zabbix/zabbix_agentd.conf

Timeout=30

Timeout default is 3s so if we run

time ping -W1 -c2 8.8.8.8

see maybe it takes more than 3s so you got error :

ZBX_NOTSUPPORTED

Upvotes: 5

Jan Garaj
Jan Garaj

Reputation: 28636

It can be anything. For example timeout - default timeout is 3 sec and ping -c4 requires at least 3 seconds, permission/path to ping, not restarted agent, ...

Increase debug level, restart agent and check zabbix logs. Also you can test zabbix_agentd directly:

zabbix_agentd -t checkip[]

[m|ZBX_NOTSUPPORTED] [Timeout while executing a shell script.] => Timeout problem. Edit zabbix_agentd.conf and increase Timeout settings. Default 3 seconds are not the best for your ping, which needs 3+ seconds.

Upvotes: 0

Related Questions