Zabify pro plugin

to send push notification from your Zabbix appliance to your Zabify pro app, please install the Zabify component

Installation and configuration guide for Zabify push notification server

 1. Install the Zabify push notification server on your Zabbix server via one of the provided package types for your os.

2. To make sure the server executable is callable check the output from the following command. It should print out some version information.

				
					zabify version
				
			

3. Configure the server. The zabify server init call initializes and saves a configuration file to the provided output. It’s necessary to define a value for server-url. This has to be the url which the app users set to integrate the server into their apps. Open your Zabbix dashboard in a web browser, copy the full url and remove /zabbix.php?.... This is the url to use. You can define more settings with this call. You can get a list with all options and descriptions via zabify server init --help. Later you can update the configuration by re-running the command with your preferenced settings. You have to choose how to let the Zabify server listen for your push notifications. Choose between http and https.

3.1. If you want to configure the Zabify server to listen on a http address then you can run the following command.

				
					sudo zabify server init \
        --output /etc/zabify/.config \
        --server-url "https://example.com" \
        --no-file-log
				
			

3.2. If you want to configure the Zabify server to listen on a https address then you need a certificate for it. You can use a self signed certificate if you want to.

3.2.1. First create the CA certificate and private key with the following command. The private key will be encrypted with a passphrase and will be saved to a file named ca.key. The self signed certificate is valid for 3650 days and is saved to ca.crt.

				
					openssl req -new -newkey rsa:8192 -keyout ca.key -x509 -sha512 -days 3650 -out ca.crt
				
			

3.2.2. To create the server certificate and private key we need a configuration to define for which url the certificate will be used. Save the following configuration to a file named server.cnf. Here we define that the certificate is valid for the dns localhost and ip 127.0.0.1. With the configuration the Zabify server can be hosted locally. Adjust the configuration as needed when you plan to use another dns or ip address.

				
					[req]
default_md = sha256
prompt = no
req_extensions = v3_ext
distinguished_name = req_distinguished_name

[req_distinguished_name]
CN = localhost

[v3_ext]
keyUsage = critical,digitalSignature,keyEncipherment
extendedKeyUsage = critical,serverAuth,clientAuth
subjectAltName = DNS:localhost,IP:127.0.0.1
				
			

3.2.3. Now we can create the private key for Zabify server with the following command.

				
					openssl genrsa -out server.key 8192

				
			

3.2.4. After creating the private key we can use it to create the CSR with the following command. The -config flag is used to specify the path to the file from step 3.1.2

				
					openssl req -new -key server.key -out server.csr -config server.cnf

				
			

3.2.5. Now that we have a CSR, we can use it to generate our certificate for the server signed with our self-signed CA with the following command. The certificate will be saved into a file named server.crt. The -extfile flag is used to specify the path to the file from step 3.1.2. The -extensions flag specifies the section in configuration containing the SAN extension settings (dns and ip).

				
					openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key \
  -CAcreateserial -out server.crt -days 365 -sha512 -extfile server.cnf -extensions v3_ext

				
			

3.2.6. After the creation of every needed certificate and private key, we will initialize the Zabify server configuration with the following command.

				
					sudo zabify server init \
        --output /etc/zabify/.config \
        --server-url "https://example.com" \
        --use-https \
        --https-cert-file "path/to/server.crt" \
        --https-key-file "path/to/server.key" \
        --no-file-log

				
			

4. Make sure the server is starting without errors. When running the command some log outputs will be showed. When the server is not running correctly the server will be stopping directly after starting it and show a error description. In most cases an error occurs when a directory was not properly set up, the configuration file is corrupt or the current user has no rights to access the config and log directories.

				
					sudo zabify server start \
        --config-file /etc/zabify/.config \
        --log-file /var/log/zabify/server.log

				
			

5. When the server started without a problem from the previous step, you can stop the server by pressing Ctrl + c in the terminal.

6. Next we will verify the server was configured correctly and works as expected. First run the server in background with the following command.

				
					sudo zabify server start \
        --no-banner \
        --no-console-log \
        --config-file /etc/zabify/.config \
        --log-file /var/log/zabify/server.log &

				
			

7. Next we will send a test push notification to a test device. Fill the needed data in <>-placeholders with real data. If needed you can call zabify server test --help to get a list of every option. You can go to your Zabbix Dashboard and search for a current active or historical problem. From their you can inserts the details into the command. Alternatively you can insert random data, except for the sendTo-parameter. If you use random data you can’t open a problem by pressing on the received test push notification later. The token for the sendTo-parameter can be get from the Zabify Pro app from your test device, to which the push notification should be sent to. To get the needed token open the app, go to settings > server overview. At the bottom you will find the entry Zabify push-notification token. There are multiple ways provided to retrieve the token. Use one and insert the token value into the sendTo-parameter. After executing the command you will se some logging. If an error occurs you can find more informations about it in the printed logs. If no error message showed up the push notification should be received shortly after executing the command. Depending on the os and settings the push notification can be received later and not instantly. If no error showed up but no test push notification popped up on the test device make sure the right push notification token was used. If it was the correct token check your settings on your os which could prevent your device from receiving a push notification.

				
					zabify server test \
        --config-file /etc/zabify/.config \
        --no-file-log \
        --severity <severity-level> \
        --hostID <host-id> \
        --eventID <event-id> \
        --sendTo <sendTo>
				
			

8. When the test push notification was received on the test device we can stop the server. First find the pid of the server and then kill the process with the found pid.

				
					ps -ef | grep zabify
kill <pid>
				
			

9. Add the zabbix user to write to the log directory.

 

				
					sudo chown zabbix: /var/log/zabify
sudo chmod 755 /var/log/zabify
				
			

10. Clean up logs from previous tests with the following command:

				
					sudo rm -r /var/log/zabify/*
				
			

11. To start the Zabify push notification server when the hardware restarts copy the systemd-service into the correct directory and activate it. If you don’t want to use systemd to archieve this you have to write your own script to archieve this.

				
					sudo systemctl enable zabify.service
sudo systemctl start zabify.service

systemctl status zabify.service
				
			

12. Import the mediatype in your Zabbix web frontend. Make sure the values for the keys „protocol“, „fully_qualified_name“ and „port“ are defined exactly like the Zabify push notification server was configured. If you need you can set your proxy configuration in the value for „proxy“ to use the provided proxy to send the data to Zabify. Also make sure the client on which the Zabbix web frontend is running trust the Zabify server certificate if it uses a self signed https certificate. This can be done by setting the ca certificate as trusted via the os settings.

13. Add message templates as needed with the information you want to receive via a push notification.

14. Add and or update existing rules to use this media type like every other media types.