What is Nagios?
Nagios is an open-source IT infrastructure monitoring tool used to monitor the status of network devices, servers, applications, and services. It helps IT teams track the availability and performance of critical systems in real time, alerting them to issues before they affect business operations. Nagios monitors a wide range of systems, including network devices (routers, switches, etc.), servers (Windows, Linux, etc.), and services (web servers, email servers, databases, etc.).
The application works by regularly checking the health of these systems through plugins and custom checks, assessing metrics such as response times, resource utilization, and uptime. If a monitored system or service experiences an issue, Nagios triggers alerts to notify IT staff, helping them respond quickly to potential problems. Users can configure thresholds and alert conditions to suit their needs and can also access detailed reports and performance data to help with troubleshooting.
Nagios is highly extensible and can be customized through plugins and third-party integrations, making it suitable for monitoring complex IT environments. It is widely used by IT operations teams to ensure the reliability and performance of their infrastructure, proactively identifying and addressing issues.
Functions
Send SMS
Have Nagios send SMS alerts via our gateway by integrating seven.
Installation
- 1
Check Python installation
Make sure that Python 2+ is installed on the system.
- 2
Copy plugin
Copy seven.py into the Nagios plugin directory, normally under
/usr/local/nagios/libexec
.
Usage
Change /usr/local/nagios/etc/objects/contacts.cfg
:
define contact {
#...
pager +491234567890
host_notification_commands notify-host-by-sms
service_notification_commands notify-service-by-sms
}
Add to /usr/local/nagios/etc/objects/commands.cfg
:
# Results in a SMS like:
# RECOVERY: SMS on 127.0.0.1@localhost, State: OK, Output: 100, Date: 01-15-2021 12:30:28
define command {
command_name notify-service-by-sms
command_line $USER1$/seven.py MY_SEVEN_API_KEY $CONTACTPAGER$ "$NOTIFICATIONTYPE$:$SERVICEDESC$ on $HOSTADDRESS$@$HOSTNAME$, State $SERVICESTATE$, Output: $SERVICEOUTPUT$, Date: $SHORTDATETIME$" --from=Nagios
}
# Results in a SMS like:
# CUSTOM on 127.0.0.1@localhost, State: OK, Output: 100, Date: 01-15-2021 12:30:28
define command {
command_name notify-host-by-sms
command_line $USER1$/seven.py MY_SEVEN_API_KEY $CONTACTPAGER$ "$NOTIFICATIONTYPE$ on $HOSTADDRESS$@$HOSTNAME$, State: $HOSTSTATE$, Output: $HOSTOUTPUT$, Date: $SHORTDATETIME$" --from=Nagios
}
Optionally, you can add a local service for a quick test.
Add to /usr/local/nagios/etc/objects/localhost.cfg
:
define service {
use local-service
host_name localhost
service_description SMS
check_command notify-host-by-sms
}
Available Options:
seven.py
[-h]
[--delay DELAY]
[--details]
[--flash]
[--foreign_id FOREIGN_ID]
[--from FROM]
[--json]
[--label LABEL]
[--no_reload]
[--performance_tracking]
[--return_msg_id]
[--ttl TTL]
[--udh UDH]
[--unicode]
[--utf8]
api_key to text