How to change nagios alert format into json format
Posted: Fri Mar 22, 2019 6:37 am
Hi Team,
This is my first question on forum. Just started working on Nagios and I want to change format of alert email to json format. Currently it is coming as plain text, Can anyone please help me to change text to json format as per below sample.
{
"nagios_alert": {
"server_name": "Nagios Master Production",
"app_name": " PEMS",
"service_name": " nscp",
"host": " localhost",
"state": " WARNING",
"last_state": " WARNING",
"check_attempt": " 4",
"max_check_attempt": "4",
"state_since": " 0d 0h 7m 0s",
"is_downtime": " 0",
"service_last_ok": "1551277516",
"service_check_output_short": " PROCS WARNING: 271 processes with STATE = RSZDT ",
"service_check_output_long": " ",
"notification_type": " PROBLEM",
"date_time": " Wed Feb 27 14:32:16 UTC 2019",
"additional_info": "PROCS WARNING: 271 processes with STATE = RSZDT"
}
}
Thanks in advance for the help
This is my first question on forum. Just started working on Nagios and I want to change format of alert email to json format. Currently it is coming as plain text, Can anyone please help me to change text to json format as per below sample.
{
"nagios_alert": {
"server_name": "Nagios Master Production",
"app_name": " PEMS",
"service_name": " nscp",
"host": " localhost",
"state": " WARNING",
"last_state": " WARNING",
"check_attempt": " 4",
"max_check_attempt": "4",
"state_since": " 0d 0h 7m 0s",
"is_downtime": " 0",
"service_last_ok": "1551277516",
"service_check_output_short": " PROCS WARNING: 271 processes with STATE = RSZDT ",
"service_check_output_long": " ",
"notification_type": " PROBLEM",
"date_time": " Wed Feb 27 14:32:16 UTC 2019",
"additional_info": "PROCS WARNING: 271 processes with STATE = RSZDT"
}
}
Thanks in advance for the help