diff --git a/CHANGELOG b/CHANGELOG index f0795c4..a2a712c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * logsentry: update config files, add "[logsentry]" in subject, and simplify task * nagios-nrpe: deleted unused variables and added a ntp check server variable * post-install: use basename of path in generateldif.sh to define file from elsewhere +* bgp, collectd, logsentry, ospf: update scripts ### Fixed diff --git a/roles/bgp/templates/bgpd-check-peers.sh.j2 b/roles/bgp/templates/bgpd-check-peers.sh.j2 index 8151449..e81466b 100755 --- a/roles/bgp/templates/bgpd-check-peers.sh.j2 +++ b/roles/bgp/templates/bgpd-check-peers.sh.j2 @@ -1,4 +1,4 @@ -#!/bin/ksh +#!/bin/sh # Script writen by Daniel Jakots @@ -29,7 +29,7 @@ mkdir -p "${_TMPDIR}" # Don't try to run if it's already running if [ -e "${_PIDFILE}" ]; then - date >> "${_TMPDIR}"/log + echo "$(date)" >> "${_TMPDIR}"/log exit 1 else echo $$ >> "${_PIDFILE}" @@ -49,11 +49,13 @@ bgpctl show neighbor | grep Description {{ bgp_exclude_grep_command }} | sed s,\ while read -r _PEER do _STATUS=$(/usr/sbin/bgpctl show neighbor "${_PEER}" | grep state | awk '{print $4}' |tr -d ',') + echo -n "${_PEER}" >> "${_TMPDIR}"/bgp-status + echo -n " " >> "${_TMPDIR}"/bgp-status # we note only if it's established or not if ! [[ "${_STATUS}" = "Established" ]] ; then _STATUS="NotEstablished" fi - echo "${_PEER} ${_STATUS}" >> "${_TMPDIR}"/bgp-status + echo "${_STATUS}" >> "${_TMPDIR}"/bgp-status done <"${_TMPDIR}"/peers-list diff --git a/roles/collectd/templates/collectd.conf.j2 b/roles/collectd/templates/collectd.conf.j2 index f4a7e80..1e37be2 100644 --- a/roles/collectd/templates/collectd.conf.j2 +++ b/roles/collectd/templates/collectd.conf.j2 @@ -2,6 +2,7 @@ Interval {{ collectd_interval }} Timeout 2 LoadPlugin syslog + LogLevel warning @@ -23,25 +24,46 @@ LoadPlugin syslog {% endif %} +{% endif %} +{% if collectd_plugin_cpu is sameas true %} +LoadPlugin cpu +{% endif %} +{% if collectd_plugin_df is sameas true %} +LoadPlugin df +{% endif %} +{% if collectd_plugin_disk is sameas true %} +LoadPlugin disk +{% endif %} +{% if collectd_plugin_interface is sameas true %} +LoadPlugin interface {% endif %} {% if collectd_plugin_load is sameas true %} LoadPlugin load {% endif %} +{% if collectd_plugin_memory is sameas true %} +LoadPlugin memory +{% endif %} +LoadPlugin network +{% if collectd_plugin_pf is sameas true %} +LoadPlugin pf +{% endif %} {% if collectd_plugin_processes is sameas true %} LoadPlugin processes {% endif %} +{% if collectd_plugin_swap is sameas true %} +LoadPlugin swap +{% endif %} +{% if collectd_plugin_tcpconns is sameas true %} +LoadPlugin tcpconns +{% endif %} {% if collectd_plugin_uptime is sameas true %} LoadPlugin uptime {% endif %} {% if collectd_plugin_users is sameas true %} LoadPlugin users {% endif %} -{% if collectd_plugin_pf is sameas true %} -LoadPlugin pf -{% endif %} {% if collectd_plugin_df is sameas true %} -LoadPlugin df # expose host's mounts into container using -v /:/host:ro (location inside container does not matter much) # ignore rootfs; else, the root file-system would appear twice, causing @@ -73,7 +95,6 @@ LoadPlugin df {% endif %} {% if collectd_plugin_disk is sameas true %} -LoadPlugin disk #Disk "/^[hsv]d[a-z]/" IgnoreSelected false @@ -81,28 +102,24 @@ LoadPlugin disk {% endif %} {% if collectd_plugin_cpu is sameas true %} -LoadPlugin cpu ValuesPercentage true {% endif %} {% if collectd_plugin_memory is sameas true %} -LoadPlugin memory ValuesPercentage true {% endif %} {% if collectd_plugin_swap is sameas true %} -LoadPlugin swap ValuesPercentage true {% endif %} {% if collectd_plugin_interface is sameas true %} -LoadPlugin interface Interface "/^lo[0-9]*/" Interface "/^veth.*/" @@ -113,13 +130,12 @@ LoadPlugin interface {% endif %} {% if collectd_plugin_tcpconns is sameas true %} -LoadPlugin tcpconns AllPortsSummary true {% endif %} -LoadPlugin network - Server "{{ collectd_server }}" "25826" + + diff --git a/roles/logsentry/files/logsentry.ignore b/roles/logsentry/files/logsentry.ignore index d372b96..665e93b 100644 --- a/roles/logsentry/files/logsentry.ignore +++ b/roles/logsentry/files/logsentry.ignore @@ -66,6 +66,7 @@ collectd.*: parse_value: Failed to parse string as gauge: "Idle". doas: _collectd ran command /bin/cat /var/log/daemon as root from /var/collectd doas: _collectd ran command /usr/sbin/bgpctl sh as root from /var/collectd doas: _collectd ran command /usr/sbin/bgpctl show neighbor as root from /var/collectd +doas: _collectd ran command /usr/sbin/unbound-control stats as root from /var/collectd doas: _nrpe ran command /sbin/bioctl sd2 as root from / doas: _nrpe ran command /usr/local/libexec/nagios doas: .* ran command su - as root from diff --git a/roles/ospf/templates/ospf6d-check-peers.sh.j2 b/roles/ospf/templates/ospf6d-check-peers.sh.j2 index 3686490..fd166dc 100755 --- a/roles/ospf/templates/ospf6d-check-peers.sh.j2 +++ b/roles/ospf/templates/ospf6d-check-peers.sh.j2 @@ -1,4 +1,4 @@ -#!/bin/ksh +#!/bin/sh # Script writen by Daniel Jakots for BGP, adapted by Jeremy Dubois for OSPF @@ -29,7 +29,7 @@ mkdir -p "${_TMPDIR}" # Don't try to run if it's already running if [ -e "${_PIDFILE}" ]; then - date >> "${_TMPDIR}"/log + echo "$(date)" >> "${_TMPDIR}"/log exit 1 else echo $$ >> "${_PIDFILE}" @@ -51,7 +51,7 @@ do _STATUS=$(/usr/sbin/ospf6ctl show neighbor | grep "${_PEER} " | awk {'print $3'}) echo -n "${_PEER}" >> "${_TMPDIR}"/ospf6-status echo -n " " >> "${_TMPDIR}"/ospf6-status - if [[ "${_STATUS}" = "FULL/BCKUP" ]] || [[ "${_STATUS}" = "FULL/DR" ]] || [[ "${_STATUS}" = "2-WAY/OTHER" ]] || [[ "${_STATUS}" = "FULL/OTHER" ]] ; then + if ([[ "${_STATUS}" = "FULL/BCKUP" ]] || [[ "${_STATUS}" = "FULL/DR" ]] || [[ "${_STATUS}" = "2-WAY/OTHER" ]] || [[ "${_STATUS}" = "FULL/OTHER" ]]) ; then _STATUS="UP" else _STATUS="DOWN" @@ -103,6 +103,9 @@ fi echo "\n\n*** Known OSPF routes ***\n" >> "${_TMPMAILDIR}"/body ospf6ctl show fib ospf >> "${_TMPMAILDIR}"/body +echo "\n\n*** OSPF interfaces state ***\n" >> "${_TMPMAILDIR}"/body +ospf6ctl show interfaces >> "${_TMPMAILDIR}"/body + echo "\n\n*** Network used memory ***\n" >> "${_TMPMAILDIR}"/body netstat -m >> "${_TMPMAILDIR}"/body diff --git a/roles/ospf/templates/ospfd-check-peers.sh.j2 b/roles/ospf/templates/ospfd-check-peers.sh.j2 index 8fed871..c451c2e 100755 --- a/roles/ospf/templates/ospfd-check-peers.sh.j2 +++ b/roles/ospf/templates/ospfd-check-peers.sh.j2 @@ -1,4 +1,4 @@ -#!/bin/ksh +#!/bin/sh # Script writen by Daniel Jakots for BGP, adapted by Jeremy Dubois for OSPF @@ -29,7 +29,7 @@ mkdir -p "${_TMPDIR}" # Don't try to run if it's already running if [ -e "${_PIDFILE}" ]; then - date >> "${_TMPDIR}"/log + echo "$(date)" >> "${_TMPDIR}"/log exit 1 else echo $$ >> "${_PIDFILE}" @@ -51,7 +51,7 @@ do _STATUS=$(/usr/sbin/ospfctl show neighbor | grep "${_PEER} " | awk {'print $3'}) echo -n "${_PEER}" >> "${_TMPDIR}"/ospf-status echo -n " " >> "${_TMPDIR}"/ospf-status - if [[ "${_STATUS}" = "FULL/BCKUP" ]] || [[ "${_STATUS}" = "FULL/DR" ]] || [[ "${_STATUS}" = "2-WAY/OTHER" ]] || [[ "${_STATUS}" = "FULL/OTHER" ]] ; then + if ([[ "${_STATUS}" = "FULL/BCKUP" ]] || [[ "${_STATUS}" = "FULL/DR" ]] || [[ "${_STATUS}" = "2-WAY/OTHER" ]] || [[ "${_STATUS}" = "FULL/OTHER" ]]) ; then _STATUS="UP" else _STATUS="DOWN" @@ -103,6 +103,9 @@ fi echo "\n\n*** Known OSPF routes ***\n" >> "${_TMPMAILDIR}"/body ospfctl show fib ospf >> "${_TMPMAILDIR}"/body +echo "\n\n*** OSPF interfaces state ***\n" >> "${_TMPMAILDIR}"/body +ospfctl show interfaces >> "${_TMPMAILDIR}"/body + echo "\n\n*** Network used memory ***\n" >> "${_TMPMAILDIR}"/body netstat -m >> "${_TMPMAILDIR}"/body