Adding CT Scripts to a Zabbix Proxy

Some of the templates used by Zabbix need to be installed on the Zabbix proxy to make the checks work. These can be downloaded automatically from the main server.

To get them download and update automatically every hour, follow these step. Note that this process will overwrite any scripts written locally on the proxy. To get them added to the server so they are available to you and everyone else, contact one of the admins.

Log in to your zabbix proxy and elevate to the root user.

Once logged in, create and open the script that will download and handle the scripts

sudo nano /usr/sbin/getpublicscripts.sh

Add the following commands to the script, and save/exit.

#!/bin/bash
#Remove the current scripts
rm -rf /usr/lib/zabbix/externalscripts/*.*

#Download the lastest
curl --output /usr/lib/zabbix/externalscripts/publicscripts.tar.gz https://monitoring.ctlondon.com/publicscripts/publicscripts.tar.gz

#Extract them to the correct folder
tar -xf /usr/lib/zabbix/externalscripts/publicscripts.tar.gz -C /usr/lib/zabbix/externalscripts/

Make the script executable

chmod +x /usr/sbin/getpublicscripts.sh

Now we need to add this script to CRON so it is executed every hour. Open the crontab for editing…

crontab -e

And add this line to the end of the file.

* 1 * * * /usr/sbin/getpublicscripts.sh

Running the Script Manually

If you want to pull the lastest scripts manually, log into your proxy, elevate to root and run:

./usr/sbin/getpublicscripts.sh

The download contains a timestamped file which will show you last time the folder of scripts was updated on the server.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *