Ad Widget

Collapse

Set Maintenance remotely

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roxy
    Junior Member
    • Mar 2009
    • 12

    #1

    Set Maintenance remotely

    I've many scripts for Virtual Machine backup. It would be very useful if I can add to script a command to enable maintenance (before backup start) and a command di disable maintenance (after backup end). There is such a possibility from linux remote host doing VMs backup ? It would be very useful also to have a timeout for maintenance disabled, so if backup scripts does not end correctly, after a predefined time maintenance re enable automatically.

    Regards
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    There's a ticket now to add this feature to zabcon :-)
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

    Comment

    • roxy
      Junior Member
      • Mar 2009
      • 12

      #3
      Thank you. I hope this functionality will be added as soon as possible. How can I'll do that with Zabcon on a remote machine ? must I'll install zabbix also on remote machine ?

      Comment

      • nelsonab
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2006
        • 1233

        #4
        Zabcon is a command line shell to manipulate Zabbix. All you need to do is be able to connect to the Zabbix fronted from the machine you wish to use Zabcon.
        RHCE, author of zbxapi
        Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
        Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

        Comment

        • roxy
          Junior Member
          • Mar 2009
          • 12

          #5
          What do you mean with Front End ? Can I execute commando from remote machine with Zabcon programmatically (inside a script) ? Without access to web front end ? How can I do that ? can you provide me an example ?

          Regards

          Comment

          • nelsonab
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Sep 2006
            • 1233

            #6
            First I'll talk about the API, then about how Zabcon fits in the picture

            The api is accessed through the web interface. Meaning it's a specific php script which you send commands to. Thus to access the API you must be able to connect to the web interface from where you want to make you API call. It is possible to write a script which uses the API to manipulate Zabbix, but again to use the API you must be able to access the web frontend form the machine you wish to run your API call from, this does not mean you need to have a web browser installed on this system, just that your routes and firewall rules allow packets to the Zabbix web frontend.

            Zabcon is really a shell wrapper to the API. It allows you to manipulate Zabbix via the API much like you would change settings for Asterisk or Backula or a switch through a cli interface. It is also possible to feed Zabcon a small list of commands on the command line to be executed, thus you can manipulate Zabbix via Zabcon in a bash script.

            Hopefully this clears some things up for you.
            RHCE, author of zbxapi
            Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
            Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

            Comment

            • roxy
              Junior Member
              • Mar 2009
              • 12

              #7
              Yes, now it's clear. Can you write or attach an example ? If so, can't I set Maintenance as I like ?

              Comment

              • nelsonab
                Senior Member
                Zabbix Certified SpecialistZabbix Certified Professional
                • Sep 2006
                • 1233

                #8
                Right now there isn't an example as I haven't added the feature yet, but the command inside Zabcon might be something like this:
                +> update host maintenance id=1234 maintenance=on
                or
                +> update host maintenance id=1234 maintenance=off
                RHCE, author of zbxapi
                Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
                Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

                Comment

                • untergeek
                  Senior Member
                  Zabbix Certified Specialist
                  • Jun 2009
                  • 512

                  #9
                  I wrote my own scripts to use from the command-line to acknowledge events and create instantaneous maintenances. I developed my code after looking at the SQL queries used by the frontend. Zabcon just isn't possible for me yet.

                  Comment

                  • nicolassd
                    Junior Member
                    • Jul 2011
                    • 2

                    #10
                    Hi

                    I'm trying to create a maintenance on/off to be executed by a script, I have installed zabcon to call a API maintenance and now get this issues:

                    API Version: 1.3
                    +> raw api maintenance.create hostids=10176 name="Test Maintenance" maintenance_type=1 timeperiods={timeperiod_type=0 start_time=82800 period=7200}
                    Unexpected parameter "="

                    And I test with Zabbix Admin and Zabbix Super Admin user:

                    +> raw api maintenance.create hostids=10176 name="Test Maintenance"
                    You do not have permission to perform that operation

                    Zabbix version ->1.8.5
                    zabcon Build Number: 370

                    you can help me?

                    Thank you
                    Last edited by nicolassd; 08-03-2012, 21:19.

                    Comment

                    Working...