aboutsummaryrefslogtreecommitdiffstats
path: root/roles/nagios_server
diff options
context:
space:
mode:
authorStonewall Jackson <stonewall@sacredheartsc.com>2023-02-06 20:31:20 -0500
committerStonewall Jackson <stonewall@sacredheartsc.com>2023-02-06 20:36:16 -0500
commit969fc7c21dc7fa85dcc516aedf8e816ee8bc8bd6 (patch)
tree23ac2860839bfe9b6045841a9834f50a36f88a82 /roles/nagios_server
parentd2e954c37b1b2111ae1ca7f489ae170180491522 (diff)
downloadselfhosted-969fc7c21dc7fa85dcc516aedf8e816ee8bc8bd6.tar.gz
selfhosted-969fc7c21dc7fa85dcc516aedf8e816ee8bc8bd6.zip
set max_retries to UINT32_MAX for asterisk registrations
After a brief internet outage, I noticed that asterisk had given up trying to reconnect to my upstream SIP server (looks like the default value of max_retries is 10). Although the asterisk "registration" object was disconnected, the "endpoint" object still reported being up, so the check_asterisk_endpoints nagios plugin did not alert me to the problem. This commit sets max_retries to UNIT32_MAX for asterisk registrations by default. It also adds a new nagios plugin, check_asterisk_registrations. Unfortunately, the ARI does not expose registrations via the REST API, so I had to write a hacky bash script to parse the asterisk CLI output.
Diffstat (limited to 'roles/nagios_server')
-rw-r--r--roles/nagios_server/templates/etc/nagios/objects/commands.cfg.j27
-rw-r--r--roles/nagios_server/templates/etc/nagios/objects/services.cfg.j27
2 files changed, 14 insertions, 0 deletions
diff --git a/roles/nagios_server/templates/etc/nagios/objects/commands.cfg.j2 b/roles/nagios_server/templates/etc/nagios/objects/commands.cfg.j2
index e44d6ab..06503c5 100644
--- a/roles/nagios_server/templates/etc/nagios/objects/commands.cfg.j2
+++ b/roles/nagios_server/templates/etc/nagios/objects/commands.cfg.j2
@@ -167,6 +167,13 @@ define command {
command_line $USER1$/check_asterisk_endpoints -H '$_HOSTFQDN$' -P '$ARG1$' -u '$ARG2$' -p '$ARG3$' $ARG4$
}
+define command {
+ command_name check_asterisk_registrations
+ command_line $USER1$/check_by_ssh \
+ {{ nagios_check_by_ssh_args }} \
+ --command='check_asterisk_registrations'
+}
+
######################################
# Service Checks: Certificate Validity
diff --git a/roles/nagios_server/templates/etc/nagios/objects/services.cfg.j2 b/roles/nagios_server/templates/etc/nagios/objects/services.cfg.j2
index 68b4fe4..032fbba 100644
--- a/roles/nagios_server/templates/etc/nagios/objects/services.cfg.j2
+++ b/roles/nagios_server/templates/etc/nagios/objects/services.cfg.j2
@@ -228,6 +228,13 @@ define service {
# Asterisk Checks
#################
+define service {
+ service_description registrations
+ hostgroups asterisk_servers
+ use generic-service
+ check_command check_asterisk_registrations
+}
+
{% for host in groups.asterisk_servers %}
# endpoints - {{ host }}
define service {