-
Notifications
You must be signed in to change notification settings - Fork 5
1 Installation
The suggested installation path of the script, config and templates is on the same host where Zabbix lives but outside the actual Zabbix directory, although it is possible to run the script entirely somewhere else (the code is webhook based, picking up information from Zabbix is via the front-end login and API).
This code has been tested with Zabbix 6 (LTS and 6.4) on Linux with a local Postfix. Not sure if it can/will run in any Zabbix versions under 6 or on other environments as I have no facilities nor time available to test on any lower versions or other platforms. Do note that the coding provisioned is as agnostic to the platform as possible.
- That you have Composer, CURL and PHP installed (including php-curl)
- You are familiar with "composer"
- You know how to configure and secure a webserver/virtual host (Apache, NGINX, etc.)
- That you are familiar with Zabbix (specifically for setting up "Actions")
The code has been tested with the following software versions:
- Zabbix 5.4.x, Zabbix 6.0.x LTS, Zabbix 6.4.x
- PHP v7.4.6 (please migrate to PHP 8), PHP v8.2.7
- PHPMailer 6.8.0+ (verified with mailGraph v2.12 onwards)
- Twig v3.3.0+ (verified with mailGraph v2.12 onwards)
- Curl 7.61.1+ (verified with mailGraph v2.x onwards) (called from PHP-Curl)
- Download or clone this repository
- Pick a directory within a (virtual) host of your webserver
- Change working directory to this new/existing directory
- Create the directories
config
-
images
(will be automatically created if missing) -
log
(will be automatically created if missing) templates
-
tmp
(will be automatically created if missing)
- Make sure the directories contain the right access rights for the web server (read/write for
images
,log
andtmp
)- MailGraph will throw an error from the Zabbix GUI if not set correctly and will stop processing
- Copy
.htaccess
to the main directory (if not using Apache make sure your webserver denies http access to /config!) - Copy
mailGraph.php
to the main directory - Install PHPMailer
composer require phpmailer/phpmailer
- Install TWIG:
composer require twig/twig
- Copy
config/config.php
to the/config
directory - Copy
config/config.json.template
to the/config
directory and rename toconfig.json
(we will configure in the next step).- Use config.json.template.multigraph if you would like to add multiple periods of the same graph to the message!
- Copy
templates/html.template
andtemplates/plain.template
to your/templates
directory - Ensure that the directories and contents is readable to the web server user, for example:
chown -R apache.apache *
. - Copy
mailGraph.xml
to a location where you can upload the Media Type definition to Zabbix (we will load into / configure in Zabbix in the next steps under 2- Configuration)
Please perform updates on composer on a regular basis:
composer update