Ad Widget

Collapse

bash command to disable host monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ZabbixUser2020
    Junior Member
    • Jan 2020
    • 13

    #1

    bash command to disable host monitoring

    Hi there,

    We have a powershell script which turns OFF and ON VMs (Azure automation runbook) according some different schedules, and we need to disable/enable Zabbix monitoring for a host before it gets shut down and enable once script turns it on. The script gets VMs as variables.

    What we need - a shell/linux script to which we provide host name and it disables Zabbix monitoring. The script will be placed and run on Zabbix server. It will be called by automation account (runbook) through powershell and can not be done via API, as there is no access. We would work via Azure VMs extension - calling bash file from through powershell script and providing VM (host) name.

    Zabbix server database is MySql.

    i.e. ./SetVMStatus.sh -hostname "TestVM"

    thank you.
    Last edited by ZabbixUser2020; 29-01-2020, 14:16.
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    Originally posted by ZabbixUser2020
    What we need - a shell/linux script to which we provide host name and it disables Zabbix monitoring. The script will be placed and run on Zabbix server. It will be called by automation account (runbook) through powershell and can not be done via API, as there is no access.
    I don't understand what you mean with "can not be done via API, as there is no access". Why is there no access to the API?

    What you're trying to do is something I would only do through the API, so ruling out the API immediately is pretty unfortunate.

    Yes, you *could* do this via a very carefully written SQL query, but doing that instead of using the supported, robust API is (IMHO) very much the wrong approach.

    Comment


    • ZabbixUser2020
      ZabbixUser2020 commented
      Editing a comment
      Is there a way to access Zabbix via API having only internal IP and calling it through Azure Runbook?

    • tim.mooney
      tim.mooney commented
      Editing a comment
      Try it and find out! Report back what your findings are, please.
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #3
    Hi, in your message you specified:

    The script will be placed and run on Zabbix server.
    As Tim suggested, in that script you want to place on Zabbix server, use Zabbix API commands to modify the monitoring settings. In that situation there is no need to connect to the API from anywhere outside the system, if you have a mechanism to run that script anyway.

    If that was not what you meant, please describe your limitations again.

    Markku

    Comment

    Working...