Daily Basis Email alert for particular Services

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Gonela
Posts: 135
Joined: Wed Jan 10, 2018 5:23 am

Daily Basis Email alert for particular Services

Post by Gonela »

Hi Team,

It is possible to generate email alert for particular service status ( what ever is there in status , we need email alert) .

These email alert required on daily basis only one time in a day.... not frequently ...
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Daily Basis Email alert for particular Services

Post by tgriep »

There isn't really a way to schedule a service status on a once a day schedule but you could use the API to gather the service status and setup a cron jobs run it once a day.
The following example will get the status of the HTTP service that is defined on the localhost.
To run in on your server, you will have to replace the xxx.xxx.xxx.xxx with the IP address of your Nagios serevr and the <APIKEY> with the key from your server.
You can get the key from the XO GUI by going to the Help menu and click on the Objects Reference menu.

Code: Select all

curl -XGET "http://xxx.xxx.xxx.xxx/nagiosxi/api/v1/objects/servicestatus?apikey=<APIKEY>&host_name=localhost&service_name=HTTP&pretty=1"
When it is ran, it will output the status in json format.

Code: Select all

{
    "servicestatuslist": {
        "recordcount": "1",
        "servicestatus": {
            "@attributes": {
                "id": "1172111"
            },
            "instance_id": "1",
            "service_id": "139",
            "host_id": "135",
            "host_name": "localhost",
            "host_alias": "localhost alias",
            "name": "HTTP",
            "host_display_name": "",
            "host_address": "localhost",
            "display_name": "Httpd Process Memory CPU",
            "status_update_time": "2018-05-30 15:59:11",
            "status_text": "HTTP OK: HTTP\/1.1 200 OK - 301 bytes in 0.001 second response time",
            "status_text_long": "",
            "current_state": "0",
            "performance_data": "time=0.000563s;;;0.000000 size=301B;;;0 [check_http]",
            "should_be_scheduled": "0",
            "check_type": "1",
            "last_state_change": "2018-05-23 09:24:04",
            "last_hard_state_change": "2018-05-23 09:24:04",
            "last_hard_state": "0",
            "last_time_ok": "2018-05-30 15:59:04",
            "last_time_warning": "1969-12-31 18:00:00",
            "last_time_critical": "2018-05-23 09:24:04",
            "last_time_unknown": "1969-12-31 18:00:00",
            "last_notification": "1969-12-31 18:00:00",
            "next_notification": "1969-12-31 18:00:00",
            "no_more_notifications": "0",
            "acknowledgement_type": "0",
            "current_notification_number": "0",
            "process_performance_data": "1",
            "obsess_over_service": "1",
            "event_handler_enabled": "1",
            "modified_service_attributes": "0",
            "event_handler": "",
            "check_command": "check_linux_stats!-T!2000000000!3000000000!-p \/var\/run\/httpd\/httpd.pid!!!!",
            "normal_check_interval": "1",
            "retry_check_interval": "1",
            "check_timeperiod_id": "123",
            "icon_image": "",
            "icon_image_alt": "",
            "has_been_checked": "1",
            "current_check_attempt": "1",
            "max_check_attempts": "1",
            "last_check": "2018-05-30 15:59:04",
            "next_check": "2018-05-23 09:25:04",
            "state_type": "1",
            "notifications_enabled": "1",
            "problem_acknowledged": "0",
            "flap_detection_enabled": "0",
            "is_flapping": "0",
            "percent_state_change": "0",
            "latency": "0",
            "execution_time": "0",
            "scheduled_downtime_depth": "0",
            "passive_checks_enabled": "1",
            "active_checks_enabled": "0"
        }
    }
}
Would this work for you?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked