diff options
author | Ramesh Nachimuthu <rnachimu@redhat.com> | 2014-03-13 19:26:00 +0530 |
---|---|---|
committer | Bala.FA <barumuga@redhat.com> | 2014-04-29 10:21:36 +0530 |
commit | 998e1f9ef43f8fd6e2a7a3722bfd4f3f734c450d (patch) | |
tree | b67379b12887cf4a0fa143ab03c10a80fb1c46a7 /config | |
parent | 7f950eef214193ed6738f445995e058bcf66d3ca (diff) |
Notification: Notification handler for ovirt notification
Added a new notification handler to notify nagios events
to ovirt. A new contact ovirt is added with the handler
which can sent events/alerts to ovirt engine using
Rest API. By default all gluster related configuration
entities like host, volume, gluster, bricks will have this
contact.
By default contact ovirt will have some default values for
ovirt engie rest api and user fields. User has to fill the
right values in ovirt contact defined in gluster-contacts.cfg
file. Ovirt password has to be configured as a user variable
$USER3$ in file /etc/nagios/private/resource.cfg. User variable
$USER3$ used in command to pass the password to the handler.
Change-Id: I19074af6ae1ee4a8c16d8821b10a1c3a345f321a
Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
Reviewed-on: https://cuckoo.blr.redhat.com:8443/8
Reviewed-by: Timothy Asir <tim.gluster@gmail.com>
Reviewed-by: Sahina Bose <sabose@redhat.com>
Diffstat (limited to 'config')
-rw-r--r-- | config/Makefile.am | 1 | ||||
-rw-r--r-- | config/gluster-commands.cfg | 13 | ||||
-rw-r--r-- | config/gluster-contacts.cfg | 15 | ||||
-rw-r--r-- | config/gluster-templates.cfg | 52 |
4 files changed, 63 insertions, 18 deletions
diff --git a/config/Makefile.am b/config/Makefile.am index 7c3c8be..7e19136 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -4,6 +4,7 @@ glusternagiosconf_DATA = \ gluster-host-groups.cfg \ gluster-host-services.cfg \ gluster-templates.cfg \ + gluster-contacts.cfg \ $(NULL) glusternagiosdefaultconfdir = $(sysconfdir)/nagios/gluster/default diff --git a/config/gluster-commands.cfg b/config/gluster-commands.cfg index 5c335c7..ccf2998 100644 --- a/config/gluster-commands.cfg +++ b/config/gluster-commands.cfg @@ -31,5 +31,16 @@ define command { define command { command_name host_service_handler - command_line $USER1$/gluster_host_service_handler.py -s $SERVICESTATE$ -t $SERVICESTATETYPE$ -a $SERVICEATTEMPT$ -l $HOSTADDRESS$ -n $SERVICEDESC$ + command_line $USER1$/gluster_host_service_handler.py -s $SERVICESTATE$ -t $SERVICESTATETYPE$ -a $SERVICEATTEMPT$ -l $HOSTADDRESS$ -n "$SERVICEDESC$" +} + +define command { + command_name notify-host-to-ovirt + command_line $USER1$/gluster/notify_ovirt_engine_handler.py -c $HOSTGROUPNAME$ -H $HOSTNAME$ -g $_HOSTGLUSTER_ENTITY$ -t $HOSTSTATE$ -o $_CONTACTOVIRT_REST_API$ -u $_CONTACTOVIRT_USER$ -p $USER3$ +} + +define command { + command_name notify-service-to-ovirt + command_line $USER1$/gluster/notify_ovirt_engine_handler.py -c $HOSTGROUPNAME$ -H $HOSTNAME$ -g $_SERVICEGLUSTER_ENTITY$ -s "$SERVICEDESC$" -t $SERVICESTATE$ -o $_CONTACTOVIRT_REST_API$ -u $_CONTACTOVIRT_USER$ -p $USER3$ + } diff --git a/config/gluster-contacts.cfg b/config/gluster-contacts.cfg new file mode 100644 index 0000000..758a102 --- /dev/null +++ b/config/gluster-contacts.cfg @@ -0,0 +1,15 @@ +define contact { + contact_name ovirt + alias Ovirt Engine + email admin@ovirt.com + service_notification_period 24x7 + service_notification_options w,u,c,r + service_notification_commands notify-service-to-ovirt + host_notification_period 24x7 + host_notification_options d,u,r + host_notification_commands notify-host-to-ovirt + can_submit_commands 1 + _ovirt_rest_api http://ovirt.com:8080/ovirt-engine/api + _ovirt_user admin@internal +} + diff --git a/config/gluster-templates.cfg b/config/gluster-templates.cfg index 3ee66d4..ce7e307 100644 --- a/config/gluster-templates.cfg +++ b/config/gluster-templates.cfg @@ -1,32 +1,50 @@ +define host{ + name gluster-generic-host + use linux-server + register 0 + contacts +ovirt +} + define host { - name gluster-host - use linux-server - check_command check_remote_host - register 0 + name gluster-host + use gluster-generic-host + check_command check_remote_host + register 0 + _gluster_entity Host } define host { - name gluster-cluster - use linux-server - register 0 + name gluster-cluster + use gluster-generic-host + register 0 + _gluster_entity Cluster } define host{ - name gluster-volume - use linux-server - register 0 + name gluster-volume + use gluster-generic-host + register 0 + _gluster_entity Volume +} + +define service { + name gluster-service + use generic-service + register 0 + contacts +ovirt + _gluster_entity Service } define service { - name gluster-service-with-graph - use generic-service - action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$ - register 0 + name gluster-service-with-graph + use gluster-service + action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$ + register 0 } define service { - name gluster-service-without-graph - use generic-service - register 0 + name gluster-service-without-graph + use gluster-service + register 0 } |