Hi Guys,
I'm trying to setup Nagios to auto load in a raspberry PI so I can have it mounted on a screen. I've managed to get the system to load directly in Chromium but it asks for the username and password, here's how I've done it so far. Can you help me by passing the password through?
GNU nano 2.2.6 File: /etc/xdg/lxsession/LXDE-pi/autostart
@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xscreensaver -no-splash
@xset s noblank
@xset s off
@xset -dpms
@python /home/pi/launch_nagios.py
GNU nano 2.2.6 File: /home/pi/launch_nagios.py
# Python script to launch nagios on Raspberry Pi.
import subprocess
def open_browser():
# Start chromium and redirect output.
url = "http://192.168.1.11/nagios3/"
chromium_log_file = open("/home/pi/log-chromium.txt", "w")
subprocess.Popen(["chromium", "--disable-infobars", "--disable-session-$
open_browser()
Thank you
Auto Login to Nagios Webpage
-
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Auto Login to Nagios Webpage
Does passing the un/pw in the URL work and if so is it a viable option?
Code: Select all
import subprocess
def open_browser():
# Start chromium and redirect output.
url = "http://username:password@192.168.1.11/nagios3/"
chromium_log_file = open("/home/pi/log-chromium.txt", "w")
subprocess.Popen(["chromium", "--disable-infobars", "--disable-session-$
open_browser()
-
- Posts: 267
- Joined: Thu May 07, 2015 4:59 am
Re: Auto Login to Nagios Webpage
That worked great it logged in without asking for the password, do you know if there's a way to have the map page set as the default page?
Re: Auto Login to Nagios Webpage
To change the default homepage, you can edit /usr/local/nagios/share/index.php
Change:
To:
Change:
Code: Select all
$url = 'main.php';
Code: Select all
$url = 'map.html?host=all';
-
- Posts: 267
- Joined: Thu May 07, 2015 4:59 am
Re: Auto Login to Nagios Webpage
Hi ssax,
I tried that and although the local of my files was different it didn't work quiet as expected, it loaded the left side but in the main window its just showing as Not Found. The default locations for my files are in /usr/share/nagios3/htdocs
In there I have the following files;
config.inc.php
includes
main.php
rss-corefeed.php
ssi
contexthelp
index.php
media
rss-newsfeed.php
images
js
robots.txt
side.php
I reviewed the main.php file and found the place to make the edit, but I considered the link I was looking for must have been in the side.php file, this is what i found.
<li><a href="<?php echo $cfg["cgi_base_url"];?>/statusmap.cgi?host=all" target="<?php echo $link_target;?>">Map</a></li>
So at a guess i tried to put statusmap.cgi?host=all in as the default page, but i had the same problem as before? Any ideas?
Nathan
I tried that and although the local of my files was different it didn't work quiet as expected, it loaded the left side but in the main window its just showing as Not Found. The default locations for my files are in /usr/share/nagios3/htdocs
In there I have the following files;
config.inc.php
includes
main.php
rss-corefeed.php
ssi
contexthelp
index.php
media
rss-newsfeed.php
images
js
robots.txt
side.php
I reviewed the main.php file and found the place to make the edit, but I considered the link I was looking for must have been in the side.php file, this is what i found.
<li><a href="<?php echo $cfg["cgi_base_url"];?>/statusmap.cgi?host=all" target="<?php echo $link_target;?>">Map</a></li>
So at a guess i tried to put statusmap.cgi?host=all in as the default page, but i had the same problem as before? Any ideas?
Nathan
Re: Auto Login to Nagios Webpage
Sorry about that, I assumed you were running Core 4.
Modify your /usr/share/nagios3/htdocs/index.php and change:
To:
Modify your /usr/share/nagios3/htdocs/index.php and change:
Code: Select all
$corewindow="main.php";
Code: Select all
$corewindow="cgi-bin/statusmap.cgi?host=all";
-
- Posts: 267
- Joined: Thu May 07, 2015 4:59 am
Re: Auto Login to Nagios Webpage
That worked perfectly thank you Ssax!
Re: Auto Login to Nagios Webpage
I'll be closing this thread now, but feel free to open another if you need anything in the future!
Former Nagios employee