Showing posts with label networkMonitoring. Show all posts
Showing posts with label networkMonitoring. Show all posts

Saturday, December 28, 2013

Installing MK Livestatus and Adding to Nagios 3 in Ubuntu

Livestatus is a new approach for accessing Nagios data. It has a lot of advantages over the classical NDO approach. Livestatus make use of Nagios Event Broker API. It loads a binary module into Nagios Process. Livestatus creates a socket from which data can be read whenever required.
Many Nagios addons use Livestatus as the backend like NagVis, Check_MK etc.

Installing Livestatus

Monday, September 09, 2013

Monitoring BGP using NAGIOS

We can use check_bgp NAGIOS plugin for monitoring BGP. Visit  http://exchange.nagios.org/directory/Plugins/Network-Protocols/BGP-2D4/check_bgp/details for more details.

How to install and configure check_bgp plugin?

In the demonstration, I will be using NAGIOS server installed in Ubuntu Linux, and i want to monitor BGP in a Cisco ASR 1006 router. Since this plugin uses BGP4-MIB and SNMP, It can be used to monitor any router with SNMP.
  1. Download check_bgp.pl perl script from the link given above. 0.4 is the recent version.

Sunday, November 11, 2012

MRTG Start Up Script for Ubuntu

MRTG as a Start Up Service in Ubuntu

I am monitoring a lot of routers and switches of my organization using MRTG ( Multi Router Traffic Grapher ) . It is one of the best tools to give you an overview of bandwidth utilizations, CPU/Memory Utilizations etc. Here is a small bash script to make all these MRTG process act as a service which is automatically start up at reboot.

Details of MRTG

I am using MRTG with RRDTool using routers.cgi script. My MRTG configurations arrangements are like
  • Location1 Folder
    • router.cfg
    • switch.cfg
    • servers.cfg
  • Location2 Folder
    • router.cfg
    • switch.cfg
    • servers.cfg
  • Location3 Folder
    • SubLocation1 Folder
      • router.cfg
      • switch.cfg
      • servers.cfg
    • SubLocation2 Folder
      • router.cfg
      • switch.cfg
      • servers.cfg
    • router.cfg

Friday, November 02, 2012

Firewall in Ubuntu

How to set up a firewall in Ubuntu ?

Firewall is already in built into your Linux kernel. You just want to configure it properly for your needs !

Firewall is for filtering all the traffic which is headed into or out of your computer. In Linux Kernel , netfilter subsystem take care of this traffic. You just add the rules for accepting, rejecting or denying the traffic.

How to add rules into netfilter ?

 Use the IPTABLES . Iptables are really complex and flexible . See Basic How to of Iptables here https://help.ubuntu.com/community/IptablesHowTo  . 

UFW, Uncomplicated FireWall

There are many high level user interfaces for this Iptables. One is pre-installed with all Ubuntu distros higher that 8.04 , ie UFW or Uncomplicated FireWall . See more here https://help.ubuntu.com/community/UFW .  

GUFW, a Graphical Interface for UFW

GUFW is a GUI interface for UFW which is very easy to use and add rules .See more here https://help.ubuntu.com/community/Gufw

Thursday, October 25, 2012

Internet Proxy authentication in Ubuntu

How to solve "407 Proxy Authentication Required" error in Ubuntu ?

This was one question i was behind from last few days.  Use CNTLM , that's the best answer I got.
CNTLM will make your ubuntu server act as a proxy server and in behind authenticates with your actual proxy server .

Step 1:  Download the package file from the CNTLM website . While writing this, version 0.92.3 is the latest and the link to it is http://citylan.dl.sourceforge.net/project/cntlm/cntlm/cntlm%200.92.3/cntlm_0.92.3_i386.deb

Step 2: Install .deb file . See How to install .deb files in Ubuntu here

Step 3:  cntlm configuration file is located at /etc/cntlm.conf . Open it using your preferred text editor in edit mode . If you use gedit , type " sudo gedit /etc/cntlm.conf "

