How to monitor UrBackup clients with Zabbix.
This code originally came from a Zabbix forum post by tmueko, plus a copy of the urbackup api by uroni.
These instructions are my fault -- please let me know if I've got something wrong. I am a million miles away from being an experienced Zabbix user and found installation process "quirky", hence this document. I do note that Zabbix 6.4 has definite usability improvements over 6.2, so well done to you folks.
- Install a Zabbix Agent on your UrBackup server, if it's not there already (which would surprise me!)
- Install a Python on your UrBackup server, if it's not there already
- Install this code, into
/opt
, on your UrBackup server, or grab it via git
cd /opt
git clone git@github.com:kerryland/zabbix-urbackup.git
chmod +x /opt/zabbix-urbackup/urbackup-discovery.py
- Add a "User Parameter" to the Zabbix Agent on the UrBackup server:
echo 'UserParameter=urbackup.discovery[*],/opt/zabbix-urbackup/urbackup-discovery.py $1 $2 $3' >> /etc/zabbix/zabbix_agentd.conf
- Test it with
zabbix_agentd -t urbackup.discovery
. It's OK if it fails as shown below:
urbackup.discovery [t|Traceback (most recent call last):
File "/opt/zabbix-urbackup/urbackup-discovery.py", line 14, in <module>
server = urbackup_api.urbackup_server(sys.argv[1],sys.argv[2],sys.argv[3])
IndexError: list index out of range]
- Tell the Zabbix Server about it:
zabbix_agentd -R userparameter_reload
- Import the template configuration.
- Menu:
Data collection | Templates
Import
button in top-right corner- Select the
Urbackup.yaml
file you downloaded earlier
- Menu:
- Find your UrBackup server in Zabbix UI (Menu:
Data collection | Hosts
), and add the "Urbackup" template to the host, add click "Update". - Notice you now have a "urbackup discovery item" added to your host's list of items. Click on it to view the details.
- Click "Test" and configure the "Macros" fields with your Urbackup server URL, username and password. Note the URL ends in
/x
for some obscure reason. eg:http://127.0.0.1:55414/x
- Click "Get value and test", which should result in a "result" looking something like this:
[{"client_version_string": "2.5.21", "delete_pending": "", "file_ok": true...
. - Click "Cancel" to close the test dialog
- Define Macros for the host.
- Open the "Host" definition again and Click "Macros" at the top of the screen
- Click "Inherited and host macros"
- Change the values for
{$UR_PASSWORD}
,{$UR_URL}
and{$UR_USER}
to match your environment
- Create the new automated urbackup items
- Open the "Host" definition again and Click "Discovery rules" at the top of the screen
- Click "urbackup discovery" (not "urbackup discovery item")
- Click "Execute now"
TADA! You should now have a whole pile of items and triggers defined for your urbackup clients.