PC Plus HelpDesk - issue 228

This month, Paul Grosse gives you more insight into some of the topics dealt with in HelpDesk and HelpDesk Extra

From the pages of HelpDesk, we look at:

  • Image file options.

From HelpDesk Extra, we look at Nagios:

  • Background;
  • Configuring Apache;
  • Hierarchy;
  • Configuration Files;
  • Graphical Output; and,
  • Running example.
Paul Grosse

HelpDesk

Image File Options

On many image processing programs, you get a large number of options of how to save an image in any particular format. For the purpose of the Web, there are essentially three formats: GIF, JPG (or JPEG) and PNG. GIF was popular until there were certain issues regarding licensing which led to people devising PNG which has the best of both GIF and JPEG. The problem with PNG is that not all browsers support it yet. In short:
  • GIF allows 256 colour from a palette and ON/OFF transparency (a pixel is completely transparent or completely opaque). GIF is not lossy but it does need you to compress the colours you use into just 256 so in effect, it is lossy if you are compressing pictures. However, GIF is a good format for diagrams.
  • JPG will let you have all colours (24bits per pixel) but is lossy so, whilst you can get good compressions, you will always lose data. Transparency is not supported.
  • PNG allows a palette or true (24 bit) colour and, it allows continuous levels of transparency. This means that if you want a drop shadow, you can make the shadow go into a transparent background so that when it comes to putting it on a page, any coloured background will have a shadow. In addition, it is not a lossy compression so all of your image is there - the different levels of compression are more to do with how long the computer takes to compress the image
The picture above is a jpeg with the default level of picture quality/compression. On the GIMP, this is 0.85. It gives a reasonable picture.
This is what the compression does when it is set too high. It takes blocks and works out the colours of small blocks that appear in them so that when the compression is lowest (highest picture quality), the picture has the most information.
On the right, we have two images of the sort that you might want to use as the background for a button you would want to use on a web page - a feathered block within which you put a menu name such as 'Home'.

You can find these all over the web but they are not as flexible as they might look...

.gif .png .png in an
incompatible
browser
  • On the left, we have the .GIF version rendered on a white background. Whilst this is all right if you never change the colour of your background, if you do, the rendering will become noticeable, as in the yellow and black instances below it.
  • In the middle, we have the .PNG version with true continuous transparency. If you are using a browser that is not ready for this standard, it might appear as a solid blue block.
  • On the right, you can see how it looks on a browser that is ready. Essentially, all that is wrong with using .PNG is that some browsers don't yet support it.

HelpDesk Extra

Nagios - Background

This program runs on one of the machines on your network, monitoring it continuously. It is better to have it running on a machine on its own if you are monitoring a large network of thousands of machines but for a small network of around a dozen machines, a server as modest as a 500MHz machine with a few hundred MB of RAM will work all right with other things running on it..

The program itself monitors system resources by testing them at specified time intervals. You can define your own working week with different days, hours and so on so, if you have a POETS day, machines that are only turned on during office hours but with an early finish on Fridays, that could be defined so that it would know not to look for it out of the specified hours.

If something out of the ordinary happens such as a machine becomes unreachable for more than a specified amount of time, Nagios can email you or perform one or more of a variety of functions as specified by you in the configuration files - such an event could be triggered by a system crash, a hardware failure such as a NIC going down, workmen cutting through a fibre-optic cable or somebody stealing a server; and you would know either in real time or by looking at the logs when it happened.

Nagios not only looks at the machines on your network, but also at other resources so if, for example, you have an outsourced website that you need to know is available 168/52, Nagios can check it for you and let you know if it was unavailable on Saturday evening.

When you install Nagios, and then look at the configuration and help files (/etc/nagios) you might find that the paths are slightly different to some of the various Nagios resources on the system.

