nagios-nrpe: set default check_load --per-cpu for BSD
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2623|6|2617|5|:-1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/342//ansiblelint">Evolix » ansible-roles » unstable #342</a>
gitea/ansible-roles/pipeline/head This commit looks good

This commit is contained in:
William Hirigoyen 2023-09-11 09:25:21 +02:00
parent 2a7d2d9c58
commit 2af2e5ee78
3 changed files with 19 additions and 8 deletions

View file

@ -61,6 +61,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
* lxc-php: Change lxc container in bookworm for php82
* evolinux-base: include files under `sshd_config.d`
* postfix: disable sending mails via IPv6
* nagios-nrpe: set default check_load --per-cpu for BSD
### Fixed

View file

@ -1,17 +1,27 @@
#!/usr/bin/env bash
if ! test -f /usr/lib/nagios/plugins/check_nrpe; then
echo '/usr/lib/nagios/plugins/check_nrpe is missing, please install nagios-nrpe-plugin package.'
CHECK_BIN=/usr/lib/nagios/plugins/check_nrpe
if ! test -f "${CHECK_BIN}"; then
echo "${CHECK_BIN} is missing, please install nagios-nrpe-plugin package."
exit 1
fi
if [ -r /etc/nagios/nrpe.d/evolix.cfg ]; then
command=$(grep "\[check_$1\]" /etc/nagios/nrpe.d/evolix.cfg | grep -v '^[[:blank:]]*#' | tail -n1 | cut -d'=' -f2-)
echo "Command:"
echo " $command"
for file in /etc/nagios/{nrpe.cfg,nrpe_local.cfg,nrpe.d/evolix.cfg}; do
if [ -r ${file} ]; then
found_command=$(grep "\[check_$1\]" "${file}" | grep -v '^[[:blank:]]*#' | tail -n1 | cut -d'=' -f2-)
fi
if [ -n "${found_command}" ]; then
command="${found_command}"
fi
done
if [ -n "${command}" ]; then
echo "Found command in /etc/nagios (take care, in some cases, Nagios can play another command):"
echo " ${command}"
fi
echo "NRPE daemon output:"
/usr/lib/nagios/plugins/check_nrpe -H 127.0.0.1 -c "check_$1"
"${CHECK_BIN}" -H 127.0.0.1 -c "check_$1"

View file

@ -7,7 +7,7 @@
allowed_hosts={{ nagios_nrpe_allowed_hosts | join(',') }}
command[check_users]=/usr/local/libexec/nagios/check_users -w 5 -c 10
command[check_load]=/usr/local/libexec/nagios/check_load -w 15,10,5 -c 30,25,20
command[check_load]=/usr/local/libexec/nagios/check_load --percpu -w 0.7,0.6,0.5 -c 0.9,0.8,0.7
command[check_disk1]=/usr/local/libexec/nagios/check_disk -x /lib/init/rw -x /dev -x /dev/shm -w 10% -c 3% -W 10% -K 3% -C -w 5% -c 2% -W 5% -K 2% -p /home
command[check_zombie_procs]=/usr/local/libexec/nagios/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/libexec/nagios/check_procs -w 150 -c 200