Agent deployment USER not defined

I am trying to implement the Agent, it is the bash script generated by Icinga director.

Icinga2 - r2-2.140-1
Centos 7

I have added the centos 7 repositories as described in the following link, and installed the latest version.

https://icinga.com/docs/icinga-2/latest/doc/02-installation/05-CentOS/

I have downloaded the icinga editor script and I have assigned it the permissions 755 and executed as root obtaining the following result.

check: icinga2 installed - OK
ERROR: $ICINGA2_USER has not been defined

But the user icinga has been created when installing it, since it appears in /etc/passwd If I add the user in the script by adding that variable with the user icinga I get the following result.

check: icinga2 installed - OK
ERROR: $ICINGA2_USER has not been defined
[root@servrapidai1 ~]# ./icinga.bash 
check: icinga2 installed - OK
./icinga.bash: line 49: ./lib/icinga2/prepare-dirs: No such file or directory
./icinga.bash: line 61: : command not found
./icinga.bash: line 66: : command not found
./icinga.bash: line 72: : command not found
./icinga.bash: line 130: ./features-available/api.conf: No such file or directory
warning/cli: Feature 'api' already enabled.
Please restart icinga2!

The errors refer to copying the certificates, the ./lib/icinga2/prepare-dirs directories actually exist, but it doesn’t catch them.

where could be the problem.

Thanks.

what script is that?

Sorry, it’s the script that generates icinga director, but I renamed it, it would be this:

icinga2-agent-kickstart.bash

The content is as follows:

https://pastebin.com/abwawe4L

Can be seen as failing desktop checks and pki commands.

Thanks,

look at this thread:

Hello I am using the following script from the list:

https://github.com/Icinga/icingaweb2-module-director/blob/master/contrib/linux-agent-installer/Icinga2Agent.bash

Modified the following variables as follows:

: “{ICINGA2_OSFAMILY:=redhat}”
: “{ICINGA2_CA_NODE:=servericinga.local}”
: “{ICINGA2_CA_TICKET:=22cff1bce2bc02d57247c55f35046de01b3f3330}”

CA_TICKET, is the hash I get from icinga director when I create the host and activate the agent.

But when running the scrtip I get the following output:

1. information/pki: Writing certificate to file ‘/var/lib/icinga2/certs/trusted-master.crt’.
2. information/cli: Writing CA certificate to file ‘/var/lib/icinga2/certs/ca.crt’.
3. critical/cli: !!! Invalid ticket for CN ‘client.local’.
4. ERROR: Could not retrieve final certificate from host server.local

Now it does not receive the certificate from the server, I do not understand what is happening.

Thanks.

you clientname does not match the icigna director hostname

Correct, now I have managed to connect in theory with the icinga server, no error has been shown in the execution of the script.

But apparently it still doesn’t work, messages from unknown services appear in icinga director.

This is what it shows when you run the script:

https://pastebin.com/xpbN4iF3

Thanks,