avikarry
(Avi)
September 22, 2019, 2:33pm
1
Hi All,
I am trying to complete host registration in Icinga Director setup. But icinga kickstart agent script is not detecting installed Icinga2 version.
[root@cent7-clients ~]# ./icinga2-agent-kickstart.bash
INFO: This should be a RedHat system
check: icinga2 installed - ERROR: You need to install icinga2!
[root@cent7-clients ~]# icinga2 --version |grep “version: 2.11.0-1”
icinga2 - The Icinga 2 network monitoring daemon (version: 2.11.0-1)
Please let me know how to fix above issue.
Regards,
Avi
dnsmichi
(Michael Friedrich)
September 23, 2019, 12:49pm
2
Hi,
there is a bug in the kickstart script which doesn’t properly detect the version. https://github.com/Icinga/icingaweb2-module-director/issues/1944
You can adjust the regex with this small change:
michi@mbpmif ~/dev/icinga/icingaweb2-module-director (master *=) $ git diff
diff --git a/contrib/linux-agent-installer/Icinga2Agent.bash b/contrib/linux-agent-installer/Icinga2Agent.bash
index aa3c8a87..6e2b30d5 100644
--- a/contrib/linux-agent-installer/Icinga2Agent.bash
+++ b/contrib/linux-agent-installer/Icinga2Agent.bash
@@ -109,7 +109,7 @@ redhat)
esac
icinga_version() {
- "$ICINGA2_BIN" --version 2>/dev/null | grep -oP 'version: [rv]\K\d+\.\d+\.\d+[^\)]*'
+ "$ICINGA2_BIN" --version 2>/dev/null | grep -oP 'version: [rv]?\K\d+\.\d+\.\d+[^\)]*'
}
icinga_major() {
Cheers,
Michael
avikarry
(Avi)
September 24, 2019, 7:35am
3
Thanks Michael for your help. Today I will try this above changes.
dnsmichi
(Michael Friedrich)
September 24, 2019, 11:25am
4
I’ve send a PR for the Director, this will be included in 1.7 as well.
avikarry
(Avi)
September 24, 2019, 4:07pm
5
Hi Michael,
I have made the above changes in ‘icinga2-agent-kickstart.bash’, but now I am getting below errors. Is there any other changes needed ?
= ====================================================
[root@gitlab-server ~]# ./icinga2-agent-kickstart.bash
INFO: This should be a RedHat system
check: icinga2 installed - OK: 2.11.0-1
3.10.0-1062.1.1.el7.x86_64
awk: cmd. line:2: BEGIN {print !(2.11
awk: cmd. line:2: ^ unexpected newline or end of string
awk: cmd. line:2: 3.10 >= 2.8)}
awk: cmd. line:2: ^ syntax error
./deploy-agent.sh: line 122: return: : numeric argument required
INFO: Using old SSL directory: /etc/icinga2/pki
information/base: Writing private key to ‘/etc/icinga2/pki/gitlab-server.localinfra.key’.
information/base: Writing X509 certificate to ‘/etc/icinga2/pki/gitlab-server.localinfra.crt’.
information/base: Writing certificate signing request to ‘/etc/icinga2/pki/gitlab-server.localinfra.csr’.
information/cli: Retrieving X.509 certificate for ‘grafana-server.infra:5665’.
Regards,
Avi
dnsmichi
(Michael Friedrich)
September 24, 2019, 6:50pm
6
No idea, sorry. I hate bash programming and try to avoid it whenever possible. The regex was just simple to test. Might be a syntax problem with bash-ism, still qualifies for an upstream bug on GitHub.
avikarry
(Avi)
September 25, 2019, 7:04am
7
Thanks Michael for all your help.
avikarry
(Avi)
September 26, 2019, 4:29am
8
I have temporary fixed the issue by adding another grep filter (grep daemon) to show only icinga version. previously It was capturing two values one Icinga version and second Linux kernel version.
Below is the modification, which worked for me.
“$ICINGA2_BIN” --version 2>/dev/null | grep daemon| grep -oP ‘version: [rv]?\K\d+.\d+.\d+[^)]*’
1 Like