Hi,
I am trying to pull top 10 high memory consuming process on Windows server using event handler.
I also have command to pull top 10 high memory consuming process.
My requirement is to whenever memory threshold is breached event handler execute and appends Service output with top 10 memory consuming process.
Kindly guide, how can i append the service output.
Regards,
Anish
Append Event handler output in alert message
Re: Append Event handler output in alert message
There isn't a convenient hook for "appending" the service output, so step 1 is getting the current service output. This can be done via the Nagios XI API.
For example, if I wanted to get the status output for "CPU Usage" on host "192.168.67.99" I could run the following API call:
With that call, you could get the status_text value, append something to it (step 2), then submit that as a check result using the external commands file:
https://old.nagios.org/developerinfo/ex ... and_id=114
https://old.nagios.org/developerinfo/ex ... ndlist.php
See the "Help" section of Nagios XI for additional API usage information, and be sure to let us know if something is unclear or you have additional questions!
For example, if I wanted to get the status output for "CPU Usage" on host "192.168.67.99" I could run the following API call:
Code: Select all
[root@xi-stable ~]# curl -XGET "http://192.168.67.1/nagiosxi/api/v1/objects/servicestatus?apikey=KR2LLsBuhmmFnS4dbmeURW0culVlv39vbbBVW8pet69bXdH8CUiK8DcFX7gMpohD&pretty=1&name=CPU%20Usage&host_name=192.168.67.99"
{
"servicestatuslist": {
"recordcount": "1",
"servicestatus": {
"@attributes": {
"id": "449"
},
"instance_id": "1",
"service_id": "237",
"host_id": "236",
"host_name": "192.168.67.99",
"host_alias": "192.168.67.99",
"name": "CPU Usage",
"host_display_name": "",
"host_address": "192.168.67.99",
"display_name": "CPU Usage",
"status_update_time": "2017-04-24 10:49:32",
"status_text": "OK (Sample Period 297 sec) - Average CPU Utilisation 8.33%",
"status_text_long": "",
"current_state": "0",
"performance_data": "'Avg CPU Utilisation'=8.33%;80;90;",
"should_be_scheduled": "1",
"check_type": "0",
"last_state_change": "2017-04-07 15:04:58",
"last_hard_state_change": "2017-04-07 15:04:58",
"last_hard_state": "0",
"last_time_ok": "2017-04-24 10:49:23",
"last_time_warning": "2017-04-07 14:01:52",
"last_time_critical": "2017-04-07 14:46:16",
"last_time_unknown": "2017-04-07 15:04:58",
"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_xi_service_wmiplus!'admin'!'welcome123'!checkcpu!-w '80' -c '90'",
"normal_check_interval": "5",
"retry_check_interval": "1",
"check_timeperiod_id": "131",
"icon_image": "",
"icon_image_alt": "",
"has_been_checked": "1",
"current_check_attempt": "1",
"max_check_attempts": "5",
"last_check": "2017-04-24 10:49:23",
"next_check": "2017-04-24 10:54:23",
"state_type": "1",
"notifications_enabled": "1",
"problem_acknowledged": "0",
"flap_detection_enabled": "1",
"is_flapping": "0",
"percent_state_change": "0",
"latency": "0",
"execution_time": "8.37704",
"scheduled_downtime_depth": "0",
"passive_checks_enabled": "1",
"active_checks_enabled": "1"
}
}
}https://old.nagios.org/developerinfo/ex ... and_id=114
https://old.nagios.org/developerinfo/ex ... ndlist.php
See the "Help" section of Nagios XI for additional API usage information, and be sure to let us know if something is unclear or you have additional questions!
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Append Event handler output in alert message
Thanks for the suggestion.
I have opted for another alternative solution.
Please close this thread.
I have opted for another alternative solution.
Please close this thread.