Step 4:  In cntlm.conf ,  edit the following fields
    Username   YOUR_USERNAME_HERE
    Domain     YOUR_ORGANIZATION_DOMAIN(Contact your Active Directory admin if you don't knw this)
    Password YOUR_PASSWORD
    Proxy  YOUR_PROXY_SERVER_IP_WITH_PORT
    NoProxy LIST_ALL_IP_WITH_NO_PROXY_REQUIREMENT
    Listen SOME_PORT
Sample config here:
   Username   0906895
   Domain     ABC
   Password   rndmpasswd@123
   Proxy  10.18.200.203:8080
   Proxy  10.18.200.204:8080
   NoProxy  localhost, 127.0.0.*, 10.*
   Listen  8080


Step 5:  After changes in configuration files, restart the cntlm service .
 sudo service cntlm restart

Now cntlm started working and your ubuntu server is acting as another proxy server . So add localhost as the system proxy server.

System Proxy setting:

Go to System -> Preference -> Network Proxy
In the Network Proxy Preference window,  Set Manual proxy configuration . Proxy server as localhost and port as the port number you specified in " Listen SOME_PORT" .



Friday, October 05, 2012

How to monitor Windows machine using NAGIOS - NRPE

For monitoring system parameters of a windows computer using NAGIOS or Icinga , the best tool available is NSClient++ ( Visit http://nsclient.org)

 Here I demonstrate NSClient++ isntallation to monitor Windows Vista machine using NAGIOS installed on a Ubuntu server. Without  NAGIOS or Icinga , NSclient++ is meaningless .

Step 1 :  Download NSClient++ tool in your Windows PC . (http://files.nsclient.org/x-0.4.x/NSCP-0.4.0.183-Win32.msi is the latest one as of now. )

Step 2 : Install it . Type your NAGIOS server IP as allowed hosts . Also enable common check and NRPE server during installation .
 Step 3 :  Finish the installation . Installation directory will be C:\Program Files\NSClient++ . Go to that directory and find the configuration file .  In NSClient++ version 0.4 , it is nsclient.ini   . In version 0.3 it is NSC.ini  .

Step 4:  Make sure that in the [modules] section contains lines NRPEListener.dll , CheckExternalScripts.dll and some checks like CheckSystem.dll , CheckDisk.dll , CheckEventLog.dll , CheckHelpers.dll

My modules section is as follows:

[modules]
NRPEListener.dll
NSClientListener.dll
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
CheckEventLog.dll
CheckHelpers.dll
CheckExternalScripts.dll

Step 5: For NSClient++ version 0.4 ,  In the section [/settings/NRPE/server]

Add these lines.
allowed hosts=10.52.2.41(This is my NAGIOS server IP , give yours here!)
allow arguements=1
port=5666
allow nasty characters=1

For NSClient++  version 0.3  , In the section  [NRPE]

Uncomment these options .
port=5666
allow_arguments=1
allow_nasty_meta_chars=1
allowed_hosts=10.52.2.41

Step 6: Go to Run and type services.msc . Find the NSClient++ service and restart that .


Now we have finished the configuration in Windows machine . Now in the ubuntu machine running nagios , try to get the NRPE check statuses in the command line . If it is working fine , we will add services in NAGIOS .

Step 1 :  Check whether you installed nagios-nrpe-plugin . If not , install it . You can use the command  "dpkg -L nagios-nrpe-plugin " to check it .

Step 2 .  Now try to get some status from the windows machine(IP address is 10.52.20.3 ) by command
"/usr/lib/nagios/plugins/check_nrpe  -H 10.52.20.3  -c alias_cpu" .  If this gives
OK CPU Load ok.|'5m'=4%;80;90 '1m'=5%;80;90 '30s'=5%;80;90  as the output, you configured NSClient++ properly .

If not working please check whether the port you mentioned is not blocked .

Step 3 : If working ,  you can add the commands to NAGIOS .
For the host you want to monitor , add a service .

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       vistamachine
        service_description             Drive Usage
        check_command                   check_nrpe!alias_disk
        }



Wednesday, November 11, 2009

installing NAGIOS in Ubuntu 10.04+

This post has been updated on 24th July 2012:
For the completion of my computer Networking course, i done a project on implementation and configuring NAGIOS and configuring some addons also..So here i would like to share with you some thing about Nagios.

Nagios® is a system and network monitoring application. It watches hosts and services that you specify, alerting you when things go bad and when they get better.
Some of the many features of Nagios include:
  • Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
  • Monitoring of host resources (processor load, disk usage, etc.)
  • Simple plugin design that allows users to easily develop their own service checks
  • Parallelized service checks
  • Ability to define network host hierarchy using "parent" hosts, allowing detection of and distinction between hosts that are down and those that are unreachable
  • Contact notifications when service or host problems occur and get resolved (via email, pager, or user-defined method)
  • Ability to define event handlers to be run during service or host events for proactive problem resolution
  • Automatic log file rotation
  • Support for implementing redundant monitoring hosts
  • Optional web interface for viewing current network status, notification and problem history, log file, etc.
visit Nagios official website(http://www.nagios.org/) for documentation.
Below picture shows the frontend of nagios which works in web browser.

PRE-REQUISITES FOR INSTALLATION

A webserver preferably Apache is required for viewing Nagios. So if not done , Install Apache and make sure it works!
sudo apt-get install apache2
// TESTING APACHE: go to http://localhost/ if it shows "It Works" you are done.

NAGIOS INSTALLATION
You can install nagios by two methods.
  1. Installing using Package manager . Use this for a easy to go installation within few steps. I prefer this
  2. By downloading Source code and then compiling it .Use this if you want the latest version of Nagios to be installed. For this , you should have some idea about source code compilings
Method 1: Install using package manager

Go Type sudo apt-get install nagios3 nagios-nrpe-plugin from command line and You will be asked to enter a password for the nagiosadmin user.
Done ! that's it

Method 2: By compiling source code

  1. Download Nagios Source code from the website: http://www.nagios.org/download/core/ and Nagios Plugin source code from http://www.nagios.org/download/plugins
  2. keep your downloaded file in home directory
  3. Extract the tar ball file
  4. sudo tar -zxvf nagios-3.2.0.tar.gz
  5. Go into the directory
  6. cd nagios-3.2.0
  7. Create a user to run the service and a group to run external commands:
    • sudo useradd -m nagios
    • sudo passwd nagios
    • sudo groupadd nagcmd
    • sudo usermod -a -G nagcmd nagios
    • sudo usermod -a -G nagcmd www-data
  8. Now install the Nagios tarballs that were downloaded previously:
    • sudo ./configure --with-command-group=nagcmd
    • sudo make all
    • sudo make install
    • sudo make install-init
    • sudo make install-config
    • sudo make install-commandmode
    • sudo make install-webconf
  9. Add a user for the Nagios interface:
    sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
  10. Restart Apache:
    sudo /etc/init.d/apache2 restart
  11. INSTALLING NAGIOS PLUGIN:

  12. Extract and compile the plugins that were downloaded earlier:
    • cd ~/
    • tar -zxvf nagios-plugins-1.4.13.tar.gz
    • cd nagios-plugins-1.4.13
    • sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
    • sudo make
    • sudo make install
  13. Create a link to start the service:
    sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

  14. Verify the config:
    sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
  15. Start Nagios:
    sudo /etc/init.d/nagios start
Done.

After Installation
After Nagios installation by either methods, you should be able to log into the Nagios web interface (http://localhost/nagios or http://localhost/nagios3 depending upon your Nagios version) using the nagiosadmin user and password.

Next task is to configure NAGIOS to monitor your network like adding your routers, servers and services . You can check out this post for NAGIOS configurations . Nagios without addons is of not much use. You can check out this post for NRPE addon.NRPE

Njoy