Scripts in Zabbix can be used to generate item data for monitoring, for actions when a trigger occurs, or allow users to manually run from the web interface. Scripts can be any language and do basically anything as long as it can accept command line arguments and the output can be seen by Zabbix. This post explains how to get scripts on to the Zabbix server.


Scripts will need a shebang line to define the interpreter used. If you are using Python 3 you will need:

#!/usr/bin/env python3

Or similar based on how your system is configured. If you don’t put this the script won’t execute without defining which interpreter to run when you call the script.


Scripts need to be placed in the Zabbix externalscripts folder which by default is located at /usr/lib/zabbix/. The easiest way to load these files is with an SCP client like WinSCP which is usually enabled on most Linux systems that will be running your Zabbix server. Connect to the server and try to copy the files over:

This error will most likely occur so you will need to adjust permissions on the externalscripts folder on the Zabbix server. Start by checking what the current permissions are:

Checked via terminal
Checked via WinSCP

Since root owns these files they can write to them, so you can connect via WinSCP using the root account and add the files, or you could assign the folder to a group that the user is in, or you could allow others to write. Either method works since this folder is not critical to anything besides Zabbix external scripts. (I’m going to hear about this from someone)

This is what your folder should look like (_pycache_ will create on its own):

Everything should be loaded on the Zabbix server but there still will be some permission issues. If you left it as-is you would end up with this error in Zabbix

/usr/lib/zabbix/externalscripts/ashlydevice: [13] Permission denied

The reason this failed is that the scripts are not executable by anyone based on the current permissions. Let’s try to fix that, run this from /usr/lib/zabbix:

chmod 554 -R externalscripts | chown zabbix.zabbix -R externalscripts

Now the script should be executable within Zabbix.