Results 1 to 9 of 9

Thread: Trigger

  1. #1

    Trigger

    Hello,

    I need to use some triggers to "add 2 perf data" from two different service checks (bandwidth usage).

    By reading this http://www.shinken-monitoring.org/wiki/triggers, I wrote this conf :


    Code:
    define trigger{
      trigger_name  sum_bp
      matching_rule  total_connections=sum(perfs("dc2-swe-*/SwPortBp*", 'in'))
      hit_action   set_perfdata(self, 'total_connections=%d' % total_connections)
    
    
    }
    
    define service{
        service_description Trigger-Sum_Bp
        use trigger-service,generic-service
        host_name dc2-shk-01
        trigger sum_bp
    }
    The service is visible in WebUI but no data update.

    How can I do to try to find what is going wrong ?
    Which log to turn to "DEBUG" ? ...

    I can't find anything.

    NB : I used 2 wildcard chars in my matching rule.

  2. #2
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Trigger

    The triggers are not really documented sorry, this is more a RFC than a true doc, and in fact the implmentation jsut changed a lot since this draft

    You can have a look at a trigger in the sample configuration, look for http_avg host and trigger file (.trig).
    No direct support by personal message. Please open a thread so everyone can see the solution

  3. #3

    Re: Trigger

    I've tried with a file placed under <shinken-dir>/etc/trigger.d/sum_bp.trig

    then i've added a service

    Code:
    define service{
        service_description Trigger-Sum_Bp
        use trigger-service,generic-service
        host_name dc2-shk-01
        trigger_name sum_bp
    }
    I've always get a arbiter error :

    [1371551879] Info : the service dc2-shk-01/Trigger-Sum_Bp does have a unknown trigger_name "sum_bp"
    [1371551879] Error : [items] In Trigger-Sum_Bp is incorrect ; from /usr/local/shinken/etc/customers/test/trig.cfg
    [1371551879] Error : services conf incorrect!!
    I think my .trig is misplaced.

    I try to read from the code what is the path where trig are automatically read, but didn't find anything

    NB : I used trigger_name this time (and not trigger) in the service definition


  4. #4

    Re: Trigger

    I've alaso tried this with no success :

    Code:
    define trigger{
      trigger_name  sum_bp
      code_src /usr/local/shinken/etc/customers/test/trigger.d/sum_bp.trig
    }
    
    define service{
        service_description Trigger-Sum_Bp
        use trigger-service,generic-service
        host_name dc2-shk-01
        trigger sum_bp
    }

  5. #5
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Trigger

    Do you have a triggers_dir entry in your nagios.cfg file? If should give the top level directory of your .trig files
    No direct support by personal message. Please open a thread so everyone can see the solution

  6. #6

    Re: Trigger

    Indeed ! I add the trigger_dir ! No more error on arbiter reload.

    Code:
    define service{
        service_description Trigger-Sum_Bp
        use trigger-service,generic-service
        host_name dc2-shk-01
        trigger_name sum_bp
    }
    Here is my trigger : etc/trigger.d/sum_bp.trig (inspired from the Http Avg given in the doc and GLMF)

    Code:
    times = perfs("dc2-swe-*/SwPortBp", 'in')
    sum_time = sum(times)
    
    
    ### Only here to see if trigger is realy triggered
    f = open('/tmp/test_trig', 'w')
    f.write('This is a test\n')
    f.write(sum_time)
    f.close()
    ###
    
    return_code = 0
    output = 'Check OK'
    
    set_value(self, output=output, perfdata='sum=%dKB' % sum_time, return_code=return_code)
    Nothing happened. Still pending in WebUI.

    To understand well, trigger are executed as classic service (with check_interval ....) ?


  7. #7
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Trigger

    No services are runs AFTER a check. Look at the scheduler debug logs, there should be an error somewhere.
    No direct support by personal message. Please open a thread so everyone can see the solution

  8. #8

    Re: Trigger

    I forgot to mention it : i'm still in 1.2.4 !

    The only messages I got in Scheduler log (debug mode on)


    2013-06-25 10:46:43,370 [1372142803] Debug : scheduler resolves command '[1372142802] SCHEDULE_SVC_CHECK;dc2-shk-01;Trigger-Sum_Bp;1372142802'
    2013-06-25 10:46:43,370 [1372142803] Debug : mode= applyer, global= False
    2013-06-25 10:46:43,370 [1372142803] Debug : Searching for a new arg: dc2-shk-01 (1)
    2013-06-25 10:46:43,370 [1372142803] Debug : For command arg: dc2-shk-01
    2013-06-25 10:46:43,370 [1372142803] Debug : Searching for a new arg: Trigger-Sum_Bp (2)
    2013-06-25 10:46:43,370 [1372142803] Debug : For command arg: Trigger-Sum_Bp
    2013-06-25 10:46:43,371 [1372142803] Debug : Searching for a new arg: 1372142802 (2)
    2013-06-25 10:46:43,371 [1372142803] Debug : For command arg: 1372142802
    2013-06-25 10:46:43,371 [1372142803] Debug : Got commands SCHEDULE_SVC_CHECK [<shinken.objects.service.Service object at 0x22f8d30>, 1372142802]

  9. #9
    Junior Member
    Join Date
    Jul 2019
    Posts
    16
    Notice is some assistance site from where you can get additional data and you can check useful link to get information about quality work. You can introduce this application to submit gatherings in various legal. They will help in all the establishment destinations.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •