Nagios 3 on Debian Wheezy or Ubuntu 14.x

After a quick dap with Observium, I’ve decided to go back to Nagios. Nagios3 is a full featured monitoring package for Linux hosts.
The article will describe how to install Nagios 3 on a Debian or Ubuntu host. For the people who never heard about Nagios, please take a look at http://www.nagios.org/projects/nagioscore . In this how-to we will use the opensource version, named Nagios Core.

To start with Nagios Core, you will need a fully functioning LAMP server. If you don’t have a LAMP enviroment run the following command:

The MySQL install will ask you for an administrative password who you will need to enter 2 times.

After the LAMP installation we can go further with the Nagios installation. Run the following command on your Nagios server:

I gave the password as per my choice, please give the values as per your server environment.

Next we need to configure the Nagios at Server, as follows:

Next change the values for check_external_commands to 1 to enable settings as follows:

Now we need to make the changes effective by restarting the Nagios service by using the command:

Accessing the web-interface at http://server1.example.com/nagios3 or http://IP/nagios3 as follows:

Username will be nagiosadmin and password as created above!

Next click on Host Groups:

It will show the present server as localhost. Just click over the localhost.

Now that the basic setup of the Nagios server is finished, we can add our first client / server to monitor.

A monitored client/server on Nagios is called a “host”. To add a host you will need to install the following package:

Further at  server2.example.com define the main Nagios monitoring server entries in Nagios configuration file as :

Where 192.168.0.100 is the main Nagios monitor server server1.example.com IP. Next start nrpe service as shown below

Similarly we can add more nodes to which we want monitoring.

We also need to define the Nagios client entries at server end. Create a file monitor1.cfg in directory /etc/nagios3/conf.d/ and define the values at server1.example.com. In the object configuration files, you can define hosts, host groups, contacts, contact groups, services, etc. You can split your object definitions across several config files if you wish, or keep them all in a single config file.

Default directory is /etc/nagios3/conf.d/ , you can use any name such as I used monitor1.cfg Entries must be like this:

In above file define host contains the information about the added client server2.example.com, next we can use Nagios to check different services. I used to check PING SSH and DISK services. For more details of services used in Nagios check directory /etc/nagios-plugins/config.

Next to make the changes effective restart the nagios3 service.

Now we can check the client details at the Nagios web-interface at Host Groups as follows:

Next on server2.example.com and check the values there.

 

That is it! Now you have a working Nagios server with 2 monitored hosts.

In following posts I will describe how you can implement monitoring alerts, have detailed graphs and much more. So stay tuned!

Apache – make a file downloadable

As well known, Apache is a web server application. To give a basic summary, you can place files on your apache webserver and browse them afterwards in your webbrowser. Now Apache uses MIME types to know how to display various types of file, for example .php has to be rendered by PHP, html can be processed by the Apache server and etc.

This technique can prove troublesome if you want to use your web hosting as a download folder. For example you have a folder full of .xml or .txt files that need to be downloaded from you hosting instead of viewed in your browser. To do this you can erase the MIME type in the server preferences but this solution does this for the full webserver. So other folders will also promp a downloadable file instead of viewing it.

To enable this only for one folder, you can use the .htaccess file.
In your FTP program or through the shell navigate to the folder you want to use as your download folder and create or open the .htaccess file.
Then add the following line to the file

Just change the “file type” to the extension of your file excluding the dot. For example if you want to download .txt files your .htaccess will be as followed

Afterwards just reload your browser page and the file will be downloadable.

Have fun

Acronis 11.5 Linux agent installation – Debian / Ubuntu

From my point of view is Acronis one of the best back-up tools on the market. They provide agent for different kind of OS’s, cloud storage support, central management and etc. Nevertheless installation of the Acronis 11.5 Linux agent has some dependencies that are not written out in the Acronis manual. Therefor I’m writing still how-to for the installation on Debian / Ubuntu.

This how-to is tested on Debian 6 & 7 and Ubuntu 12.04 (all i386), the installation of the Acronis Management server is not covered by this how-to. For detailed information on how to install and configure the Acronis Management server I need to redirect you to the Acronis 11.5 manual

