Multiple commands


#1

What I have now is a single global event handler that sends a SMTP trap.
I’m trying to add two additional scripts - one to upload a file, and another that emails the results of a SQL query.

How can I execute all three of these actions based on a results of a single check?


#2

Sorry, i really don’t understand the question…

what is an SMTP trap? (SNMP trap or email?)
What are you trying to check? and what should happen when which check fails?


#3

luca, thanks for the response.

I want to have three commands executed as handlers.

I have a service defined as follows

global_host_event_handler=notify-service-by-trap
# the trap generator
define service{
        use generic-service
        host_name myhost
        service_description Snort L3 Alerts
        check_command check_nrpe!check_snort_l3
        }

This works flawlessly, albeit a little slow. The SQL query used here isn’t the fastest to execute.

I would prefer to have three handlers defined like below but it doesn’t work.
I don’t have any idea how to make all three of these commands execute.

define service{
        use generic-service
        host_name myhost
        service_description Snort L3 Alerts
        check_command check_nrpe!check_snort_l3
        event_handlers notify-service-by-trap,ftp_a_file,send_an_email
        }

#4

sorry for the late reply… had some more important thing to do since the 27th… (a baby :stuck_out_tongue: )

Why don’t you create a single script which in turn calls the other three? so nagios only calls one and that should work…