Ad Widget

Collapse

Using PHP Network WeatherMap with Zabbix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mschedrin
    Senior Member
    • Jun 2009
    • 179

    #16
    Weathermap plugin which uses zabbix API https://bitbucket.org/mschedrin/weat...-zabbix-plugin

    Comment

    • Burps
      Junior Member
      • Nov 2014
      • 10

      #17
      Hello,
      • 1st point
        I've successfully setup Weathermap in zabbix, and wanted to sum up the necessary steps, for everyone : here is my process (2015-02-25) :
        Debian Wheezy
        Zabbix 2.4.3

        Code:
        wget http://network-weathermap.com/files/php-weathermap-0.97c.zip
        unzip php-weathermap-0.97c.zip
        cp -rp weathermap/ /usr/share/zabbix/
        cd /usr/share/zabbix/weathermap/
        # Verify
        php check.php
        # 2 "PHP Strict Standards" errors, not serious apparently
        # Check if a weathermap.png was created in http://1.2.3.4/zabbix/weathermap/weathermap.png
        
        # in editor.php :
        $ENABLED=true;
        // ...
        // To avoid the warning message about Cacti
        $ignore_cacti=TRUE;
        
        cd /tmp
        git clone https://github.com/amousset/php-weathermap-zabbix-plugin
        cp -rp php-weathermap-zabbix-plugin/lib/* /usr/share/zabbix/weathermap/lib/
        
        cd /usr/share/zabbix/weathermap
        chown www-data configs/
        chmod u+w configs/
        
        cat >>/etc/apache2/conf.d/zabbix <<EOF
        <Directory "/usr/share/zabbix/weathermap">
            <Files editor.php>
                Order Deny,Allow
                Deny from all
                Allow from 127.0.0.1
            </Files>
        </Directory>
        EOF
        
        # in Zabbix GUI, create a "weathermap" user, read-only
        # then in the graph conf file, global section : 
        SET zabbix_user weathermap
        SET zabbix_password PASSWORD
        SET zabbix_url http://1.2.3.4/zabbix/api_jsonrpc.php
        
        # In the regular LINKS section :
        LINK node1-node2
                TARGET zabbix:itemid:Switch1:24471:24263
                NODES node1 node2
        
        # Then, generate the map : 
        ./weathermap --config configs/simple.conf
        Here are all the references I used :

        https://wiki.minet.net/wiki/monitoring/weathermap


        I first had some trouble because of using a self-signed ssl-cert, but I solved it with adding the following lines in SimpleZabbixApi.php (this is not a production server...) :
        Code:
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
      • 2nd point
        mschedrin: I've tried your plugin, but I had an error I could not solve :
        Code:
        failed to connect to zabbix api!
        and in apache logs :
        Code:
        ==> /var/log/apache2/error.log <==
        [Wed Feb 25 10:19:23 2015] [error] [client 10.11.12.13] PHP Notice:  Undefined index: hostname in /usr/share/zabbix/weathermap2/zabbix-graph.php on line 8
        [Wed Feb 25 10:19:23 2015] [error] [client 10.11.12.13] PHP Notice:  Undefined index: iface in /usr/share/zabbix/weathermap2/zabbix-graph.php on line 9
        [Wed Feb 25 10:19:23 2015] [error] [client 10.11.12.13] PHP Notice:  Undefined index: imageonly in /usr/share/zabbix/weathermap2/zabbix-graph.php on line 10
        [Wed Feb 25 10:19:23 2015] [error] [client 10.11.12.13] PHP Warning:  Creating default object from empty value in /usr/share/zabbix/weathermap2/lib/zabbix-api/ZabbixAPI.class.php on line 110
        
        ==> /var/log/apache2/ssl_access.log <==
        10.11.12.13 - - [25/Feb/2015:10:19:23 +0100] "GET /zabbix/weathermap2/zabbix-graph.php HTTP/1.1" 200 436 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.4.0"
        10.21.7.77 - - [25/Feb/2015:10:19:23 +0100] "POST /zabbix/api_jsonrpc.php/api_jsonrpc.php HTTP/1.1" 200 1719 "-" "ZabbixAPI v1.0 - http://andrewfarley.com/zabbix_php_api"
        I'm not sure I installed it the right way though : maybe you could explain a bit more how to setup correctly ?

      Regards
      Last edited by Burps; 25-02-2015, 17:09. Reason: Error solved

      Comment

      • Burps
        Junior Member
        • Nov 2014
        • 10

        #18
        problem solved...
        Last edited by Burps; 25-02-2015, 17:10. Reason: un-necessary debugging steps

        Comment

        • stav13
          Member
          • Oct 2013
          • 66

          #19
          How?

          Originally posted by Burps
          problem solved...
          How did you did you solve this as I get the failed to connect to Zabbix api and it's driving me mad!!

          Thanks

          Comment

          • Burps
            Junior Member
            • Nov 2014
            • 10

            #20
            Originally posted by stav13
            How did you did you solve this as I get the failed to connect to Zabbix api and it's driving me mad!!

            Thanks
            Sorry, I did not solve this problem actually...

            I first had some problems with my "1st point", that I finally solved, hence the edit/corrections to the topic.

            I did not try to go further with the 2nd point, sorry, so THIS problem is not solved.

            Have you tried my How-to, using the plugin from " amousset" ? Maybe I could help you on this plugin.

            Regards

            Comment

            • stav13
              Member
              • Oct 2013
              • 66

              #21
              Originally posted by Burps
              Sorry, I did not solve this problem actually...

              I first had some problems with my "1st point", that I finally solved, hence the edit/corrections to the topic.

              I did not try to go further with the 2nd point, sorry, so THIS problem is not solved.

              Have you tried my How-to, using the plugin from " amousset" ? Maybe I could help you on this plugin.

              Regards
              Hi,

              I got the "amousset" plugin to work, however the main issue i had with this was I cannot show host and link status nor the overlib graphs.

              There does appear to be a very big "gap" within the maps on Zabbix and I was hoping to be able address these issues with using weathermap in the same way Cacti uses it. I unfortunately am not a programmer so was hoping that these plugins would do the job but I have attempted to email/message the developers but they do not respond! very frustrating!

              All I can do currently with the "amousset" plugin is show the link speeds, however I would love to be able to show host status, link status and embed graphs into the map.

              If you could help with this I would be very grateful!!

              Thanks
              Last edited by stav13; 03-03-2015, 10:42. Reason: grammer

              Comment

              • sersad
                Senior Member
                • May 2009
                • 518

                #22
                there is a solution https://www.zabbix.com/forum/showthread.php?t=20208
                no graphs in 2.4

                Comment

                • Burps
                  Junior Member
                  • Nov 2014
                  • 10

                  #23
                  Originally posted by stav13
                  Hi,

                  I got the "amousset" plugin to work, however the main issue i had with this was I cannot show host and link status nor the overlib graphs.

                  [...]

                  All I can do currently with the "amousset" plugin is show the link speeds, however I would love to be able to show host status, link status and embed graphs into the map.

                  If you could help with this I would be very grateful!!

                  Thanks
                  Hi,

                  I did not try yet to show host and link status, but I did show graph on links, et made the links be an "hyperlink" to the graph :
                  Code:
                  SET post_zabbix_graphs 1
                  SET post_zabbix_graph_link 1
                  SET post_zabbix_graph_base_url https://1.2.3.4/zabbix
                  SET post_zabbix_graph_width 420
                  SET post_zabbix_graph_height 150
                  SET post_zabbix_graph_period 86400
                  ...
                  
                  # regular LINKs:
                  LINK node1-node2
                          OVERLIBGRAPH zabbix:graphid:Switch1:680
                          TARGET zabbix:itemid:Switch1:24468:24260
                          NODES node1 node2
                          INFOURL zabbix:graphid:Switch1:680
                  Note that you can display more than one graph on the "mouseover", using the very last plugin from "amousset", since I submitted a few lines of code, to behave like the original weathermap. It's not (IMO) very readable, but it works :
                  Code:
                  OVERLIBGRAPH zabbix:graphid:Switch1:643 zabbix:graphid:Switch1:673  zabbix:graphid:Switch1:674
                  I also suggested amousset a few corrections to the manual, and he published a new version last Friday. Go back check it.

                  I'm not very familier with weathermap, I was asked to set it up, so I'm not sure to understand correctly : what exactly do you want to show as "host status, link status" : maybe i'm interested in it too, but don't know yet !!

                  As for the plugin from mschedrin, I did not try further, so can't tell you any more..

                  Regards

                  Comment

                  • stav13
                    Member
                    • Oct 2013
                    • 66

                    #24
                    Originally posted by Burps

                    I'm not very familier with weathermap, I was asked to set it up, so I'm not sure to understand correctly : what exactly do you want to show as "host status, link status" : maybe i'm interested in it too, but don't know yet !!

                    As for the plugin from mschedrin, I did not try further, so can't tell you any more..

                    Regards
                    Hi Burps,

                    The main reason for host status and link status is we have multiple DC's which contain Core, Aggregation and Access layer with multiple LAGs running between them all. In case of a switch/router failure within that setup I would find it very useful to see at a glance which item within that has gone down and which links have been affected. Basically if a switch/router goes down then the icon for that item would switch to another image and likewise with the link however I would think that would be monitored from its operational or administrative status.


                    To be honest I am now confused on which solution is being looked at or whether they are actually the same. From my understanding there is the "amousset" plugin and also another solution following this link;



                    Am I correct in that thinking?

                    Thanks

                    Comment

                    • Burps
                      Junior Member
                      • Nov 2014
                      • 10

                      #25
                      I think there are 3 solutions actually :
                      - amousset : https://github.com/amousset/php-weat...zabbix-plugin/
                      - mschedrin : https://bitbucket.org/mschedrin/weat...-zabbix-plugin
                      - and one suggested by sersad, in this post : https://www.zabbix.com/forum/showthr...t=20208&page=4

                      I successfully setup the one fom amousset.
                      I had the "connection failed" with the 2nd one
                      I did not try the 3rd one, so can't tell.

                      Regards

                      Comment

                      • sersad
                        Senior Member
                        • May 2009
                        • 518

                        #26
                        Originally posted by Burps
                        I did not try the 3rd one, so can't tell.

                        Regards
                        3rd all work on 2.2.x
                        2.4.x work without pop-up graph
                        error in weathermap_chart.php
                        I have not found a solution. Poor knowledge of PHP
                        http://zabbix/weathermap_chart.php?host[]=Kan_ME3400&item[]=ifHCInOctets.GigabitEthernet0-1&host[]=Kan_ME3400&item[]=ifHCOutOctets.GigabitEthernet0-1&color[]=009900&color[]=000099&drawtype[]=5&drawtype[]=2&height=100&width=400&legend=1
                        Last edited by sersad; 04-03-2015, 16:00.

                        Comment

                        • sersad
                          Senior Member
                          • May 2009
                          • 518

                          #27
                          Burps, what version of zabbix?

                          Comment

                          • rekeds
                            Junior Member
                            • Feb 2014
                            • 21

                            #28
                            this looks fun, will try this out, thank you for posting.

                            Comment

                            • nuteric
                              Junior Member
                              • Mar 2013
                              • 4

                              #29
                              I'm trying to add a TARGET to a NODE with the network weathermap solution of amousset.
                              Has anyone be able to establish this?
                              The line I'm using is
                              TARGET zabbix:itemid:host:28601
                              When create the map i'm getting WMWARN08 not a valid target.
                              But my hostname and itemid is correct.
                              Does someone have a solution for this?
                              thanks in advance

                              Comment

                              • Burps
                                Junior Member
                                • Nov 2014
                                • 10

                                #30
                                Quick answer : your syntax seems to be wrong :
                                Code:
                                To configure a link, use the following  TARGET  syntax:
                                TARGET zabbix:keyname:hostname:input_item_name:output_item_name
                                I think you're missing the last utput_item_name

                                I'm busy, so can't investigate more, but "it works for me"

                                Comment

                                Working...