nagios-nrpe: improve check-local output and fix completion in Debian 10
Some checks failed
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2786|2|2784|1|:-1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/256//ansiblelint">Evolix » ansible-roles » unstable #256</a>
gitea/ansible-roles/pipeline/head There was a failure building this commit
Some checks failed
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2786|2|2784|1|:-1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/256//ansiblelint">Evolix » ansible-roles » unstable #256</a>
gitea/ansible-roles/pipeline/head There was a failure building this commit
This commit is contained in:
parent
91bcd2a605
commit
5563b4f8f2
|
@ -1,12 +1,16 @@
|
||||||
#!/usr/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if ! test -f /usr/lib/nagios/plugins/check_nrpe; then
|
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.'
|
echo '/usr/lib/nagios/plugins/check_nrpe is missing, please install nagios-nrpe-plugin package.'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -r /etc/nagios/nrpe.d/evolix.cfg ]; then
|
||||||
|
command=$(grep "check_$1" /etc/nagios/nrpe.d/evolix.cfg | tail -n1 | cut -d'=' -f2-)
|
||||||
|
printf "Command:\n $command\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "NRPE daemon output:"
|
||||||
/usr/lib/nagios/plugins/check_nrpe -H 127.0.0.1 -c "check_$1"
|
/usr/lib/nagios/plugins/check_nrpe -H 127.0.0.1 -c "check_$1"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
_check_local_dynamic_completion() {
|
_check_local_dynamic_completion() {
|
||||||
local cur;
|
local cur;
|
||||||
cur=${COMP_WORDS[COMP_CWORD]};
|
cur=${COMP_WORDS[COMP_CWORD]};
|
||||||
check_list=$(grep 'check_' /etc/nagios/nrpe.d/evolix.cfg | grep -vE '^[[:blank:]]*#' | awk -F'[\[\]=_]' '{print $3}')
|
|
||||||
COMPREPLY=();
|
COMPREPLY=();
|
||||||
COMPREPLY=( $( compgen -W '$(grep check_ /etc/nagios/nrpe.d/evolix.cfg | grep -vE "^[[:blank:]]*#" | awk -F"[\[\]=_]" "{print \$3}")' -- $cur ) );
|
COMPREPLY=( $( compgen -W '$(grep check_ /etc/nagios/nrpe.d/evolix.cfg | grep -vE "^[[:blank:]]*#" | awk -F"[\\\[\\\]=_]" "{print \$3}")' -- $cur ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -F _check_local_dynamic_completion check-local
|
complete -F _check_local_dynamic_completion check-local
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
---
|
---
|
||||||
# Install check-local utilitary
|
# Install check-local utilitary
|
||||||
# This task is for Debian >= 10 only!
|
# This task is for Debian >= 10 only!
|
||||||
|
- name: "Remount /usr if needed"
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: remount-usr
|
||||||
|
|
||||||
- name: Package nagios-nrpe-plugin is intalled
|
- name: Package nagios-nrpe-plugin is intalled
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
|
|
Loading…
Reference in a new issue