Thursday, October 25, 2012

Installing / Uninstalling .deb files in Ubuntu

In Ubuntu , the package files are in .deb files . To install the packages file , you should be having administrative password.


Installing .deb debian package file in Ubuntu


  • Double click the .deb file , it will be automatically opened with the GDebi Package manager and you can install it
  • From command line , use this command to install a package .
    sudo dpkg -i PACKAGEFILE.deb

Uninstalling a package in Ubuntu

  • From command line, use this command
    sudo dpkg -r PACKAGENAME

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
        }