Ad Widget

Collapse

Interesting problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • WolfFlight
    Junior Member
    • May 2012
    • 18

    #1

    Interesting problem

    First,
    While I am posting this question, I am still searching through the forums with regard to see if anyone has ever attempted similar issue.

    Here is my situation. While creation of maintenance 'tasks' is fine from the GUI I/we would like to kick off the creation of a maintenance 'task' via a script from a machine/server in question if we need to take one down without setting off triggers/actions and email notifications being sent. For instance if one of our techs is onsite at a client's location and needs to shutdown a machine, he can kick off the script and then shut down the machine without worrying about emails being sent to various admins with regard to services not being available on that machine. (Very large distributed network)

    I can put maintenance entries into the maintenance table, but feel that without mapping out the entire schema, I am missing important factors.

    #1 The maintenance does not show up in the GUI after inserted via mysql statements manually.

    #2 The manual insertion is only into the maintenance table so far and is not linked to a device/machine (need to fix that just not sure which table I should be looking at)

    #3 Since #1 and #2 are an issue, if a maintenance 'task' is created via the GUI after a manual insertion into DB is made, it gives a duplicate maintenance id error and fails to create new maintenance 'tasks'

    Surely I am not the first person that ever tried managing the zabbix database(s) via scripts outside the beautiful web GUI?
  • WolfFlight
    Junior Member
    • May 2012
    • 18

    #2
    Schema

    I am digging through the mysql tables one by one trying to find the linking data that I simply must insert into the various tables so that the GUI correctly shows the new maintenance and so that it does not cause errors for future maintenance creation

    so far it is a bit interesting to say the least.

    Comment

    • heaje
      Senior Member
      Zabbix Certified Specialist
      • Sep 2009
      • 325

      #3
      Possibly use debug mode to get what you want

      I'm not sure about Zabbix 1.8 (or previous), nor do I know what version you are using, but in Zabbix 2.0 you can set a "debug mode" checkbox in user groups. If your user is a part of a group with that checked, then you will have a a "Debug" link at the top right part of any webpage you go to. If you then add a maintenance task through the GUI like normal, after you click "Save" you can go to the debug link and see all of the queries that were run to do the action. That may get you the info that you need.

      Comment

      • WolfFlight
        Junior Member
        • May 2012
        • 18

        #4
        Think I solved it

        Turns out the four tables that are important with regard to creating maintenance tasks are:

        maintenances
        maintenances_hosts
        maintenances_windows
        timeperiods

        The first three are linked together by a key 'maintenanceid'

        The last one is linked to the third by the key 'timeperiodid'

        In order to create tasks manually in mysql the corresponding tables must be populated correctly.

        Then I simply have to calculate time since the Unix epoch in order to figure out the time periods involved (ie Date and Time) via the scripts and I should be able to place the necessary scripts out on devices in the network so techs can disable Zabbix monitoring from the device for the time period that they are working on such devices.

        (Will simplify things since only key individuals actually have full access via the Zabbix dashboard. Techs onsite do not require that level of access if they can simply start a 'maintenance' script that informs the Zabbix server of the device(s)' status with regard to maintenance.)

        Comment

        • WolfFlight
          Junior Member
          • May 2012
          • 18

          #5
          still have a problem

          If I create a task with all settings it works fine...
          (there are caveats)

          If I simply create a base task for the future in the web gui... it does not populate the other 3 tables (until it actually starts). How does it know how to fill in the other tables, it must keep this data somewhere.

          If I delete an entry... and go to create a new one with my script(s) it uses the next available id #, however in the following situation there is an issue... I hope you understand my explanation...

          Tasks 1-5 are created by whatever method. 4 and 5 are deleted..
          Script is run... and it creates a task number 4 (the next available id per the tables)

          This task 4 shows up just fine on the dashboard and will work properly.
          BIG CAVEAT HERE
          Creation if a task via the webGUI is no longer possible at this point, it throws up tons of errors...
          First it complains that there are duplicate entries for id #4
          Second it simply refuses to accept any further entries into maintenance at that point, even if I go back and delete all entries for maintenances, somewhere there is a table that contains every maintenance ever created and those id #s are still held in that table.

          Comment

          • WolfFlight
            Junior Member
            • May 2012
            • 18

            #6
            Table linkages

            I have tried utilizing MySQL Workbench to reverse engineer the Zabbix database.

            I wanted it to show me the linkages between the tables.

            Ha, fat chance. Someone had done that for Zabbix back in 2005. It has changed quite a bit since then from 11 tables to 88.

            Anyone have any already created ER diagrams with the linkages shown?

            Comment

            Working...