Compare commits

..

No commits in common. "8e845b5f4e1e8c4dc06005dad2eef13508fd789b" and "85074b43d0dbaacc0006837337abddbcf47dfef6" have entirely different histories.

2 changed files with 99 additions and 62 deletions

View File

@ -50,29 +50,113 @@ define service {
}
# Commands
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$
}
define command {
# This command is included in the container image
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
# Services
# Everything here is defined in nagios_services
{% if nagios_services is defined %}
{% for service in nagios_services %}
# Services for all hosts
define service {
use ansible-generic-service
service_description {{ service.name }}
check_command {{ service.command }}
hostgroup_name {{ service.hostgroup }}
{% if service.extra is defined %}
{% for kvp in service.extra %}
{{ kvp.key }} {{ kvp.value }}
{% endfor %}
{% endif %}
service_description HTTP
check_command check_http
hostgroup_name nagios-checkhttp
}
define service {
use ansible-generic-service
service_description HTTPS
check_command check_http!--ssl
hostgroup_name nagios-checkhttp
}
# Services for SNMP-capable hosts
define service {
use ansible-generic-service
service_description Hostname
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 Disk Usage
check_command check_snmp_storage_v3!^/$!85!90
hostgroup_name snmp
}
# Services for NRPE-capable hosts
define service {
use ansible-generic-service
service_description Disk Usage
check_command check_nrpe!check_disk_all
hostgroup_name nagios-nrpe
}
define service {
use ansible-generic-service
service_description Users
check_command check_nrpe!check_users
hostgroup_name nagios-nrpe
}
define service {
use ansible-generic-service
service_description CPU Load
check_command check_nrpe!check_load
hostgroup_name nagios-nrpe
}
define service {
use ansible-generic-service
service_description Reboot Required
check_command check_nrpe!check_reboot_required
hostgroup_name nagios-nrpe
}
# Systemd unit checks
define service {
use ansible-generic-service
service_description Unit backup.service
check_command check_nrpe!check_systemd_backup_service
hostgroup_name nagios-nrpe
}
define service {
use ansible-generic-service
service_description Unit backup.timer
check_command check_nrpe!check_systemd_backup_timer
hostgroup_name nagios-nrpe
}
define service {
use ansible-generic-service
service_description Unit ansible-pull.service
check_command check_nrpe!check_systemd_ansiblepull_service
hostgroup_name ansible-pull
}
define service {
use ansible-generic-service
service_description Unit ansible-pull.timer
check_command check_nrpe!check_systemd_ansiblepull_timer
hostgroup_name ansible-pull
}
define service {
use ansible-generic-service
service_description Unit docker.service
check_command check_nrpe!check_systemd_docker_service
hostgroup_name nagios-nrpe
}
define service {
use ansible-generic-service
service_description Swap Usage
check_command check_nrpe!check_swap
hostgroup_name nagios-nrpeswap
}
define service {
use ansible-generic-service
service_description PostgreSQL
check_command check_nrpe!check_pgsql
hostgroup_name nagios-checkpgsql
}
{% endfor %}
{% endif %}
# Hostgroups
# Everything here is dynamically-generated based on tags from Netbox

View File

@ -3,54 +3,7 @@
file: path=/data/nagios state=directory mode=0755
tags: [ nagios ]
- name: template out config for nagios
template: src=nagios-ansible.cfg.j2 dest=/data/nagios/etc/objects/ansible.cfg owner=root group=root mode=0644
vars:
nagios_services:
# Agentless checks
- name: HTTP
command: check_http
hostgroup: nagios-checkhttp
- name: HTTPS
command: check_http!--ssl
hostgroup: nagios-checkhttp
# Agented checks
- name: CPU Load
command: check_nrpe!check_load
hostgroup: nagios-nrpe
- name: Disk Usage
command: check_nrpe!check_disk_all
hostgroup: nagios-nrpe
- name: Reboot Required
command: check_nrpe!check_reboot_required
hostgroup: nagios-nrpe
- name: Unit backup.service
command: check_nrpe!check_systemd_backup_service
hostgroup: nagios-nrpe
- name: Unit backup.timer
command: check_nrpe!check_systemd_backup_timer
hostgroup: nagios-nrpe
- name: Unit docker.service
command: check_nrpe!check_systemd_docker_service
hostgroup: nagios-nrpe
- name: Users
command: check_nrpe!check_users
hostgroup: nagios-nrpe
# Tag-specific checks
# ansible-pull
- name: Unit ansible-pull.service
command: check_nrpe!check_systemd_ansiblepull_service
hostgroup: ansible-pull
- name: Unit ansible-pull.timer
command: check_nrpe!check_systemd_ansiblepull_timer
hostgroup: ansible-pull
# nagios-checkpgsql
- name: PostgreSQL
command: check_nrpe!check_pgsql
hostgroup: nagios-checkpgsql
# nagios-nrpeswap
- name: Swap Usage
command: check_nrpe!check_swap
hostgroup: nagios-nrpeswap
template: src=nagios-hosts.cfg.j2 dest=/data/nagios/etc/objects/ansible.cfg owner=root group=root mode=0644
register: config
tags: [ nagios, template ]
- name: assure config file is loaded