Ad Widget

Collapse

Remote Command Group Send

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tunc
    Junior Member
    • Aug 2015
    • 5

    #1

    Remote Command Group Send

    Hi

    A question about remote command. Is it possible create a action for a host group and that is send a script for just one host which one has a problem ?

    I did create a action for host group but when a service down in the host, action send the scripts to all host (it is the disaster). But i ve got so many host group and I dont want create actions for all host one by one.

    mucahit and mucahit2 in same host group and has some template
    Attached Files
  • jamesNJ
    Senior Member
    • Jun 2015
    • 103

    #2
    There is a reference here:


    That action commands support macros. However it also looks like action scripts in general are limited to agents that are directly monitored by zabbix server (not via a proxy).

    If you are setting the action to run on the zabbix agent, then you could use a macro like {HOST.IP} as a parameter to your script, and then have the individual hosts check that and exit the script if running the script is not desired.

    Comment

    • tunc
      Junior Member
      • Aug 2015
      • 5

      #3
      Thanks for your help James .
      I've been searching macros example in web with your advice. I try to use {HOST.IP} also {HOST.HOST} in script, like that {HOST.IP} sudo /etc/init.d... but script working perfectly although still same problem, sended 2 command to my 2 test host at same time..
      I' m not sure do I enter the macro in the host configuration ?

      Comment

      • jamesNJ
        Senior Member
        • Jun 2015
        • 103

        #4
        Sorry if I was not clear. I meant to imply that you should pass the host name or IP to your script. So something like:

        /usr/local/bin/myscript {HOST.IP} parameter2 parameter3 ...

        Then within your script, you decide (based on the passed in host/ip address) if the script should run.

        I don't think there is a way to set an action group so that only a particular host is contacted to run a script. So by my example, zabbix connects to all hosts as usual, but then the host script decides if it should do something or not.

        Or at least that is the theory ... I haven't tried this myself ... I hope it helps.

        Comment

        Working...