We're moving to a new support system!

The Nagios Answer Hub is a place where you can get help with technical questions from our experts. There, you can quickly open tickets and join discussion boards.

Request Nagios Answer Hub access here: https://info.nagios.com/answer-hub-access-new-users

After completing the access form, you will be given access to a portal where new tickets can be created. We will keep the old customer forum sections and ticket system available for current cases to be resolved.

Issues accessing the Nagios web interface

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

Issues accessing the Nagios web interface

Postby Datastream101 » Mon Jan 24, 2022 2:59 pm

Hey guys, installed Nagios from the following, https://pimylifeup.com/raspberry-pi-nagios/ and when I try and go to the web interface I get the following page. Is there a particular port to connect ?


Code: Select all
<?php
// Allow specifying main window URL for permalinks, etc.
$url = 'main.php';

if ("no" == "yes" && isset($_GET['corewindow'])) {

   // The default window url may have been overridden with a permalink...
   // Parse the URL and remove permalink option from base.
   $a = parse_url($_GET['corewindow']);

   // Build the base url.
   $url = htmlentities($a['path']).'?';
   $url = (isset($a['host'])) ? $a['scheme'].'://'.$a['host'].$url : '/'.$url;

   $query = isset($a['query']) ? $a['query'] : '';
   $pairs = explode('&', $query);
   foreach ($pairs as $pair) {
      $v = explode('=', $pair);
      if (is_array($v)) {
         $key = urlencode($v[0]);
         $val = urlencode(isset($v[1]) ? $v[1] : '');
         $url .= "&$key=$val";
      }
   }
   if (preg_match("/^http:\/\/|^https:\/\/|^\//", $url) != 1)
      $url = "main.php";
}

$this_year = '2020';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

<html>
<head>
   <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
   <title>Nagios: <?php echo $_SERVER['SERVER_NAME']; ?></title>
   <link rel="shortcut icon" href="images/favicon.ico" type="image/ico">

   <script LANGUAGE="javascript">
      var n = Math.round(Math.random() * 10000000000);
      document.cookie = "NagFormId=" + n.toString(16);
   </script>
</head>

<frameset cols="180,*" style="border: 0px; framespacing: 0px">
   <frame src="side.php" name="side" frameborder="0" style="">
   <frame src="<?php echo $url; ?>" name="main" frameborder="0" style="">

   <noframes>
      <!-- This page requires a web browser which supports frames. -->
      <h2>Nagios Core</h2>
      <p align="center">
         <a href="https://www.nagios.org/">www.nagios.org</a><br>
         Copyright &copy; 2010-<?php echo $this_year; ?> Nagios Core Development Team and Community Contributors.
         Copyright &copy; 1999-2010 Ethan Galstad<br>
      </p>
      <p>
         <i>Note: These pages require a browser which supports frames</i>
      </p>
   </noframes>
</frameset>

</html>


Image
Last edited by Datastream101 on Sun Jan 30, 2022 6:05 pm, edited 1 time in total.
Datastream101
 
Posts: 3
Joined: Mon Jan 24, 2022 3:36 am

Re: Issues accessing the Nagios web interface

Postby TerminalCondition » Fri Jan 28, 2022 8:41 am

If all the moving parts are working right, Nagios should respond to HTTP requests on port 80, and HTTPS requests on port 443. There are a lot of moving parts, but there's nothing special WRT Raspberry Pi here.

It looks like your server is displaying PHP rather than executing PHP. If that's right, then there's probably a misconfiguration in Apache, not Nagios.
TerminalCondition
 
Posts: 4
Joined: Tue Mar 12, 2013 9:10 pm

Re: Issues accessing the Nagios web interface

Postby Datastream101 » Sun Jan 30, 2022 11:01 am

Thanks for the reply, how can I test or fix it?
Datastream101
 
Posts: 3
Joined: Mon Jan 24, 2022 3:36 am

Re: Issues accessing the Nagios web interface

Postby TerminalCondition » Tue Feb 01, 2022 11:12 am

I'm not an Apache expert. Caveat emptor.

First, restart Apache, and see whether that fixes the problem. A lot of people forget to restart Apache after they've made changes.

You're running an Ubuntu distribution, right? If so, check /etc/apache2/mods-enabled directory for a php module. This ought to find it, if it's there.

Code: Select all
$ ls /etc/apache2/mods-enabled/*php*.*


If it's there, but Apache still doesn't execute php, I need to think longer. If it's not there, check /etc/apache2/mods-available. You might find something like this.

Code: Select all
$ ls /etc/apache2/mods-available/*php*.*
/etc/apache2/mods-available/php7.2.conf  /etc/apache2/mods-available/php7.2.load


Enable that module with a2enmod. (You might need to use sudo a2enmod.)

Code: Select all
$ a2enmod php7.2


Restart Apache.

If it still doesn't work, maybe try this search.

https://www.google.com/search?q=apache+displays+php+instead+of+executing+php
TerminalCondition
 
Posts: 4
Joined: Tue Mar 12, 2013 9:10 pm

Re: Issues accessing the Nagios web interface

Postby Datastream101 » Fri Feb 04, 2022 5:29 pm

Awesome! thanks so much. PHP wasn't there so installed the following and it worked. Epic! :D

sudo apt-get install php libapache2-mod-php
sudo service apache2 restart
Datastream101
 
Posts: 3
Joined: Mon Jan 24, 2022 3:36 am


Return to Community Support

Who is online

Users browsing this forum: No registered users and 29 guests