From 2918a3348bf89d5ac26c45342e25f867ad20634c Mon Sep 17 00:00:00 2001 From: Salt Date: Sun, 15 Aug 2021 13:09:04 -0500 Subject: [PATCH] Polish up our SNMP checks and playbooks --- playbooks/snmp.yml | 8 ++++++++ playbooks/tasks/web/nagios-hosts.cfg.j2 | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/playbooks/snmp.yml b/playbooks/snmp.yml index 1ec223f..441b563 100755 --- a/playbooks/snmp.yml +++ b/playbooks/snmp.yml @@ -19,3 +19,11 @@ snmpd_disks_include_all: yes snmpd_disks_include_all_threshold_minpercent: "10%" tags: [ snmp ] +- hosts: all + tasks: + - name: disable snmpd when not tagged + systemd: name={{ item }} state=stopped enabled=no + with_items: + - snmpd.service + when: "'tags_snmp' not in group_names and item in services" + tags: [ zerotier ] diff --git a/playbooks/tasks/web/nagios-hosts.cfg.j2 b/playbooks/tasks/web/nagios-hosts.cfg.j2 index 1458fb7..b575b93 100644 --- a/playbooks/tasks/web/nagios-hosts.cfg.j2 +++ b/playbooks/tasks/web/nagios-hosts.cfg.j2 @@ -50,7 +50,11 @@ define service { } # Commands -# Ain't nobody here but us chickens... +define command { + # This command was manually added and should be present in all backups + command_name check_snmp_storage_v3 + command_line /opt/Custom-Nagios-Plugins/check_snmp_storage.pl -H $HOSTADDRESS$ -l {{ secret_snmp_rouser_username }} -x {{ secret_snmp_rouser_password }} -X {{ secret_snmp_rouser_privacy_passphrase }} -L sha,aes -t 20 -m $ARG1$ -w $ARG2$ -c $ARG3$ +} # Services for all hosts define service { @@ -73,6 +77,12 @@ define service { check_command check_snmp!-P 3 -a SHA -x AES -o 1.3.6.1.2.1.1.1.0 -U {{ secret_snmp_rouser_username }} -A {{ secret_snmp_rouser_password }} -X {{ secret_snmp_rouser_privacy_passphrase }} -r $HOSTNAME$ -L authPriv hostgroup_name snmp } +define service { + use ansible-generic-service + service_description SNMP Check Disk + check_command check_snmp_storage_v3!^/$!80!90 + hostgroup_name snmp +} # Hostgroups # Everything here is dynamically-generated based on tags from Netbox