Hi Friends,

On enabling the debug code I found out that the Event Handler is getting
execute but it was failing with code 128. On further reading it is
suggested to use arguments instead. So now the EventCommand is

object EventCommand "cachet-notify" {
         import "plugin-event-command"
        command = [ PluginDir + "/cachet_notify" ]
         arguments = {
         cachet_component = "$cachet_component$"
    service_name = "$service.name$"
    service_state = "$service.state$"
    service_state_type = "$service.state_type$"
    service_output = "$service.output$"
}

vars.service.name = "$service.name$"
vars.service.state = "$service.state$"
vars.service.state_type = "$service.state_type$"
vars.service.output = "$service.output$"

 }


With the above EventCommand the plugin now showing in the logs "terminated
with exit code 1". The plugin expect output to be "cachet_component
service_name service_state service_state_type service_output" and I have
the updated to plugin to match its arguments based on the result.

What is the best way to receive service_name service_state
service_state_type and service_output for an Event Handler and then pass it
onto the plugin..

The Plugin is -> *https://github.com/mpellegrin/nagios-eventhandler-cachet
<https://github.com/mpellegrin/nagios-eventhandler-cachet>*    which is
presently compatible with Nagios/Icinga1 but I am running Icinga2 so trying
to make the things work for Icinga2

[2016-03-16 09:58:51 +0530] notice/Process: PID 1450
('/usr/lib64/nagios/plugins/cachet_notify' 'cachet_component' 'newtest'
'service_name' 'cachet-notify' 'service_output' 'HTTP OK: HTTP/1.0 200 OK -
33401 bytes in 0.339 second response time ' 'service_state' 'OK'
'service_state_type' 'HARD') terminated with exit code 1


[2016-03-16 09:58:51 +0530] notice/PluginEventTask: Event command for
object 'openstack-in.example.com!cachet-notify' (PID: 1450, arguments:
'/usr/lib64/nagios/plugins/cachet_notify' 'cachet_component' 'newtest'
'service_name' 'cachet-notify' 'service_output' 'HTTP OK: HTTP/1.0 200 OK -
33401 bytes in 0.339 second response time ' 'service_state' 'OK'
'service_state_type' 'HARD') terminated with exit code 1, output: Usage:
cachet_notify cachet_component service_name service_state
service_state_type service_output


*128 Error code logs*

notice/PluginEventTask: Event command for object
'openstack-in.example!cachet-notify' (PID: 32500, arguments:
'/usr/lib64/nagios/plugins/cachet_notify newtest cachet-notify CRITICAL
SOFT 'CRITICAL - Socket timeout after 10 seconds'') terminated with exit
code 128, output: execvpe(/usr/lib64/nagios/plugins/cachet_notify newtest
cachet-notify CRITICAL SOFT 'CRITICAL - Socket timeout after 10 seconds')
failed: No such file or directory



Thanks & Regards

Ankush Grover

On Tue, Mar 15, 2016 at 3:40 PM, Ankush Grover <ankushcen...@gmail.com>
wrote:

> Hi Friends,
>
> I have setup IcingaMaster in HA mode along with 2 Satellite Servers all on
> Centos 6/7 64-bit. On one of the Satellite server i am trying execute an
> event_command but some how the command is not getting executed.
>
> Icinga Version on Satellite server is 2.3.8 and on the Icinga Master is
> 2.3.6. Presently the EventCommand and Host Configuration is local to Icinga
> Satellite server.
>
>
> *Icinga Feature list on the Satellite Server:*
>
> Disabled features: compatlog debuglog gelf icingastatus livestatus
> opentsdb perfdata statusdata syslog
> Enabled features: api checker command graphite ido-mysql mainlog
> notification
>
>
> *Event Command*
>
> object EventCommand "cachet-notify" {
>          import "plugin-event-command"
>          command = [ PluginDir + "/cachet_notify $cachet_component$ $
> service.name$ $service.state$ $service.state_type$ $service.output$" ]
>
> }
>
> *Host Configuration File*
>
> object Host "openstack-in.example.com" {
>    import "generic-host"
>   address = "172.31.4.253"
>   vars.os = "Linux"
>   vars.notification["mail"] = {
>     groups = [ "icingaadmins" ]
> enable_event_handler = true
>   }
> }
>
>
> object Service "cachet-notify" {
>          import "generic-service"
>          host_name = "openstack-in.example.com"
>          check_command = "http"
>          vars.cachet_component = "newtest"
>          event_command = "cachet-notify"
>         enable_event_handler = true
>  }
>
>
> Notifications comes properly if the apache goes up or down on the
> openstack-in.example server but the event_command is not getting executed.
>
>
> *Icinga Logs*
>
>
> [2016-03-15 08:56:21 +0530] information/ApiClient: Reconnecting to API
> endpoint 'icingamaster1.example.com' via host 'icingamaster1.example.com'
> and port '5665'
> [2016-03-15 08:56:21 +0530] information/ApiClient: Reconnecting to API
> endpoint 'icingamaster2.example.com' via host 'icingamaster2.example.com'
> and port '5665'
> [2016-03-15 08:56:21 +0530] information/IdoMysqlConnection: MySQL IDO
> instance id: 1 (schema version: '1.13.0')
> [2016-03-15 08:56:22 +0530] information/ApiListener: New client connection
> for identity 'icingamaster1.example.com'
> [2016-03-15 08:56:22 +0530] information/ApiListener: New client connection
> for identity 'icingamaster2.example.com'
> [2016-03-15 09:00:47 +0530] information/ExternalCommandListener: Executing
> external command: [1458012647] SEND_CUSTOM_SVC_NOTIFICATION;
> openstack-in.example.com;cachet-notify;2;testuser;new test
> [2016-03-15 09:00:47 +0530] information/Checkable: Checking for configured
> notifications for object 'openstack-in.example.com!cachet-notify'
> [2016-03-15 09:00:47 +0530] information/Notification: Sending notification
> 'openstack-in.example.com!cachet-notify!mail-icingaadmin' for user
> 'icingaadmin'
> [2016-03-15 09:00:47 +0530] information/Notification: Completed sending
> notification 'openstack-in.example.com!cachet-notify!mail-icingaadmin'
> for checkable 'openstack-in.example.com!cachet-notify'
> [2016-03-15 09:01:09 +0530] information/Checkable: Checking for configured
> notifications for object 'openstack-in.example.com!cachet-notify'
> [2016-03-15 09:01:09 +0530] information/Notification: Sending notification
> 'openstack-in.example.com!cachet-notify!mail-icingaadmin' for user
> 'icingaadmin'
> [2016-03-15 09:01:09 +0530] information/Notification: Completed sending
> notification 'openstack-in.example.com!cachet-notify!mail-icingaadmin'
> for checkable 'openstack-in.example.com!cachet-notify'
> [2016-03-15 09:01:21 +0530] information/DynamicObject: Dumping program
> state to file '/var/lib/icinga2/icinga2.state'
> [2016-03-15 09:03:40 +0530] information/Checkable: Checking for configured
> notifications for object 'openstack-in.example.com!cachet-notify'
> [2016-03-15 09:03:40 +0530] information/Notification: Sending notification
> 'openstack-in.example.com!cachet-notify!mail-icingaadmin' for user
> 'icingaadmin'
> [2016-03-15 09:03:40 +0530] information/Notification: Completed sending
> notification 'openstack-in.example.com!cachet-notify!mail-icingaadmin'
> for checkable 'openstack-in.example.com!cachet-notify'
>
>
> Do let me know if you need any further information.
>
>
> Thanks & Regards
>
> Ankush Grover
>
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to