Compare commits
3 Commits
85074b43d0
...
8e845b5f4e
Author | SHA1 | Date | |
---|---|---|---|
8e845b5f4e | |||
d3e51301bb | |||
fc2b3cb7b3 |
@ -50,113 +50,29 @@ define service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Commands
|
# 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 {
|
define command {
|
||||||
# This command is included in the container image
|
# This command is included in the container image
|
||||||
command_name check_nrpe
|
command_name check_nrpe
|
||||||
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
|
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
|
||||||
}
|
}
|
||||||
|
|
||||||
# Services for all hosts
|
# Services
|
||||||
|
# Everything here is defined in nagios_services
|
||||||
|
{% if nagios_services is defined %}
|
||||||
|
{% for service in nagios_services %}
|
||||||
define service {
|
define service {
|
||||||
use ansible-generic-service
|
use ansible-generic-service
|
||||||
service_description HTTP
|
service_description {{ service.name }}
|
||||||
check_command check_http
|
check_command {{ service.command }}
|
||||||
hostgroup_name nagios-checkhttp
|
hostgroup_name {{ service.hostgroup }}
|
||||||
}
|
{% if service.extra is defined %}
|
||||||
define service {
|
{% for kvp in service.extra %}
|
||||||
use ansible-generic-service
|
{{ kvp.key }} {{ kvp.value }}
|
||||||
service_description HTTPS
|
{% endfor %}
|
||||||
check_command check_http!--ssl
|
{% endif %}
|
||||||
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
|
# Hostgroups
|
||||||
# Everything here is dynamically-generated based on tags from Netbox
|
# Everything here is dynamically-generated based on tags from Netbox
|
@ -3,7 +3,54 @@
|
|||||||
file: path=/data/nagios state=directory mode=0755
|
file: path=/data/nagios state=directory mode=0755
|
||||||
tags: [ nagios ]
|
tags: [ nagios ]
|
||||||
- name: template out config for nagios
|
- name: template out config for nagios
|
||||||
template: src=nagios-hosts.cfg.j2 dest=/data/nagios/etc/objects/ansible.cfg owner=root group=root mode=0644
|
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
|
||||||
register: config
|
register: config
|
||||||
tags: [ nagios, template ]
|
tags: [ nagios, template ]
|
||||||
- name: assure config file is loaded
|
- name: assure config file is loaded
|
||||||
|
Loading…
Reference in New Issue
Block a user