Page 1 of 1

Notification on status information change status is 'critic'

Posted: Fri Aug 27, 2021 2:51 am
by RIDS_I2MP
Hi Team,

We have a requirement for custom plugin. We want notification need to be sent when status information changes when the status is 'critical\warning'. Even after status is critical status information keeps on changing then we want alerts that information changes.

Kindly help

Thanks in advance.

Re: Notification on status information change status is 'cri

Posted: Fri Aug 27, 2021 5:01 pm
by gsmith
Hi,

Try this: Configure, CCM, Services
Edit the service (wrench icon)
On the Check settings tab:
set Check Interval 2
set Retry Interval 1
set Max Check Attempt 1
set Flap detection enabled Off
Image20.jpg
On the Alert Settings tab:
set Notification Interval 0
set First notification delay 0
Image21.jpg
Save the service and Apply Configuration

As long as no one acknowledges the alert you will see updates (and receive emails if you like) everytime
the service changes state. The quickest the checks can be performed is every two minutes.

Please let me know how that works for you.

Thanks

Re: Notification on status information change status is 'cri

Posted: Sat Aug 28, 2021 2:51 am
by RIDS_I2MP
Hello gsmith,

I have made below changes as mentioned but its not fulfilling my request.
2021-08-28_131216.png
2021-08-28_131247.png
We are specific that if status = Red and whenever status information changes (not status) till then we should receive mails.
Once it is green it should not check for status information.

Re: Notification on status information change status is 'cri

Posted: Mon Aug 30, 2021 9:44 am
by gsmith
Hi,

I could not find a plugin that does what you need, but you should look at https://exchange.nagios.org//
to see if anyone else has created one.

If you don't see one there I suggest you leverage the objects/servicestatus which would provide you with the
following output for each service:

Code: Select all

            "host_name": "localhost",
            "service_description": "Current Load",
            "display_name": "Current Load",
            "host_object_id": "150",
            "host_address": "127.0.0.1",
            "host_alias": "localhost",
            "icon_image": "",
            "icon_image_alt": "",
            "notes": "",
            "notes_url": "",
            "action_url": "",
            "servicestatus_id": "1",
            "instance_id": "1",
            "service_object_id": "152",
            "status_update_time": "2021-08-30 09:25:37",
            "output": "OK - load average: 1.38, 1.04, 0.76",
            "long_output": "",
            "perfdata": "load1=1.380;5.000;10.000;0; load5=1.040;4.000;6.000;0; load15=0.760;3.000;4.000;0;",
            "current_state": "0",
            "has_been_checked": "1",
            "should_be_scheduled": "1",
            "current_check_attempt": "1",
            "max_check_attempts": "4",
            "last_check": "2021-08-30 09:25:37",
            "next_check": "2021-08-30 09:30:37",
            "check_type": "0",
            "check_options": "0",
            "last_state_change": "2021-06-21 09:59:07",
            "last_hard_state_change": "2021-06-21 09:59:07",
            "last_hard_state": "0",
            "last_time_ok": "2021-08-30 09:25:37",
            "last_time_warning": "1969-12-31 18:00:00",
            "last_time_unknown": "1969-12-31 18:00:00",
            "last_time_critical": "1969-12-31 18:00:00",
            "state_type": "1",
            "last_notification": "1969-12-31 18:00:00",
            "next_notification": "1969-12-31 18:00:00",
            "no_more_notifications": "0",
            "notifications_enabled": "1",
            "problem_has_been_acknowledged": "0",
            "acknowledgement_type": "0",
            "current_notification_number": "0",
            "passive_checks_enabled": "1",
            "active_checks_enabled": "1",
            "event_handler_enabled": "1",
            "flap_detection_enabled": "1",
            "is_flapping": "0",
            "percent_state_change": "0",
            "latency": "0.000838999985717237",
            "execution_time": "0.004135",
            "scheduled_downtime_depth": "0",
            "failure_prediction_enabled": "0",
            "process_performance_data": "1",
            "obsess_over_service": "1",
            "modified_service_attributes": "0",
            "event_handler": "",
            "check_command": "check_local_load!5.0,4.0,3.0!10.0,6.0,4.0",
            "normal_check_interval": "5",
            "retry_check_interval": "1",
            "check_timeperiod_object_id": "139"
You would need to use the fields "host_name" and "service_description" to identify the particular service and then
monitor the "output" field for a change from the previous check. You could also use the "next_check" field to tell your
plugin when to run next.

Thanks