Page MenuHomeDevCentral

D2648.id6689.diff
No OneTemporary

D2648.id6689.diff

diff --git a/roles/core/init.sls b/roles/core/init.sls
--- a/roles/core/init.sls
+++ b/roles/core/init.sls
@@ -11,6 +11,7 @@
- .login
- .network
- .memory
+ - .monitoring
- .motd
- .src
- .ports
diff --git a/roles/core/monitoring/checks.sls b/roles/core/monitoring/checks.sls
new file mode 100644
--- /dev/null
+++ b/roles/core/monitoring/checks.sls
@@ -0,0 +1,29 @@
+# -------------------------------------------------------------
+# Salt — Monitoring
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs with context %}
+{% set nrpe_dir = dirs.share + "/monitoring/checks/nrpe" %}
+
+{{ nrpe_dir }}:
+ file.directory:
+ - makedirs: True
+
+# -------------------------------------------------------------
+# OS or distro specific
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% set os_family_support = [
+ "FreeBSD",
+] %}
+
+{% if grains["os_family"] in os_family_support %}
+monitoring_checks_freebsd:
+ file.recurse:
+ - source: salt://roles/core/monitoring/files/checks/nrpe/os_family/{{ grains["os_family"] }}
+ - name: {{ nrpe_dir }}
+ - file_mode: keep
+{% endif %}
diff --git a/roles/core/monitoring/files/checks/nrpe/os_family/FreeBSD/check-kernel.sh b/roles/core/monitoring/files/checks/nrpe/os_family/FreeBSD/check-kernel.sh
new file mode 100755
--- /dev/null
+++ b/roles/core/monitoring/files/checks/nrpe/os_family/FreeBSD/check-kernel.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+set -u
+
+PATH=/bin:/usr/bin:/sbin
+
+which freebsd-version > /dev/null || exit 3
+
+VERSION_INSTALLED=$(freebsd-version -k)
+VERSION_RUNNING=$(freebsd-version -r)
+
+if [ "$VERSION_INSTALLED" != "$VERSION_RUNNING" ]; then
+ echo "Reboot is needed for kernel upgrade $VERSION_RUNNING to $VERSION_INSTALLED"
+ exit 1
+fi
+
+exit 0
diff --git a/roles/core/init.sls b/roles/core/monitoring/init.sls
copy from roles/core/init.sls
copy to roles/core/monitoring/init.sls
--- a/roles/core/init.sls
+++ b/roles/core/monitoring/init.sls
@@ -1,24 +1,9 @@
# -------------------------------------------------------------
-# Salt — Core units
+# Salt — Monitoring
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
include:
- - .rc
- - .hostname
- - .login
- - .network
- - .memory
- - .motd
- - .src
- - .ports
- - .rsyslog
- - .salt
- - .sshd
- - .sudo
- - .sysctl
- - .timezone
- - .userland-software
- - .users
+ - .checks

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 08:45 (19 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2272557
Default Alt Text
D2648.id6689.diff (2 KB)

Event Timeline