UserParameters, with Examples

Video Lecture

UserParameters, with Examples UserParameters, with Examples

Description

User Parameters in Zabbix.

I create 4 examples of userparameters in this lecture.

Example 1

Starting as simple as possible.

I create an item to check isalive

Inside the zabbix agent configuration file, on the host that will run the userparameter, I add UserParameter=isalive,echo 1

I save it, then i test it using,

1
zabbix_agentd -t isalive

I then restart the zabbix agent process,

1
sudo service zabbix-agent restart

I then add a new item to my host with

name = is alive

key = isalive

type of information = numeric

I go to Monitoring-->Latest Data and wait for it to appear.

Example 2

Now something more complicated, and that is count how many sql queries mysql has executed since last restart

The user parameter is

UserParameter=mysql.questions, mysqladmin -uzabbix -ppassword status | cut -f4 -d":" | cut -f1 -d"S"

I test it using

1
zabbix_agentd -t mysql.questions

I then restart the zabbix agent process,

1
sudo service zabbix-agent restart

The item inside Zabbix Server has,

name = mysql queries running total

key = mysql.questions

type of information = numeric

Example 3

And now for something even more comlicated, and that is Flexible User Parameters

Inside the conf file i add, UserParameter=isalive[*],echo $1

I can test it using $ zabbix_agentd -t isalive[seanwasere]

Restart the zabbix agent process, $ sudo service zabbix-agent restart

The item inside Zabbix Server has, name = is alive key = isalive[seanwasere] type of information = text

Example 4

And then, I convert an existing system.run command to a UserParameter.

The script called in this system.run command is outlined in my previous lecture Check SSL Certificate Expiry on Websites using Custom Script and system.run

Inside the conf file I add,

UserParameter=ssl.check[*],/home/zabbix/checkssl.sh $1

I can test it using

1
zabbix_agentd -t ssl.check[yahoo.com]

Restart the zabbix agent process,

1
sudo service zabbix-agent restart

The item inside Zabbix Server has,

name = Check SSL 2coin.org

key = ssl.check[2coin.org]

type of information = numeric