From 4eaae421d6d58bc0d866eb2a0830626de97dfa74 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Thu, 18 Sep 2025 17:36:12 -0600 Subject: [PATCH] Monitor the space available on the =/DVR/= volume. Add custom NAGIOS command ~abbey_dvr~ on the ~dvrs~ and monitor it. --- README.org | 58 +++++++++++++++---- roles_t/abbey-cloister/tasks/main.yml | 2 +- .../abbey-core/templates/nagios-kamino.cfg | 47 --------------- roles_t/abbey-dvr/handlers/main.yml | 7 +++ roles_t/abbey-dvr/tasks/main.yml | 10 ++++ 5 files changed, 65 insertions(+), 59 deletions(-) delete mode 100644 roles_t/abbey-core/templates/nagios-kamino.cfg create mode 100644 roles_t/abbey-dvr/handlers/main.yml diff --git a/README.org b/README.org index 5101792..ff2355c 100644 --- a/README.org +++ b/README.org @@ -1017,7 +1017,7 @@ additional configuration files in =/etc/nagios4/conf.d/=, and another customized ~check_sensors~ plugin (~abbey_pisensors~) in =/usr/local/sbin/= on the Raspberry Pis. -** Monitoring The Home Disk +*** Monitoring The Home Disk The abbey adds monitoring of the space remaining on the volume at =/home/= on Core. (The small institute only monitors the space @@ -1051,7 +1051,7 @@ remaining on roots.) tags: actualizer #+END_SRC -** Custom NAGIOS Monitor ~abbey_pisensors~ +*** Custom NAGIOS Monitor ~abbey_pisensors~ The ~check_sensors~ plugin is included in the package ~monitoring-plugins-basic~, but it does not report any readings. The @@ -1143,18 +1143,17 @@ case "$1" in esac #+END_SRC -** Monitoring The Cloister +*** Configure NAGIOS Monitoring of The Cloister The abbey adds monitoring for more servers: Dantooine and Kessel. They are ~abbey-cloister~ servers, so they are configured as small institute ~campus~ servers, like Gate, with an NRPE (a NAGIOS Remote Plugin Executor) server and an ~inst_sensors~ command. -The configurations for the servers are very similar to Gate's, but are -idiosyncratically in flux. For example Ord Mantell, the Raspberry Pi -OS (ARM64) machine, uses the ~abbey_pisensors~ monitor. +The configurations for these servers are very similar to Gate's, but +are idiosyncratically in flux. -*** Cloister Network Addresses +**** Cloister Network Addresses The IP addresses of all three hosts are nice to use in the NAGIOS configuration (to avoid depending on name service) and so are @@ -1167,7 +1166,7 @@ dantooine_addr: 10.84.138.8 kessel_addr: 10.84.138.10 #+END_SRC -*** Installing NAGIOS Configurations +**** Install NAGIOS Configurations The following task installs each host's NAGIOS configuration. @@ -1186,7 +1185,7 @@ The following task installs each host's NAGIOS configuration. **** NAGIOS Monitoring of Dantooine #+CAPTION: [[file:roles_t/abbey-core/templates/nagios-dantooine.cfg][=roles_t/abbey-core/templates/nagios-dantooine.cfg=]] -#+BEGIN_SRC conf :tangle roles_t/abbey-core/templates/nagios-dantooine.cfg +#+BEGIN_SRC conf :tangle roles_t/abbey-core/templates/nagios-dantooine.cfg :mkdirp yes define host { use linux-server host_name dantooine @@ -1200,6 +1199,13 @@ define service { check_command check_nrpe!inst_root } +define service { + use generic-service + host_name dantooine + service_description DVR Recordings + check_command check_nrpe!abbey_dvr +} + # define service { # use generic-service # host_name dantooine @@ -1236,7 +1242,7 @@ define service { } #+END_SRC -*** NAGIOS Monitoring of Kessel +**** NAGIOS Monitoring of Kessel #+CAPTION: [[file:roles_t/abbey-core/templates/nagios-kessel.cfg][=roles_t/abbey-core/templates/nagios-kessel.cfg=]] #+BEGIN_SRC conf :tangle roles_t/abbey-core/templates/nagios-kessel.cfg @@ -1678,7 +1684,7 @@ Raspberry Pis (architecture ~aarch64~) only. mode: u=rwx,g=rx,o=rx when: ansible_architecture == 'aarch64' -- name: Configure NAGIOS command. +- name: Configure NAGIOS monitor abbey_pisensors. become: yes copy: content: | @@ -1988,6 +1994,36 @@ location do not fail. mode: u=rwx,g=rxs,o= #+END_SRC +** Install Custom NAGIOS Monitor ~abbey_dvr~ + +DVR hosts install a custom NRPE plugin named ~abbey_dvr~ to monitor +the storage available on =/DVR/=. + +#+CAPTION: [[file:roles_t/abbey-dvr/tasks/main.yml][=roles_t/abbey-dvr/tasks/main.yml=]] +#+BEGIN_SRC conf :tangle roles_t/abbey-dvr/tasks/main.yml + +- name: Configure NAGIOS command abbey_dvr. + become: yes + vars: + lib: /usr/lib/nagios/plugins + copy: + content: | + command[abbey_dvr]={{ lib }}/check_disk -w 20% -c 10% -p /DVR + dest: /etc/nagios/nrpe.d/abbey.cfg + notify: Reload NRPE server. +#+END_SRC + +#+CAPTION: [[file:roles_t/abbey-dvr/handlers/main.yml][=roles_t/abbey-dvr/handlers/main.yml=]] +#+BEGIN_SRC conf :tangle roles_t/abbey-dvr/handlers/main.yml :mkdirp yes +--- +- name: Reload NRPE server. + become: yes + systemd: + service: nagios-nrpe-server + state: reloaded + tags: actualizer +#+END_SRC + ** Configure IP Cameras A new security camera is setup as described in [[*Cloistering][Cloistering]], after diff --git a/roles_t/abbey-cloister/tasks/main.yml b/roles_t/abbey-cloister/tasks/main.yml index d4b064b..4c6e343 100644 --- a/roles_t/abbey-cloister/tasks/main.yml +++ b/roles_t/abbey-cloister/tasks/main.yml @@ -18,7 +18,7 @@ mode: u=rwx,g=rx,o=rx when: ansible_architecture == 'aarch64' -- name: Configure NAGIOS command. +- name: Configure NAGIOS monitor abbey_pisensors. become: yes copy: content: | diff --git a/roles_t/abbey-core/templates/nagios-kamino.cfg b/roles_t/abbey-core/templates/nagios-kamino.cfg deleted file mode 100644 index 410b980..0000000 --- a/roles_t/abbey-core/templates/nagios-kamino.cfg +++ /dev/null @@ -1,47 +0,0 @@ -define host { - use linux-server - host_name kamino - address {{ kamino_addr }} -} - -define service { - use generic-service - host_name kamino - service_description Root Partition - check_command check_nrpe!inst_root -} - -define service { - use generic-service - host_name kamino - service_description Current Load - check_command check_nrpe!check_load -} - -define service { - use generic-service - host_name kamino - service_description Zombie Processes - check_command check_nrpe!check_zombie_procs -} - -# define service { -# use generic-service -# host_name kamino -# service_description Total Processes -# check_command check_nrpe!check_total_procs -# } - -define service { - use generic-service - host_name kamino - service_description Swap Usage - check_command check_nrpe!inst_swap -} - -define service { - use generic-service - host_name kamino - service_description Temperature Sensors - check_command check_nrpe!inst_sensors -} diff --git a/roles_t/abbey-dvr/handlers/main.yml b/roles_t/abbey-dvr/handlers/main.yml new file mode 100644 index 0000000..e6d761d --- /dev/null +++ b/roles_t/abbey-dvr/handlers/main.yml @@ -0,0 +1,7 @@ +--- +- name: Reload NRPE server. + become: yes + systemd: + service: nagios-nrpe-server + state: reloaded + tags: actualizer diff --git a/roles_t/abbey-dvr/tasks/main.yml b/roles_t/abbey-dvr/tasks/main.yml index 7bb74e3..a8a1d9a 100644 --- a/roles_t/abbey-dvr/tasks/main.yml +++ b/roles_t/abbey-dvr/tasks/main.yml @@ -94,3 +94,13 @@ owner: agentdvr group: agentdvr mode: u=rwx,g=rxs,o= + +- name: Configure NAGIOS command abbey_dvr. + become: yes + vars: + lib: /usr/lib/nagios/plugins + copy: + content: | + command[abbey_dvr]={{ lib }}/check_disk -w 20% -c 10% -p /DVR + dest: /etc/nagios/nrpe.d/abbey.cfg + notify: Reload NRPE server. -- 2.25.1