manios / docker-nagios

Docker image for Nagios Core in Alpine Linux with basic plugins, available for x86, x64 , ARM v6, ARM v7 and ARM64.
https://www.nagios.org/
Other
60 stars 28 forks source link

[Bug]: service name changed when trying to use external command internface #59

Closed samarium closed 1 year ago

samarium commented 1 year ago

What happened?

Trying to reschedule a service check, or submit passive result, or anything that uses the "External Command Interface" via the webui. I have a service name a/b/c and when I look at service information, it shows a/b/c; however when I try to manipulate it as above, the service name in the "Service" box, is a&b/c. This obviously does commit well. If I update the service name to the correct a/b/c, then it works. So something is updating the name.

When I use the latest jasonrivers image with nagios 4.4.8 with an largely identical cginagios.cfg, the jr image works as expected, same as the old ubuntu nagios4 install, and leaves the service name unchanged: a/b/c. Main difference seems to be in cgi.cfg actions_url_target is _self in jr image, and _blank in cm build. Same with notes_url_target. Not sure that either of those are relevant.

Note the "apk --print-arch" below returns x86-64, which isn't a selection option, so I selected amd64.

Image information

Image architecture

amd64

Relevant log output

# First line, opening external command interface to set force check.

192.168.x.y - nagiosadmin [14/May/2023:10:16:34 +1000] "GET /nagios/cgi-bin/cmd.cgi?cmd_typ=7&host=fred&service=sys%2Fprocs&force_check HTTP/1.1" 200 3218 "http://docker.local:8282/nagios/cgi-bin/extinfo.cgi?type=2&host=fred&service=sys%2Fprocs" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"

# Second line leaving the name unchanged as sys&procs, but note that URL has sys%2Fprocs ie sys/procs, so issue must be in POSTed data. Note this POST generates a permission response:
# "Sorry, but you are not authorized to commit the specified command."

192.168.x.y - nagiosadmin [14/May/2023:10:16:41 +1000] "POST /nagios/cgi-bin/cmd.cgi HTTP/1.1" 200 1430 "http://docker.local:8282/nagios/cgi-bin/cmd.cgi?cmd_typ=7&host=fred&service=sys%2Fprocs&force_check" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"

# This line was generated with I updated the "Service:" with the correct service name "sys/procs".
192.168.x.y - nagiosadmin [14/May/2023:10:17:29 +1000] "POST /nagios/cgi-bin/cmd.cgi HTTP/1.1" 200 1324 "http://docker.local:8282/nagios/cgi-bin/cmd.cgi?cmd_typ=7&host=fred&service=sys%2Fprocs&force_check" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"
samarium commented 1 year ago

This seems to be addressed by a commit on the nagioscore repo.