RussianFox / imap

Interactive map for Zabbix
https://zabbiximap.lisss.ru/
59 stars 43 forks source link

Does not work with Zabbix 3 #31

Open icovada opened 8 years ago

icovada commented 8 years ago

This does not work with Zabbix 3.

Most I managed to do is display the map and all the hosts but without getting trigger data so everything displays green

allexxf commented 8 years ago

Yes in zabbix 3 change API and some fields will not display. I changed the code and triggers steel display. In imap.php in block

    if ($action_ajax=='get_triggers') {
            $options['expandData'] = true;
            $options['expandDescription'] = true;
            $options['selectLastEvent'] = 'extend';
            $options['monitored'] = true;
            $options['maintenance'] = false;
            $options['skipDependent'] = true;
            $options['sortfield'] = array('lastchange');
            $options['sortorder'] = 'DESC';
            $options['filter'] = array('value' => TRIGGER_VALUE_TRUE);

add line

$options['selectHosts'] = 'hostid';

And in imap/imap.js in function loadTriggers() replace

                              for (var nn in data) {
                                    var trigger = data[+nn];
                                    if (!trigger) continue;
                                    if (!trigger.value==1) continue;
                                    if (!_imap.markersList[trigger.hostid]) continue;
                                    _imap.markersList[trigger.hostid].triggers[trigger.triggerid] = trigger;

                                    _imap.markersList[trigger.hostid].triggers[trigger.triggerid].lhi = lhi;
                                    addLastTrigger(trigger);
                                    luhost[trigger.hostid] = trigger.hostid;
                            };

On:

                              for (var nn in data) {

                                    var trigger = data[+nn];
                                    if (!trigger) continue;
                                    if (!trigger.value==1) continue;
                                    if (!_imap.markersList[trigger.hosts[0].hostid]) continue;
                                    _imap.markersList[trigger.hosts[0].hostid].triggers[trigger.triggerid] = trigger;

                                    _imap.markersList[trigger.hosts[0].hostid].triggers[trigger.triggerid].lhi = lhi;
                                    addLastTrigger(trigger);
                                    luhost[trigger.hosts[0].hostid] = trigger.hosts[0].hostid;
                            };

This change not perfect, but work on my zabbix 3.0

vetash commented 8 years ago

i think there need to create new branch with these edits @RussianFox

icovada commented 8 years ago

Confirmed it works.

falatronic commented 8 years ago

@icovada You can write what changes to make to view a map?

allexxf commented 8 years ago

@falatronic write alex@ltd.com.ua

tmcdon89 commented 8 years ago

I am also interested in what steps were taken to view the map on version 3.

boyemillar commented 8 years ago

Is there anyone working on a Zabbix v3.0 version of this

tmcdon89 commented 8 years ago

I see it was self-assigned about a week ago. Is this something that is actively being worked on?

brandelf68 commented 8 years ago

On zabbix 3.0 does not display the top panel filtering host groups, hosts, and trigerrs. Can anyone tell who experienced this? In advance I thank the author for his work :)

Great work! https://www.zabbix.com/forum/showpost.php?p=182386&postcount=428