How To Change Nagios Password

[ This Blog Was Moved To : ]

Later this afternoon, a colleague asked my help to change the Nagios Password.

As I am not a Nagios user, I searched google for it and found this link about Nagios Installation.

So, lets cut to the chase, here are the steps I used:

root# touch /usr/local/nagios/sbin/.htaccess

root# vi /usr/local/nagios/share/.htaccess

And I wrote the follwing text in the .htaccess file

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
require valid-user

Then, I did the following:

root# touch /usr/local/nagios/share/.htaccess

root# vi /usr/local/nagios/sbin/.htaccess

And I wrote the same text in that file too. Then, I did the following
(Which is the command for changing the password ):

root# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

New password:
Re-type new password:
Adding password for user nagiosadmin

root#  ls -l /usr/local/nagios/etc/htpasswd.users
-rwxrwxr--  1 nagios nagios 26 Dec 21 15:54 /usr/local/nagios/etc/htpasswd.usersroot#

root# chmod o+r /usr/local/nagios/etc/htpasswd.users

root# service httpd restart

Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

And, This is it for now.


Grails, MySQL : Cannot create PoolableConnectionFactory

[ This Blog Was Moved To : ]

Ok, You read this post I assume you face the same problem I faced.

Quick Solution :

If this is your MySQL Connection URL :


Change it to


Understanding the solution :

Recently, I am developing a grails application. I was using the default in memory HSQLDB, as it is wonderful for changing the database design frequently. But, as I felt stability in the project I wanned to move the project to the next level where data get persisted. Hence, I tried to move to MySQL Database by modifying the DataSource.groovy File.

