sepich / glld

Graph multiple LLD items on the same chart
37 stars 6 forks source link

Graph LLD

This is Zabbix 3 plugin to allow graph multiple LLD items on the same chart (ZBXNEXT-927).
For example you might have some disk discovery, which creates item free disk space, % for each disk found. With this plugin now you can create and automatically keep in sync graph with all the items on single chart:
Free
Interface for this looks mostly the same as for usual Graph prototype:
gLLD Edit
with additional field for Template. You can create multiple such Graphs for different Templates and ItemPrototypes. Also you can mix different ItemPrototypes of same Template on one chart. gLLD List When Graph is created such actions possible:

How it works

When you executing Run action this happens:

Installation

Unzip (or clone) to root of your zabbix-frontend-php folder (which is /usr/share/zabbix for Debian)
Then add to Main Menu with something like this:

+++ include/menu.inc.php    2016-07-24 13:04:06.000000000 -0700
@@ -240,6 +240,10 @@
                    'url' => 'services.php',
                    'label' => _('IT services')
                ],
+               [
+                   'url' => 'glld.php',
+                   'label' => _('GLLD')
+               ],
            ]
        ],
        'admin' => [

Now you can create new Graphs and apply them in Zabbix Web Interface. But as time goes - discovery would find new items (or remove missed ones) and standalone Graphs would become outdated. One solution is to press Run to update them time to time. Better solution is to configure cron job, for this fix /glld/glld.cli.php with service user creds:

#!/usr/bin/env php
<?php PHP_SAPI === 'cli' or die();
$auth=['user' => '', 'password' => '']; //fix this with valid user/password having Write access to Hosts
...

Note that user should have write access to Host on which you going to create Graphs.
Check it executing glld/glld.cli.php from shell (you might need to do chmod +x glld/glld.cli.php)
Then add it to cron, for example via such /etc/cron.d/zabbix-glld-update:

#m h dom mon dow user     command
47 * *   *   *   www-data /usr/share/zabbix/glld/glld.cli.php >/dev/null

This would update graphs once per hour (on each 47th minute)