Ad Widget

Collapse

Using PHP Network WeatherMap with Zabbix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fireless
    Junior Member
    • Oct 2015
    • 2

    #46
    Help

    Hello,

    I'm newbie on Zabbix and I would like add php weathermap on my Zabbix.

    It's possible to have a tutorial to install and configure it ? And how to create a weather map ?

    I already tried with the information on this post, but I don't understand all.

    Thanks for your help !

    My Zabbix 2.4.6

    Comment

    • stav13
      Member
      • Oct 2013
      • 66

      #47
      Originally posted by fireless
      Hello,

      I'm newbie on Zabbix and I would like add php weathermap on my Zabbix.

      It's possible to have a tutorial to install and configure it ? And how to create a weather map ?

      I already tried with the information on this post, but I don't understand all.

      Thanks for your help !

      My Zabbix 2.4.6
      Hi,

      Sure, I have just finished implementing weathermap and have it all working now though I haven't tried getting the graphs to work yet ....

      Give me a few days and ill update this tread with all of the details.

      Cheers

      Comment

      • fireless
        Junior Member
        • Oct 2015
        • 2

        #48
        Originally posted by stav13
        Hi,

        Sure, I have just finished implementing weathermap and have it all working now though I haven't tried getting the graphs to work yet ....

        Give me a few days and ill update this tread with all of the details.

        Cheers
        Hi stav13 !

        Thank you !!

        Comment

        • AlexYoung
          Member
          • Jul 2013
          • 37

          #49
          That would be brilliant as i want to implement it at some point

          Comment

          • stav13
            Member
            • Oct 2013
            • 66

            #50
            Hi All,

            Sorry but have been very busy at work so have quickly wrote this up in my short lunch break.


            Install Weathermap

            Move zab_chart.php to default location of Zabbix web front end.

            Move both files to /weathermap/lib/datasources;

            WeatherMapDataSource_zabbixitem.php
            WeatherMapDataSource_zabbixhost.php

            In both files there is a line as below, enter a username and password for zabbix

            $useropt=array(user => 'ENTER USERNAME','password'=>'ENTER PASSWORD');

            Move both below files into the /weathermap/configs;

            test.conf
            zab_template.conf

            in zab_template.conf amend the URL to your zabbix URL

            OVERLIBGRAPH http://URL/zabbix/weathermap_chart.php?host[]={link:this:hostname_in}&item[]={link:this:itemkey_in}&host[]={link:this:hostname_out}&item[]={link:this:itemkey_out}&color[]=009900&color[]=000099&drawtype[]=5&drawtype[]=2&height=150&width=600&legend=1&period=43200
            INFOURL http://URL/zabbix/weathermap_chart.php?host[]={link:this:hostname_in}&item[]={link:this:itemkey_in}&host[]={link:this:hostname_out}&item[]={link:this:itemkey_out}&color[]=009900&color[]=000099&drawtype[]=5&drawtype[]=2&period=86400

            Create two png files called icon_up.png and icon_down.png representing that status and move to /weathermap/images

            Comment out line 94 in file CLocalApiClient.php located in /var/www/html/zabbix/include/classes/api/clients/

            Before;

            unset($params['nopermissions']);

            After;

            // unset($params['nopermissions']);



            I might have missed something but please have a go and if you get issues let me know and ill try my best to help!!!!

            Thanks
            Attached Files
            Last edited by stav13; 17-02-2016, 11:18. Reason: CLocalApiClient.php change, thanks to Jason for pointing this out!!

            Comment

            • huangyingja
              Junior Member
              • Apr 2015
              • 27

              #51
              Thank you bros, it's really helpful to me !
              I want try to use it to integrate with cacti ~

              Comment

              • Jason
                Senior Member
                • Nov 2007
                • 430

                #52
                Has anyone got this working with zabbix 2.4.X?

                I'm using the amousset plugin and information by stav to get up and running, but I'm getting the error below.

                PHP Fatal error: Cannot unset string offsets in /var/www/html/zabbix/include/classes/api/clients/CLocalApiClient.php on line 94

                Comment

                • stav13
                  Member
                  • Oct 2013
                  • 66

                  #53
                  Originally posted by Jason
                  Has anyone got this working with zabbix 2.4.X?

                  I'm using the amousset plugin and information by stav to get up and running, but I'm getting the error below.

                  PHP Fatal error: Cannot unset string offsets in /var/www/html/zabbix/include/classes/api/clients/CLocalApiClient.php on line 94
                  Hi Jason

                  Do you get this error when trying to build a map? Can you please attach a copy of the map config and the php file and I'll have a look when I can.

                  Thanks

                  Comment

                  • Jason
                    Senior Member
                    • Nov 2007
                    • 430

                    #54
                    I commented out the following line in the file and it all seems to work fine although that might cause other issues.


                    // the nopermission parameter must not be available for external API calls.
                    # unset($params['nopermissions']);


                    I'm running 2.4.7 btw on 64bit Centos 6. My test map (only 2 nodes currently) seems to build ok...

                    Has no-one written a parser to convert a map export from zabbix to the basic format for weathermap?

                    Comment

                    • stav13
                      Member
                      • Oct 2013
                      • 66

                      #55
                      Sorry Jason, my bad! that line is commented out on my system as well.

                      Must have done it whilst I was installing the app and forgot!

                      Has anyone made the leap to Zabbix 3.0 and tested weathermap with it yet ??

                      Thanks

                      Comment

                      • stav13
                        Member
                        • Oct 2013
                        • 66

                        #56
                        Hi All,

                        FYI - I can confirm this is working for Zabbix 3.0.1

                        Comment

                        • colloque
                          Member
                          • Feb 2010
                          • 72

                          #57
                          Hello,
                          I am sorry but i have a problem with the command
                          weathermap.py (I am using zabbix 3.0.1)

                          I have the following error:

                          command:
                          ./weathermap.py -s test_map -z http://x.x.x.x -l Admin -p xxxx

                          Error:
                          Traceback (most recent call last):
                          File "./weathermap.py", line 123, in <module>
                          main()
                          File "./weathermap.py", line 120, in main
                          WeathermapCLI()
                          File "./weathermap.py", line 55, in __init__
                          self._map_scan()
                          File "./weathermap.py", line 67, in _map_scan
                          map_data = zbx.scan_map(map_n)
                          File "/opt/Zabbix-Network-Weathermap/zabbix.py", line 76, in scan_map
                          raise ZbxException('map: {} not found'.format(map_name))
                          zabbix.ZbxException: map: test_map not found

                          Do you have an idea?

                          Thanks in advance.

                          Best Regards

                          Comment

                          • stav13
                            Member
                            • Oct 2013
                            • 66

                            #58
                            Originally posted by colloque
                            Hello,
                            I am sorry but i have a problem with the command
                            weathermap.py (I am using zabbix 3.0.1)

                            I have the following error:

                            command:
                            ./weathermap.py -s test_map -z http://x.x.x.x -l Admin -p xxxx

                            Error:
                            Traceback (most recent call last):
                            File "./weathermap.py", line 123, in <module>
                            main()
                            File "./weathermap.py", line 120, in main
                            WeathermapCLI()
                            File "./weathermap.py", line 55, in __init__
                            self._map_scan()
                            File "./weathermap.py", line 67, in _map_scan
                            map_data = zbx.scan_map(map_n)
                            File "/opt/Zabbix-Network-Weathermap/zabbix.py", line 76, in scan_map
                            raise ZbxException('map: {} not found'.format(map_name))
                            zabbix.ZbxException: map: test_map not found

                            Do you have an idea?

                            Thanks in advance.

                            Best Regards
                            Hi,

                            Sorry but I don't run that command to generate my maps. To be honest I'm not sure what that command does. What are you trying to achieve?

                            Thanks

                            Comment

                            • colloque
                              Member
                              • Feb 2010
                              • 72

                              #59
                              Hello,
                              Thanks for your reply.

                              I saw it on the website in the readme.md part in the script section:

                              Network weathermap for Zabbix. Contribute to Prototype-X/Zabbix-Network-Weathermap development by creating an account on GitHub.


                              Thanks.

                              Comment

                              • dampersand
                                Junior Member
                                • Apr 2016
                                • 16

                                #60
                                Hey,

                                So first off, you folks are gentlemen/women and scholars, the lot of you. This thread is chock-full of useful information (if a bit spread out).

                                Second - I'm running this using stav13's tutorial-ish-thingy on Zabbix 3.0.1 and weathermap v0.97c.

                                I have run into an error that is an easy fix, and wanted to assist:

                                Code:
                                PHP Fatal error:  Call to undefined function warn() in /usr/share/zabbix/weathermap/lib/datasources/WeatherMapDataSource_zabbixhost.php on line 47
                                Can be solved by editing line 47 the file in question (WeatherMapDataSource_zabbixhost.php) to read

                                Code:
                                if(empty($item_)) wm_warn("ZabbixItem ReadData: Not found item for host '$host_name' and key_ '$item_key'");
                                Instead of

                                Code:
                                if(empty($item_)) warn("ZabbixItem ReadData: Not found item for host '$host_name' and key_ '$item_key'");
                                You should also edit WeatherMapDataSource_zabbixitem.php for the same reason. warn() is not used in this version of weathermap, now it's wm_warn().


                                By the way... there have been some changes, it seems, in the way this stuff works. Would someone who has used stav13's tutorial implemented with zabbix be willing to post a test config? The test configs in this thread are often missing various lines like "SET zabbix_user <username>" and stuff, so I'm not 100% on what has changed, what's required, etc. I've been trial-and-erroring the crap out of it, but if someone has a dead-on working test config, I would be super grateful!
                                Last edited by dampersand; 29-04-2016, 19:44.

                                Comment

                                Working...