First we need to download the up to date and correct Acronis 11.5 Linux agent, the best place for this is Acronis website @ www.acronis.eu/my

So head on over to your account, go to “My Product & Downloads”, choose your product and download the agent on the Linux component tab. Once you have downloaded the Agent you will have a file called “ABR11.5AL_en-EU.i686”, this file needs to be transferred to your Linux server. If you are looking for a secure way to transfer file on and off your Linux server please check out WinSCP.

Once the Acronis 11.5 Linux agent is transferred to a temporary folder like /tmp , you will need to execute the following commands as root (su or sudo)

Give the appropriate rights

Update, upgrade, download and install the dependencies

Once all the dependencies are installed you can start the agent by executing

The installation process of the Acronis 11.5 Linux agent will start, now just follow the wizard and fill out the license and management server and your Linux Acronis Agent is configured and installed.

Installation Zabbix agent on Debian 7 x64

I could not find a tutorial that showed how to install the precompiled Zabbix 2.0 agents on a 64 bit Debian box, so I’m making a how to for Zabbix agent on Debian 7 x64 . This tut also works on Debian 6 x64 or x86.

The latest downloads for precompiled agents and source code for building servers is here. http://www.zabbix.com/download.php , there is no Zabbix agent on Debian 7 x64 so you will need the source code.

On the Debian system that is getting the agent (remember this is for 64 bit version of Debian, go to the Zabbix download site for the link to the 32 bit agent if your system is 32 bit):

You should be logged in to a root sudo or su session for the following

Change “Server=127.0.0.1” option to the IP address of your Zabbix server, for example:

Exit and save the file

Change “LogFile=/tmp/zabbix_agentd.log” to:

Change “Server=127.0.0.1” option to the IP address of your Zabbix server, for example:

Change “ServerActive=127.0.0.1” option to the IP address of your Zabbix server, for example:

Change the hostname to the fqdn of the server or rem out the “Hostname=Zabbix server” line:

Exit and save the file

Exit and save the file

Now the Zabbix agent on Debian 7 x64 is installed. Go to your Zabbix server’s web interface and add the new system to hosts as you normally would and configure accordingly and you are done.

References:
http://www.zabbix.com/forum/showthread.php?p=103244#post103244

See used folder space in Linux Terminal (Ubuntu, Mint, Debian)

Working more and more in the terminal, once and so often I find a problem where there is no simple terminal solution. One off these problems was seeing the how much space every folder takes on my servers. After a little search I found a solution called NCDU.

The default file manager for Ubuntu doesn’t give users the possibility to see how much space a folder or subfolder takes up. You may use third-party software to see which folders that take up most space in your hard drive, or simply use the terminal to scan for big size folders to see where hard disk space has gone.
To do this, we need first to install the ncdu package (ncurses disk usage viewer & analyzer) with this command:

To scan the root folder, run now this command:

The scan process may take several minutes to finish depending on the size of your hard drive. The returned output will be sorted by size.

To scan the home folder, run this command:

To scan a specific folder, use this command:

That’s it!

Webmin System Stats

A *nix admin is used to work with the command line but from time to time a GUI interface comes in quite handy; Webmin is an GUI webinterface for *nix systems that allows you to administrate basic roles on your server like apache, bind dns, samba and etc…

Webmin also provides addon modules who are developed by 3th party developers. One of those modules is Historic System Stats (or webminstats in short) by Eric Gerbier.

Webminstats monitors different aspects of your server and graphs them out with rrdtool.

Installation

  1. Have a working webmin system, see http://www.webmin.com/ for more information
  2. Download the latest webminstats from http://sourceforge.net/projects/webminstats/
  3. Install the following pre requirements (debian, ubuntu)
    apt-get install perl
    apt-get install rrdtool
    apt-get install librrds-perl
  4. Go to Webmin -> Webmin Configuration -> Webmin Modules -> From uploaded file -> choose the downloaded file
  5. Go to Webmin -> Refresh Modules
  6. Go to Webmin -> System -> Historic System Statistics
  7. Click OK for the not installed modules

After the installation webminstats will gather information about the installed modules and graph them out.

Many thanks to Eric Gerbier for the wonderfull plugin.