Integrate Nagios Monitoring with All Quiet in a matter of minutes. With webhooks, you can automatically send alerts from Nagios directly to All Quiet, streamlining your team’s incident management process.
1. Create Nagios Integration on All Quiet
Sign in to your All Quiet account.
Create Integration
- Click on the
Integrations > Inbound tab.
- Click
Create New Integration.
Select Nagios as the integration’s type
- Enter a display name for your integration, e.g.
Nagios.
- Select a team.
- Select
Nagios as the integration’s type.
- Click
Create Inbound Integration.
Get the All Quiet Webhook URL
After creating the integration on All Quiet, you can view and copy the webhook URL. You will require this URL in step 2 when configuring the custom integration on Nagios.
Once you’ve set up an integration of type “Nagios” with All Quiet, it takes only four steps in your Nagios configuration to finish off your setup.
Add All Quiet Notification Scripts for Nagios
Nagios differentiates between Hosts and Services. Depending on which of these you want to monitor with All Quiet, you need to add the respective shell script from below to a folder where Nagios can execute it, for instance /usr/local/bin/allquiet/.
#!/usr/bin/env bash
set -euo pipefail
allquiet_webhook_url="$1"
nagios_url="$2"
notification_type="$3"
state="$4"
host="$5"
alias="$6"
output="$7"
problem_id="$8"
last_problem_id="$9"
correlation_problem_id="$problem_id"
if [ "$correlation_problem_id" = "0" ]; then
correlation_problem_id="$last_problem_id"
fi
correlation_id="${host}:${correlation_problem_id}"
curl -sS -m 10 --fail -X POST \
"${allquiet_webhook_url}" \
-d "title=[${notification_type}] Host ${host}" \
-d "src=host" \
-d "type=${notification_type}" \
-d "status=${state}" \
-d "host=${host}" \
-d "alias=${alias}" \
-d "output=${output}" \
-d "id=${correlation_problem_id}" \
-d "link=${nagios_url}/cgi-bin/extinfo.cgi?type=1%26host=${host}" \
-d "correlation_id=${correlation_id}"
notify-allquiet-service.sh
#!/usr/bin/env bash
set -euo pipefail
allquiet_webhook_url="$1"
nagios_url="$2"
notification_type="$3"
state="$4"
service="$5"
host="$6"
output="$7"
problem_id="$8"
last_problem_id="$9"
correlation_problem_id="$problem_id"
if [ "$correlation_problem_id" = "0" ]; then
correlation_problem_id="$last_problem_id"
fi
correlation_id="${host}:${service}:${correlation_problem_id}"
curl -sS -m 10 --fail -X POST \
"${allquiet_webhook_url}" \
-d "title=[${notification_type}] ${service} (${host})" \
-d "src=service" \
-d "status=${state}" \
-d "type=${notification_type}" \
-d "service=${service}" \
-d "host=${host}" \
-d "output=${output}" \
-d "id=${correlation_problem_id}" \
-d "link=${nagios_url}/cgi-bin/extinfo.cgi?type=2%26host=${host}%26service=${service}" \
-d "correlation_id=${correlation_id}"
To finish this step, you need to ensure that the scripts are executable. Therefore, please run the following commands in the folders the scripts are saved in.
Commands for Service and Host files; here named notify-allquiet-service.sh and notify-allquiet-hosts.sh
chmod +x {path}/notify-allquiet-service.sh
chmod +x {path}/notify-allquiet-host.sh
Add Commands
Next, to send alerts to All Quiet, we need to define the commands.
Here, Nagios also differentiates between Host and Service commands.
Below, you find templates for both types of commands that you can paste into your commands.cfg, depending on which type(s) your are using.
Make sure to
adjust lines 3-5 depending on your path, file name, Webhook URL from
previous step and your Nagios domain.
define command {
command_name notify-allquiet-service
command_line /usr/local/bin/allquiet/notify-allquiet-service.sh \
"https://YOUR_WEBHOOK__URL_FROM_STEP_1" \
"https://YOUR_NAGIOS_DOMAIN" \
"$NOTIFICATIONTYPE$" \
"$SERVICESTATE$" \
"$SERVICEDESC$" \
"$HOSTNAME$" \
"$SERVICEOUTPUT$" \
"$SERVICEPROBLEMID$" \
"$LASTSERVICEPROBLEMID$"
}
define command {
command_name notify-allquiet-host
command_line /usr/local/bin/allquiet/notify-allquiet-host.sh \
"https://YOUR_WEBHOOK__URL_FROM_STEP_1" \
"https://YOUR_NAGIOS_DOMAIN" \
"$NOTIFICATIONTYPE$" \
"$HOSTSTATE$" \
"$HOSTNAME$" \
"$HOSTALIAS$" \
"$HOSTOUTPUT$" \
"$HOSTPROBLEMID$" \
"$LASTHOSTPROBLEMID$"
}
Make sure to save your commands.cfg.
Next, we need to add All Quiet as a contact to your contacts.cfg in Nagios.
Make sure to include your command(s) name(s) from above.
define contact {
contact_name allquiet
alias All Quiet
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-allquiet-service
host_notification_commands notify-allquiet-host
email none@example.com
}
Make sure to save your contacts.cfg.
Last but not least, you need to add the contact (here: allquiet) to your defined Service(s) and / or Host(s), allowing you to trigger the Nagios Commands if your Services or Hosts report an issue.
Add Contact to Your Services and Hosts
Afterwards Make sure to save your Nagios config and restart to apply changes.
You’re ready to go. If you set up your integration this way, Nagios alerts will automatically create and update All Quiet incidents.
Adjust Payload Mapping
Looking to customize the fields of your incidents by adjusting the pre-built payload mapping? Simply head over to the “Payload” tab within your integration and make the necessary edits to the mapping. For detailed guidance, you may check out our payload mapping documentation.
Using our Terraform provider?
Download the default mapping of the
allquiet_integration_mapping resource for the Nagios integration. Simply copy the syntax to your .tf file and tailor the resource to your team’s needs!