On SuSE Linux, the webserver root (that is placed in Apache's server file system using aliases) is on /usr/lib/nagios; the documentation and other resources are on /usr/share/nagios; and; the log files are on /var/log/nagios.

When configuring Nagios, the log files very useful as they will let you know where you have gone wrong (unless you manage to configure it correctly the first time you use it).

There are two main parts to configure:

  1. Apache
  2. Various Nagios configuration files: hosts, services, relationships between them and so on.

Configuring Apache

Look in Apache's configuration file - httpd.conf in /etc/httpd and in the aliases section, you need to let Apache know that Nagios is to be a part of the system and what it is going to be called...

Aliases section
## start of nagios inclusion
ScriptAlias /nagios/cgi-bin/ /usr/lib/nagios/cgi/
<Directory /usr/lib/nagios/cgi/>
  Options ExecCGI
  
  AllowOverride AuthConfig
  AuthType Basic
  AuthName "Nagios Access"
  AuthUserFile /etc/httpd/pswds
  AuthGroupFile /etc/httpd/gps
  Require group nagiosgp
  Satisfy Any
  
  order deny,allow
  deny from all
</Directory>

Alias /nagios/ /usr/share/nagios/
<Directory /usr/share/nagios/>
  Options None
  
  AllowOverride AuthConfig
  AuthType Basic
  AuthName "Nagios Access"
  AuthUserFile /etc/httpd/pswds
  AuthGroupFile /etc/httpd/gps
  Require group nagiosgp
  Satisfy Any
  
  order deny,allow
   deny from all
</Directory>
## end of nagios inclusion

You also need to make an addition to the directories so that Apache knows who is allowed to use it.

Access permissions section
## start of nagios inclusion
<Directory /usr/lib/nagios/cgi>
  AllowOverride AuthConfig
  AuthType Basic
  AuthName "Nagios Access"
  AuthUserFile /etc/httpd/pswds
  AuthGroupFile /etc/httpd/gps
  Require group nagiosgp
  Satisfy Any
  order allow,deny
  allow from all
  Options ExecCGI
</Directory>

<Directory /usr/share/nagios>
  AllowOverride AuthConfig
  AuthType Basic
  AuthName "Nagios Access"
  AuthUserFile /etc/httpd/pswds
  AuthGroupFile /etc/httpd/gps
  Require group nagiosgp
  Satisfy Any
  order allow,deny
  allow from all
</Directory>

## end of nagios inclusion

This might seem a bit belt-and-braces but it doesn't leave anything to chance. With the conf file updated you can restart Apache using YaST2.


Hierarchy

Nagios' configuration files are put into groups so that making it work together is a lot easier - if somebody moves to another group, you only change them in a groups file. If you go over to a 37.5 hour week, you just change the times and everybody will be affected in the same way.

The diagram on the right (click on it to open up a larger version in a new window) shows how you can group hosts into areas and have different groups of people looking after them.


Configuration Files

The other bit you have to configure is Nagios. This is broken down into a number of files in a sort of relational database thus...

cgi.cfg
checkcommands.cfg
command.cfg
contactgroups.cfg
contacts.cfg
dependencies.cfg
escalations.cfg
hostextinfo.cfg
hostgroups.cfg
hosts.cfg
misccommands.cfg
nagios.cfg
nrpe.cfg
nsca.cfg
original_cfgs
resource.cfg
send_nsca.cfg
services.cfg
timeperiods.cfg

The main configuration of Nagios is in nagios.cfg where the program is told where to look for the resources that it needs; each host has a place in the hosts.cfg and each host is part of a group (these can be which subnet they are on and so on) which are mentioned in hostgroups.cfg. Hosts are dependent upon the services of other hosts and so on - the whole lot linking together.

The contacts (people such as systems administrators on various shifts and so no) are members of contact groups and can be (individually) contacted according to their work times. In addition to this, it is possible to specify scheduled downtime so that people are not getting warnings about things that are not really happening. Details of the configuration files are in HelpDesk Extra in this month's magazine.

The best way of getting to know Nagios is to set up a simple network with just a few hosts and a few services (say, just pings to start with and perhaps a http server). Configure it and then start Nagios in YaST2. If anything is wrong, the error log (config.err in /var/log/nagios) will tell you what it is (or at least the first ones it comes across until things get so confusing that it just gives up - things have to be fairly bad for this to happen though and it usually does a good job of letting you know what it wrong).

Once it is up and running, you can access it via a web browser on any machine that you have so permitted. You will have to type your userID and password and then you are in. Click on Tactical Overview and you will be able to see at a glance if there is anything wrong with hosts or services.


Graphical Output

This screen shows that there has been a series of failures on one of the hosts (checked by using Ping).

If you want to keep an eye on your ISP, this is an ideal way of doing it as it gives you historical data that you can zoom in on, locating transitions from one state to another, down to the second if necessary.
This screen shows the systematic layout of the network. For each of the hosts, there is a symbol that indicates the operating system of the machine or some other aspect of it. You can download these images from the Nagios website.

The locations of the hosts in the image are determined by the configuration files in the 2D section for each host.
This screen shows the status of the hosts, along with details about messages and so on. If Nagios decides that the status of a service or host is flapping (alternating between up and down repeatedly) you will see that here as well.

The little man with the shovel indicates that the problem has been acknowledged and the speech bubbles indicate a comment that has been logged.
This shows an ISP's gateway under stress. The data that makes up this image was collected for over 6 months and shows that the users put the system under significantly more stress un the evening as you might expect.


Running example

If you want to see Nagios running on a site and have a play around with it, go to http://www.nagios.org/demo.php where instructions are given on visiting such a site.

Back to PC Plus Archive Index Page