Open mfoliveira opened 2 weeks ago
Build and Test steps.
LXD container / nagios-core / nagios-plugins:
lxc launch ubuntu-daily:oracular nagios-upstream
lxc exec nagios-upstream -- su - ubuntu
# Reference:
# https://support.nagios.com/kb/article/nagios-core-installing-nagios-core-from-source-96.html#Ubuntu
sudo apt install -y \
autoconf gcc libc6 \
make wget unzip \
apache2 php libapache2-mod-php8.3 \
libgd-dev openssl libssl-dev
wget https://github.com/NagiosEnterprises/nagioscore/releases/download/nagios-4.5.2/nagios-4.5.2.tar.gz
tar xf nagios-4.5.2.tar.gz
cd nagios-4.5.2/
./configure \
--with-httpd-conf=/etc/apache2/sites-enabled \
--with-htmurl=/nagios4 \
--with-cgiurl=/cgi-bin/nagios4 `# instead of /nagios4/cgi-bin` \
--with-cgibindir=/usr/lib/cgi-bin/nagios4
make -j$(nproc) all
sudo make install-groups-users
sudo usermod -a -G nagios www-data
sudo make install
sudo make install-daemoninit
sudo make install-commandmode
sudo make install-config
sudo make install-webconf
sudo a2enmod rewrite
sudo a2enmod cgi
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin # nagiospass / nagiospass
sudo sed '/^use_authentication=/ s/=1/=0/' -i /usr/local/nagios/etc/cgi.cfg
sudo systemctl restart apache2.service
sudo systemctl start nagios.service
sudo apt install -y \
libmcrypt-dev bc dc \
gawk build-essential \
snmp libnet-snmp-perl gettext
cd
wget https://github.com/nagios-plugins/nagios-plugins/releases/download/release-2.4.10/nagios-plugins-2.4.10.tar.gz
tar xf nagios-plugins-2.4.10.tar.gz./to
cd nagios-plugins-2.4.10/
./configure \
--with-cgiurl=/cgi-bin/nagios4
make -j$(nproc)
sudo make install
sudo systemctl restart nagios.service
Browser-based testing:
<LXD>$ ip -4 a l type veth | awk '/inet/ { print $2 }'
10.191.59.8/24
<HOST>$ firefox http://10.191.59.8/nagios4
Before:
Check that links are broken from the Current Status section, but are working from the Reports > Trends section.
Apply Patch/Reinstall:
make -j$(nproc) clean
make -j$(nproc) all
sudo make install
After:
Check that links are now working from the Current Status section, and are still working from the Reports > Trends section.
Hi @sawolf,
Sorry to bother. Could you please review this when you have a chance?
I'm not familiar with the project timelines, so please excuse this ping if it is too early. Thanks!
Hi @mfoliveira, thanks for the patch! The code looks reasonable to me.
@tsadpbb can you test this and include it in the next release if it's good?
These links are working or broken depending on the page they are clicked, if configure option
cgiurl
hascgi-bin/
not undernagios/
HTML root:They fail if clicked from
Current Status > Hosts / Services
.They work if clicked from
Reports > Trends > Report Type: Host / Service
.This happens because
TRENDS_CGI
andHISTOGRAM_CGI
for the HTML pages are defined as RELATIVE PATHs (../*.html
), but they may be clicked from pages at DIFFERENT PATHs (e.g.,/cgi-bin/nagios/*.cgi
-- note it would work for/nagios/cgi-bin/*.cgi
, asnagios/
is HTML root).This affects Debian/Ubuntu, which use
--with-cgiurl=/cgi-bin/nagios4
.Fix this by using ABSOLUTE PATHs to the HTML root, where
trends.html
andhistogram.html
are located.Tests:
This has been tested with 4.5.2, as 4.5.3 removed these .html files, on Ubuntu Oracular (to be 24.10) with a web browser.
The CGI binaries'
strings
output have been compared before/after, and the only changes (other than build-time noise) are indeed the path changes to{trends,histogram}.html
files. Some snippets: