Problem solve Get help with specific problems with your technologies, process and projects.

Nagios Looking Glass: Getting started

Nagios Looking Glass (NLG) allows users to access Nagios data on a Web server via an HTTP connection. Learn how to set up the NLG client-server model in this tip.

With the Nagios Looking Glass (NLG) tool, developer Andy Shellam has tried to resolve a common problem for network...

administrators running Nagios. What happens if you want to provide access to up-to-date information from Nagios without giving users access to the full Nagios console? Providing read-only access to the Nagios console can be complicated, and can occasionally require network re-structuring or can even pose a security risk.

More on Nagios:
Managing events with Nagios Event Broker

Nagios: Balancing passive and active checks 

NLG is designed to fix those issues by taking a feed from Nagios status data via an HTTP connection and displaying it on a public Web server. It works in a client-server model with a PHP-based polling server installed on your Nagios server. A receiver client, also PHP-based, is installed on your Web server. If you want to use NLG locally, you can also run the client and the server together on your Nagios server. The receiver client creates an AJAX-enabled page based on a template. You can also customize this template to display whatever you require.

You can see a demo of NLG at

Getting started with NLG

To get NLG up and running, first you need to ensure that you have some pre-requisites on your server and client. On the server side, (on your Nagios server, in other words) you should have:

  • Nagios 2.x
  • Apache 2
  • and PHP 5.

On the client side, you need:

  • Apache 2
  • the 'dig' command line tool
  • PHP 5 (with the allow_url_fopen enabled)
  • and, if you want to use HTTPS (which I always recommend), then you need PHP with OpenSSL compiled in.

For browsers accessing the client site, you'll want to use Firefox 1.5 or 2.0 or IE 6 or 7. JavaScript must be enabled and the best resolution is 1024x768.

Next, you need to download the NLG software. The latest version is NLG 1.0.1.

You are required to be root, or su'ed to root, in order to install NLG. Unzip the NLG package:

# unzip

Two directories and some documentation files will be created. The server directory needs to be installed onto your Nagios server, and the client directory should be installed on your Web server.

Setting up the NLG server

Here's what you need to do to get started on the server side of your NLG implementation. Copy the server directory in your Nagios share directory, usually /usr/local/nagios/share.

Now, we have to configure the server side. Change into the /usr/local/nagios/share/server/sync-files directory and copy the file like so:

# cp

This file is the configuration file for the NLG server. We'll make some edits to this file continue. Specifically, we want to modify the three configuration options you can see below:

$ClientCompanyName = "© Test Company Pty Ltd"
$ClientAdminEmailAddress = ""
$ServerFeed_URL = "";

Replace the company name and email address with appropriate values for your environment. Change the server feed URL to the location of the s3_poller.php file on your Nagios server.

If you have enabled authentication on your Nagios server, you will also need to specify a username and password to log into the console with by changing the following options:

$ServerFeed_AuthEnabled = 1;
$ServerFeed_AuthUsername = "username";
$ServerFeed_AuthPassword = "password";

Replace the username and password options with appropriate credentials and ensure the authentication enabled option is set to 1. The remaining settings can be left as the defaults.

Setting up the NLG client

Now, we're going to install the client. Move the client directory to an appropriate location on your Web server. For example, make it accessible via the URL: Change the ownership of the files to the user your Web server is running as,

# chown -R apache:apache /var/www/html/client

Here, we've edited the ownership of the files in the client directory to the apache user and group.

Again, we need to alter a configuration file, this time Copy this file and change it so that it has a .php extension like the one below:

# cp

Edit this file and change the following option to the URL of the Nagios server, the location of the s3_download.php file, which is contained in the server directory we installed on the Nagios server previously:

$Stub_DownloadSource = "";

The remaining settings are fine as defaults, but you can read through the configuration file to get more details.

Viewing your NLG status information

Finally, you're able to go to the URL, in our case, for the client and display the NLG site. This displays the default site that contains information from your Nagios server. You can customize this view by adjusting the NLG template.

Further details of how to do this are contained in the README file contained in the package and in the NLG manual.You can also find support for NLG at

This was last published in February 2007

Dig Deeper on Linux administration tools

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.