dataSource {
pooled = true
//    driverClassName = “org.hsqldb.jdbcDriver”
//    username = “sa”
//    password = “”

// MySQL Database configurations
driverClassName = “com.mysql.jdbc.Driver”
username = “root”
password = “123456”

And result was a very long exception

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’: Cannot resolve reference to bean ‘sessionFactory’ while setting bean property ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’: Cannot resolve reference to bean ‘hibernateProperties’ while setting bean property ‘hibernateProperties’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘hibernateProperties’: Cannot resolve reference to bean ‘dialectDetector’ while setting bean property ‘properties’ with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dialectDetector’: Invocation of init method failed; nested exception is Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure

So, I tried to Google on PoolableConnectionFactor .. But Results was either

Change /etc/hosts.allow and check /etc/hosts


Some changes in /etc/my.cnf and grant access to the database user

And they all failed. So I created a new Java Project in NetBeans IDE, added the JDBC Driver Jar file, and wrote the following code:

String dbUrl = “jdbc:mysql://localhost:3306/DB_NAME”;
Class.forName ( “com.mysql.jdbc.Driver” );
Connection connection = DriverManager.getConnection ( dbUrl , “root” , “123456” );

So, the following single exception appeared :

Dec 5, 2009 9:02:41 AM testmysql.Main main
SEVERE: null
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

So, I Googled again and I found this post

Which is long, and here is the main point of it :

Re: Communication link failure!!!!
Mar 16, 2009 3:49 PM (reply 8 of 12)  (In reply to #7 )
I’m happy to say that I resolved the issue. I replaced localhost with and it worked perfectly. I’ve also checked what the browser gives as localhost and it’s the IPv6 localhost (to anyone who might be experiencing the same issue that’s 0:0:0:0:0:0:0:1) not the IPv4 one, so that was the problem. Not sure why this machine defaults to IPv6 though.

So, It seams the PC is defaulting to IPv6 not IPv4

and the solution is as I said above

Change the MySQL Connection URL from localhost to (or whatever your localhost IP Address is )

NOTE: you can find you localhost IP Address in /etc/hosts

NOTE: If you use openSuse Linux ( Like I Do ) and you want to disable IPv6, you can do so using

Yast-> Network Manager

Wish you best of luck.


New Updates :

I had another PoolableConnectionFactory exception. This time because I had reinstalled my Linux system, so my databases were gone. I got the following exception

Cannot create PoolableConnectionFactory (Unknown database ‘DB_NAME‘):
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database ‘DB_NAME

Because, there was no Database scheme in the mysql database engine. So, to solve this:

  1. In console window type “mysql -u root -p” if your mysql username is root and you have a password.
  2. Create new database using “create database DB_NAME”.
  3. Exit the mysql console as you don’t need it, using “exit” command.

Now, you can restart your grails application and this exception will not show up again.

Wish you best of luck.

Linux BroadCom Wlan Driver Solution

[ This Blog Was Moved To : ]

Recently, I’ve upgraded from openSUSE 11.1 to 11.2. In 11.1 WLAN Card was working like a charm, when I upgraded It didn’t work as expected. So, I used my USB Modem (Mobinil) and searched google.

I found a program called <b>b43-fwcutter</b>.  I tried hard to use it, but in vain.

but I found this :

linux-264i:/home/dino # b43-fwcutter -l
b43-fwcutter version FWCUTTER_VERSION_

Extracting firmware is possible from these binary driver files.
The <ID> column shows the unique identifier string for your firmware.
You must select the firmware with the same ID as printed by the kernel driver on modprobe.
Note that only recent drivers print such a message on modprobe.
Please read

<driver>        <filename>              <microcode>     <ID>    <MD5 checksum>

b43legacy       wl_apsta.o              295.14          FW10    e08665c5c5b66beb9c3b2dd54aa80cb3
b43             wl_apsta.o              351.126         FW11    9207bc565c2fc9fa1591f6c7911d3fc0
b43             wl_apsta_mimo.o         351.126         FW11    722e2e0d8cc04b8f118bb5afe6829ff9
b43             wl_apsta_mimo.o         410.2160        FW13    cb8d70972b885b1f8883b943c0261a3c

So I took the  wl_apsta_mimo.o and searched Google. I found this awesome link.

As I’m using openSUSE. I found this awesome words :

openSUSE 11.0 and 11.1 use the following command:

*sudo /usr/sbin/install_bcm43xx_firmware

So, I followed up. and this is the result

linux-264i:/lib/firmware # /usr/sbin/install_bcm43xx_firmware
Downloading b43 firmware
######################################################################## 100.0%
Extracting b43 firmware
This file is recognised as:
ID         :  FW13
filename   :  wl_apsta_mimo.o
version    :  410.2160
MD5        :  cb8d70972b885b1f8883b943c0261a3c
Extracting b43/pcm5.fw
Extracting b43/ucode15.fw
Extracting b43/ucode14.fw
Extracting b43/ucode13.fw
Extracting b43/ucode11.fw
Extracting b43/ucode9.fw
Extracting b43/ucode5.fw
Extracting b43/lp0bsinitvals15.fw
Extracting b43/lp0initvals15.fw
Extracting b43/lp0bsinitvals14.fw
Extracting b43/lp0initvals14.fw
Extracting b43/a0g1bsinitvals13.fw
Extracting b43/a0g1initvals13.fw
Extracting b43/b0g0bsinitvals13.fw
Extracting b43/b0g0initvals13.fw
Extracting b43/lp0bsinitvals13.fw
Extracting b43/lp0initvals13.fw
Extracting b43/n0absinitvals11.fw
Extracting b43/n0bsinitvals11.fw
Extracting b43/n0initvals11.fw
Extracting b43/a0g1bsinitvals9.fw
Extracting b43/a0g0bsinitvals9.fw
Extracting b43/a0g1initvals9.fw
Extracting b43/a0g0initvals9.fw
Extracting b43/b0g0bsinitvals9.fw
Extracting b43/b0g0initvals9.fw
Extracting b43/a0g1bsinitvals5.fw
Extracting b43/a0g0bsinitvals5.fw
Extracting b43/a0g1initvals5.fw
Extracting b43/a0g0initvals5.fw
Extracting b43/b0g0bsinitvals5.fw
Extracting b43/b0g0initvals5.fw

Downloading b43legacy firmware
######################################################################## 100.0%
Extracting b43legacy firmware
This file is recognised as:
ID         :  FW10
filename   :  wl_apsta.o
version    :  295.14
MD5        :  e08665c5c5b66beb9c3b2dd54aa80cb3
Extracting b43legacy/ucode2.fw
Extracting b43legacy/ucode4.fw
Extracting b43legacy/ucode5.fw
Extracting b43legacy/ucode11.fw
Extracting b43legacy/pcm4.fw
Extracting b43legacy/pcm5.fw
Extracting b43legacy/a0g0bsinitvals2.fw
Extracting b43legacy/b0g0bsinitvals5.fw
Extracting b43legacy/a0g0initvals5.fw
Extracting b43legacy/a0g1bsinitvals5.fw
Extracting b43legacy/a0g0initvals2.fw
Extracting b43legacy/a0g1initvals5.fw
Extracting b43legacy/b0g0bsinitvals2.fw
Extracting b43legacy/b0g0initvals5.fw
Extracting b43legacy/b0g0initvals2.fw
Extracting b43legacy/a0g0bsinitvals5.fw

b43 firmware successfully installed.
b43legacy firmware successfully installed.
linux-264i:/lib/firmware # ^C

Have fun..

Suse 11.1 Linux and Egypt Mobinil 3G USB Stick Modem

[ This Blog Was Moved To : ]

Yesterday, I went to Mobinil branch in Tanta, I wanned to buy a USB Stick modem. My issue was that I’m using Linux SUSE 11.1, and I know that the USB Stick modem support is for Windows and Mac OSs only. So, I wanned to know for sure.

There I asked a sales person called “Ahmed Salamah” ( who by the way was really cooporative ). He tested with me the stick modem on my laptop and called a friend of his ( may be a technical support for mobinil, I actually dunno ) who assured him that linux supports USB Stick modem of Type ” HUAWEI E156G” which they sell at Mobinil’s branch. But, it does not support the other model they sell.

So, we tried it several times, but no use. So, we googled for it. I found a link which is that

and the technical guy sent us another link on mail, which is this one

So, I bought the stick modem and said to myself ” Ok, as long as you know for sure that it works for linux, you find a way to make it work, at mobinil they are not the linux gurus”. I bought it and take it back home, tried to find a solution online, and I stuck it into my laptop.

And the surprise was, that the nm-applet gnome Network Manager applet, recognized the connection after a while. And it works fine.

My nm-applet versin in 0.7.0

I guess this is pretty much it.

Notes: This tick modem got a LED, when it is colored Stable Green then it is connected to GPRS
When connected to Light Blue, then it is connected to HSPD (Not sure of the name)  which is better.
When it is connected to Gark Blue, then it is connected to 3G which is the best.

One other thing to note. While we were testing the stick modem on Windows. We found that you can put a limit to your usage in HUAWEI E156G Stick modem in the configuration of the program that ships with it from mobinil. And it got better statistics and configuration than the other modems. So, I suggest that one.

I Dunno about lots of other modems, there may be better modems out there, but between the two types that we tried at mobinil ( the HUAWEI and HTC I guess ), I found this one better.

Posted in LINUX. Tags: , , , , , , . 2 Comments »

Mounting NTFS Drive ( Read, Write ) to all users.

[ This Blog Was Moved To : ]

Recently, I had the issue that my external HDD can’t be mounted as ( Read , Write ). It was getting mounted as read only for root user only. I needed to mount it as Read Write for all users.

The issue :
The HDD was not mounted properly , so that it needs to be fixed.

The solution:
connect the HDD ..
execute : dmesg

to know the HDD Block  ( e.g. /dev/sdb )
then execute the mount comand like this

mount -t ntfs-3g /dev/sdb1 /mnt/mybook/ -o rw,force

then unmount the device

umount /dev/sdb1

then mount again.

mount -t ntfs-3g /dev/sdb1 /mnt/mybook/ -o rw,force

Don’t forget to unmount the HDD after doing stuff with it.

and this is it …

Virus Removal Groovy Script

[ This Blog Was Moved To : ]

As I’m a Linux User since years ago. I faced the problem of NO Viruses at my PC, but tons of viruses on my Flash Memory ( USB Stick ), due to copying files to/from windows machines.

Actually, I was never affected by these viruses on my own, but I do NOT want to be a transportation facility for the virus to spread across other machines.

I noticed that there are two simple types of viruses that usually get attached to the memory stick.

  1. A .inf file and a .exe file that ofcourse got a strange name that I can visually detect and manually remove at linux.
  2. A .exe file gets the name of the super directory with the addition of the extension .exe. Which was usually easy to detect visually but hard to remove manually due to the amount of folders on the memory.

So, to fasten the process of  removing the second virus, I wrote this simple Groovy script ( which is in fact a reflection of  an old Java program that I created for the same virus years ago )

// Searchs for the .exe Virus that has the same name of its parent directory
checkVirus = { folder ->
    folder.eachFile{ file ->
        }else if ("${}.exe" == ){
checkVirus (new File('/media/disk/'))

And this is it. Any enhancements or suggestions will be great.