nagios-nrpe: add a NRPE check-local command with completion
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2781|5|2776|5|:-1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/249//ansiblelint">Evolix » ansible-roles » unstable #249</a>
gitea/ansible-roles/pipeline/head This commit looks good
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2781|5|2776|5|:-1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/249//ansiblelint">Evolix » ansible-roles » unstable #249</a>
gitea/ansible-roles/pipeline/head This commit looks good
This commit is contained in:
parent
ad2d96d890
commit
6ab34517b6
|
@ -13,6 +13,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
* userlogrotate: rotate also php.log.
|
* userlogrotate: rotate also php.log.
|
||||||
|
* nagios-nrpe: add a NRPE check-local command with completion.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* evolinux-users: remove Stretch references in tasks that also apply to next Debian versions.
|
* evolinux-users: remove Stretch references in tasks that also apply to next Debian versions.
|
||||||
|
|
12
nagios-nrpe/files/check-local
Executable file
12
nagios-nrpe/files/check-local
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/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.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/usr/lib/nagios/plugins/check_nrpe -H 127.0.0.1 -c check_$1
|
||||||
|
|
||||||
|
|
13
nagios-nrpe/files/check-local_completion
Normal file
13
nagios-nrpe/files/check-local_completion
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
_check_local_dynamic_completion() {
|
||||||
|
local cur;
|
||||||
|
cur=${COMP_WORDS[COMP_CWORD]};
|
||||||
|
check_list=$(grep 'check_' /etc/nagios/nrpe.d/evolix.cfg | grep -vE '^[[:blank:]]*#' | awk -F'[\[\]=_]' '{print $3}')
|
||||||
|
COMPREPLY=();
|
||||||
|
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
|
||||||
|
|
||||||
|
|
24
nagios-nrpe/tasks/check-local.yml
Normal file
24
nagios-nrpe/tasks/check-local.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
# Install check-local utilitary
|
||||||
|
# This task is for Debian >= 10 only!
|
||||||
|
|
||||||
|
- name: Package nagios-nrpe-plugin is intalled
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: nagios-nrpe-plugin
|
||||||
|
when: ansible_distribution_major_version is version('10', '>=')
|
||||||
|
|
||||||
|
- name: Utilitary check-local is installed
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: check-local
|
||||||
|
dest: /usr/local/bin/check-local
|
||||||
|
mode: "0755"
|
||||||
|
when: ansible_distribution_major_version is version('10', '>=')
|
||||||
|
|
||||||
|
- name: Completion for utilitary check-local is installed
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: check-local_completion
|
||||||
|
dest: /etc/bash_completion.d/check-local
|
||||||
|
mode: "0755"
|
||||||
|
when: ansible_distribution_major_version is version('10', '>=')
|
||||||
|
|
||||||
|
|
|
@ -84,4 +84,7 @@
|
||||||
tags:
|
tags:
|
||||||
- nagios-nrpe
|
- nagios-nrpe
|
||||||
|
|
||||||
- ansible.builtin.include_tasks: wrapper.yml
|
- ansible.builtin.include_tasks: wrapper.yml
|
||||||
|
|
||||||
|
- ansible.builtin.include_tasks: check-local.yml
|
||||||
|
when: ansible_distribution_major_version is version('10', '>=')
|
||||||
|
|
Loading…
Reference in a new issue