-
Notifications
You must be signed in to change notification settings - Fork 598
Description
Describe the bug
When you try to enable the foreman-smart-proxy-plugin with api user and password on the foreman server, the connection via https get a bad request when connecting to /v1/events?queue=foreman&types=StateChange&types=AcknowledgementSet&types=AcknowledgementCleared&types=DowntimeTriggered&types=DowntimeRemoved
In the log you can see that the connection request arrives. The connection will be closed after about 5 to 10 seconds.
More is not visible in the log.
After I tried to solve the problem, I got the following error message:
Bad Request - bad value
The following curl works fine:
curl -k -s -u foreman:foreman -H 'Accept: application/json' -X POST 'https://192.168.33.56:5665/v1/events?queue=foreman&types=StateChange&types=AcknowledgementSet&types=AcknowledgementCleared&types=DowntimeTriggered&types=DowntimeRemoved'
The following is the intercepted output:
POST /v1/events?queue=foreman&types=StateChange&types=AcknowledgementSet&types=AcknowledgementCleared&types=DowntimeTriggered&types=DowntimeRemoved HTTP/1.1 Host: 192.168.33.56:5665 Authorization: Basic Zm9yZW1hbjpmb3JlbWFu User-Agent: curl/7.61.1 Accept: application/json
The output of the Foreman plugin is the same. (The order in which it is sent is different from the curl. To avoid this as an error, I changed the order in the plugin so that it is sent exactly like the curl. Same problem though.)
To exclude the single variables like header, host, etc. I commented them out systematically. If one of these variables is missing, I get a decent error that variable X is missing. But as soon as I send the user and password instead of the certificates, it falls down.
This problem exists since Icinga 2 version 2.11
If you use the certificates instead of user and password the connection works.
I suspect the error on the Icinga 2 update to 2.11
To Reproduce
To reproduce the problem, you need a foreman-server with the foreman-smart-proxy-plugin.
Finished Foreman servers can be started via the foreman/forklift repo using vagrant.
In the ReadMe of the smart_proxy_monitoring plugin is a guide how to install and configure the plugin
Expected behavior
Normally there should be a constant connection between the foreman and Icinga
Your Environment
The Icinga 2 setup i have tried to use this is a standalone machine
- 2.12.0-1
- Centos 8
- Enabled features: api checker ido-mysql mainlog notification
- Icinga Web 2 version: 2.8.2
- Enabled Modules in Icinga Web 2: monitoring
- icinga2 daemon -C
[2020-09-04 11:43:33 +0000] information/cli: Icinga application loader (version: 2.12.0-1)
[2020-09-04 11:43:33 +0000] information/cli: Loading configuration file(s).
[2020-09-04 11:43:33 +0000] information/ConfigItem: Committing config item(s).
[2020-09-04 11:43:33 +0000] information/ApiListener: My API identity: localhost.localdomain
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 1 NotificationComponent.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 2 Hosts.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 1 Downtime.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 2 NotificationCommands.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 1 FileLogger.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 12 Notifications.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 1 IcingaApplication.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 2 HostGroups.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 1 CheckerComponent.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 3 Zones.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 1 Endpoint.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 1 IdoMysqlConnection.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 3 ApiUsers.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 1 ApiListener.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 235 CheckCommands.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 3 TimePeriods.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 1 UserGroup.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 1 User.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 12 Services.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 3 ServiceGroups.
[2020-09-04 11:43:33 +0000] information/ConfigItem: Instantiated 1 ScheduledDowntime.
[2020-09-04 11:43:33 +0000] information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2/icinga2.vars'
[2020-09-04 11:43:33 +0000] information/cli: Finished validating the configuration file(s).