Compiling Tomcat APR-Native on OEL5.2

This is just a short tutorial on how to compile APR on Oracle Enterprise Linux 5.2. If you ever need to install Apache Portable Runtime on a Oracle Enterprise linux machine, Then this is what you need, and how to configure it.

(more…)

Add comment January 5, 2010

Howto Linux X-Server on windows.

Whats this?
Oke here a small but hopefully “strong” little tutorial on how to “display” linux X compontents on your windows desktop. This might help you administer linux machines easier without the need to install a VNC deamon or have X enabled or even installed on the remote Linux box.

(more…)

Add comment December 10, 2009

Personal Memo – Make delete and others function in a terminal.

Set the terminal delete backspace and such using the stty command. On some linux distros these are not defined by default and might be needed to work inside the terminal. Behind the -More- the so called stty commands for erase, kill and other terminal functions…

(more…)

Add comment December 10, 2009

Application for running custom init scripting in a saver way.

Hi All,

Just Wrote :

AMIS.zip

An application to start / stop multiple custom scripts during INIT in a specific order without the need to understand the full INIT.d process. Written by AMIS to enable DBAs to create basic tiny startup / stop scripts and run them using the chkconfig / services commands. through a very basic config file.

Application should create a basic abstraction between the init.d process and the to be executed configurable scripts. main goal is to prevent poor scripting from killing the init.d proces, and follow the system guidlines concerning init scripting as much as possible.

Please tell us what you think or what could be improved. naturally even we dont know it all. Suggestions, Bugs, Hints, Tips, Arguments, Alternatives? Please let us know :)

Rename the “AMIS.zip.doc” file back to “AMIS.zip” to access its content. We have tested this script on the following systems.

RHEL 5.3     Perl v5.8.8
RHEL 5.2     Perl v5.8.8
RHEL 5.1     perl v5.8.8
SLES 9.0      perl v5.8.8

Need to compile the “Config::IniFiles”  even though its shipped with the app as module? use > cpan -i Config::IniFiles.

-Rgrds, Chris

1 comment December 7, 2009

Changing working directory to script location in perl.

Another one of my memo`s. I had some trouble changing the working directory to the actual script location without the need to download all kinds of fancy modules. The solution i found to be working quite nicely was this one.


# We want the programmig to be clean!
use strict;

# We need to change the working directory to where
# the script is. This is how :)
# Added by Chris.
use Cwd 'abs_path';
my $path = abs_path($0);
$path =~ s/scriptname.pl//gi;
chdir($path);

Hope this helps anyone :)

Add comment December 4, 2009

Adding perfmon counters using nrpe and centreon

In this little tutorial a detailed description on how to succesfully monitor and add various windows counters using the check_nrpe command and the NSClient++ agent for windows using the Centreon configuration and Monitoring GUI for Nagios. Yup, its all open source, and free for usage…
(more…)

Add comment November 25, 2009

Nagios – XI

Yey!

yeah, i have luckily become a tester for the new Nagios XI (eXtended Interface) tool and I thought…. Lets devote a post to this new product!

Well first i was a bit surprised that the new product comes as a VM package meaning that you will download a virtual machine with all the required settings pre-configured for you. When reading various posts on the subject, its all support related, which brings me to the second point. Nope, Nagios XI will not be open source as in “free for download”, but it will be open source as in “your free to develop ontop of the original product”.

Yea i know this will raise allot of questions, but drilling down to the source of this ‘little evil’ it seems that developers need to be payed, so lets blame society for this and not the people developing and releasing the product.

What does it do?
Well the Nagios-Core (which is and stays free for download) monitors network nodes using check_commands that can be utilized by nagios to check for a wide range of network services like; Ping,Oracle,NTP,DHCP,CPU,MEM,DISKSpace.

Using the data the Nagios-Core collects there are a wide range of exsisting GUIs that can make this data visible in many different ways like; headsup-displays,performance-graphs,traffic-lights etc. And allows people to be notified using mail,sms,or other means.

Whats XI?
Well most of the GUIs had a mayor downside, it required a fair amount of know how to get it up and running. You needed to compile allot of tar-bals, install allot different RPMs and next you needed to make all these different things work together using some kind of a unified configuration that could reach 1M lines easily when you wanted all the fancy features.

Nagios-XI primarily makes the nagios tool and its GUI available for non-skilled users that dont have any affinity with linux. Its a VMware image that you can boot easily using a VMware player. Next thing you need to do is configure an IP (with extended manual) and open your explorer. The rest is done from there, pre-configured and working without a hassle.

Next to that the GUI is fully graphical including configuration wizards, custom dashboards (drag-drop style), custom views, custom almost everything. In short, Next, Next, Finish!

Im not sure seasoned engineers like myself would buy this product quickly, most of us would compile, configure, and download a GNU gui and work from there. But i do think there is a large market out there of engineers that dont have the required time, or linux know-how to get up and running. For these people i think Nagios XI will be a welcome alternative!

Rgrds,

1 comment November 18, 2009

Set / Sync NTP / HWClock on Enterprise Linux (RH/OEL)

Another one of my public notes,


#First Configure your ntp servers for the ntp daemon.
vim /etc/ntp.conf

#Chose the options that are going to work best in your case
#We usualy remove the local clock entry and add two new ntp servers
#Add your local / remote ntp server like this.
#server [server address, either hostname or ip]
server 10.0.0.2 #or
server hostname.domain.ext
#save the settings.

#next check if the ntp daemon is started during system startup for all levels
#that enable networking (235)
chkconfig --list ntpd
ntpd            0:off   1:off   <strong>2:on    3:on</strong>    4:off    <strong>5:on</strong>    6:off

#If ness. add the ntpd daemon to the required levels using;
chkconfig --level 235 ntpd on

#Next sync the system clock with the ntp daemon. BE CAREFULL BEFORE APPYING!
#If the NTP servers time is in the PAST, this step might cause problems when forced
#Readup on ntp how to solve this situation. (yes there is a way ;)   )
ntpdate 10.0.0.2 #You own addres naturally

#Next enable the ntp daemon to take over the sync task.
service ntpd start #or
/etc/init.d/ntpd start

#To wrap it all up, its nice to sync the hardware clock as well using this step.
hwclock --systohc   (read 'System to Hardwareclock')

#in case you need to manually set the timezone correctly
#You might create the correct link from the
#usr/share/zoneinfo/?/? to the /etc/localtime Like this
ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime

#Hope this helps you as much as it helped me in the past
#Check to see if the NTPd is working can be done
#using the following command
ntpq
ntpq>peers

Add comment November 4, 2009

Installing Nvidia Quadro display drivers on Windows 7 Professional.

Oke, first off this I will not guarantee that this will not cause any problems in the future, or that this method will work for you!
As you might have noticed there are no supported Quadro drivers for windows 7 at this very moment, But do check the vendor site for any updates before attempting this work arround
.

When to apply
1. Setup halts with an error stating the opperating system isnt correct.

What to try first?
1. Try the Vista Drivers first, they usually install without any error messages. This is still no guarantee that the driver will function properly.

WARNING!
If your display isnt working afterward, do use the “Savemode” option (F8/boot options) to rollback the driver installation. Be sure to understand this before attempting the installation. Creating a restore point might also work out for you.

Work-Arround
1. oke, download the drivers for your system (Mine where on the Dell site as expected ;-)
2. Unpack the drivers to your disk (c:\dell\drivers\#####\, or c:\NVIDIA\)
3. Find the “Setup.exe” file
4. Rightclick it, and find the tab compatibility
5. Select “Windows Vista [distr.] SP3″
6. Select Apply > Ok.
7. Rightclick the setup.exe again (if the next option doesnt show, press hold the left shift key while right clicking)
8. Select “Run as administrator”
9. Follow the Installer, and reboot afterward as usual.

Any keynotes, other solutions, other sources? Please be so kind to share them :)

Good Luck and hope this helped ;-)

1 comment November 2, 2009

Altering the Nagios daemon startup script to include NDO.

previously I wrote an article on how to create a deamon script for ndo. But when you are using Centreon the only “nice” way to do this is by altering the Nagios startupscript to include the ndo part.

Here is what i have done to make this possible.

First i wrote a function to find the PIDs for the ndo deamon process based on a specific config. In this one the config is hardcoded,
but you might also replace the $NagiosNdoConfig with $1 instead and call the function like;

getNdoPid “/usr/local/nagios/etc/yourconfig.cfg”

getNdoPid ()
{
 #Declare a var containing the correct ndo PID, there are processes being forked from ndo so we need to
 #do some awk filtering also to fetch the correct one.
 #Not that the parent process always has a parent pid "1" so we use that to filter the parent from the childs.
 ndoPID=`ps -ef | grep $NagiosNdoConf | grep "?" | awk -F ' '  '{if($3 == '1') print $2}'`
        #next we validate if we got an pid returned to us, and fill a wrapper that we will use like $? that ill convieniently call "ls" LastState.
        if [[ "$ndoPID" == '' ]]; then
            ls=1;
        else
            ls=0;
        fi
}

Next using the getNdoPid function u wrote another two functions to start and to stop the ndo daemon. I choose this method so i can include these function inside the existing start stop scripting used by nagios. In effect when you start nagios, th start case select is used which will call our ndo start script.

The ndo kill function

kill_ndo ()
{
        #Find the actual PID
        if [[ "$ndoPID" == '' ]]; then
             #No process running to kill...
             ls=0;
        else
             kill $ndoPID;
             sleep 2 #parent needs some time to kill the child processes if any
             getNdoPid
             if [[ "$ls" == '1' ]]; then
                   ls=0;
             else
                   ls=1;
             fi
        fi
}

and the start portion…
The ndo start function

start_ndo ()
{
        #always make sure ndo isnt running!
        $NagiosNdo -c $NagiosNdoConf;
        if [[ "$?" == '0' ]]; then
                ls=0;
        else
                ls=1;
        fi
}

Again i am using the ls (laststate) var to save the last state of the executed command. This is important because the state of a command can only be tested right after execution of that command. by using the ls var i make sure i am always testing the correct result. this is because the $? is also overwritten when performing an var assignment, if test etc.

Next I added a few vars for configuration, stuff like where the ndo2db bin is located, and the config file.

NagiosNdo=/usr/sbin/ndo2db;
NagiosNdoConf=/usr/local/nagios/etc/ndo2db.cfg;

naturally the NDO bin could also be found like;
NagiosNdo=`which ndo2db`;
Bu this will require the ndo2db bin to be somewhere in the path var. We are not sure this is always the case because there is no consensus on where these nagios bins should be placed. This may vary from distro to distro and from user to user. In my case, it being placed inside /user/bin this whould also work.

I also extended the functionality of the startupscript by adding new options to start, stop and restart the ndo deamon by using the nagios startupscript. This is what i did.

inside the “case” statement where the “/etc/init.d/nagios args” are tested i added some new options namely “startndo, stopndo, restartndo” and this is what it looks like.

For the option “/etc/init.d/nagios startndo”

 startndo)
                getNdoPid
                if [[ "$ls" == '1' ]]; then
                    start_ndo
                    if [[ "$ls" == '0' ]]; then
                        echo 'NDO deamon started succesfully';
                        exit 0;
                    else
                        echo 'Failed to start NDO, check your logging for more info';
                        exit 1;
                    fi
                else
                    echo "Ndo deamon allready running with PID : $ndoPID";
                    exit 1;
                fi
                ;;

for the “/etc/init.d/nagios stopndo” option

stopndo)
                getNdoPid
                if [[ "$ls" == '1' ]]; then
                     echo "$ls";
                     exit 1;
                else
                     kill_ndo
                     sleep 2 #it needs some time to kill the childs (that get ppid 1 when the parent quits)
                     getNdoPid
                     if [[ "$ls" == '1' ]]; then
                         echo "Ndo stopped succesfully";
                         exit 0;
                     else
                         echo "Unable to kill ndo, please review you logging";
                         exit 1;
                     fi
                fi
                ;;

And a restart option “/etc/init.d/nagios restartndo”

restartndo)
                $0 stopndo
                $0 startndo
                ;;

To include the start and stop options in the nagios start and stop process all you need to do is add the start and or stop options in there.
Here is an example

 start)
                echo -n "Starting nagios:"
                $NagiosBin -v $NagiosCfgFile > /dev/null 2>&1;
                if [ $? -eq 0 ]; then
                        su - $NagiosUser -c "touch $NagiosVarDir/nagios.log $NagiosRetentionFile"
                        rm -f $NagiosCommandFile
                        touch $NagiosRunFile
                        chown $NagiosUser:$NagiosGroup $NagiosRunFile
                        $NagiosBin -d $NagiosCfgFile
                        if [ -d $NagiosLockDir ]; then touch $NagiosLockDir/$NagiosLockFile; fi
                        #chmod 777 $NagiosCommandFile
                        start_ndo
                        echo " done."
                        exit 0
                else
                        echo "CONFIG ERROR!  Start aborted.  Check your Nagios configuration."
                        exit 1
                fi
                ;;
#Stop portion
stop)
                echo -n "Stopping nagios: "

                pid_nagios
                killproc_nagios nagios
                kill_ndo
                # now we have to wait for nagios to exit and remove its
                # own NagiosRunFile, otherwise a following "start" could
                # happen, and then the exiting nagios will remove the
                # new NagiosRunFile, allowing multiple nagios daemons
                # to (sooner or later) run - John Sellens
                #echo -n 'Waiting for nagios to exit .'
                for i in 1 2 3 4 5 6 7 8 9 10 ; do
                    if status_nagios > /dev/null; then
                        echo -n '.'
                        sleep 1
                    else
                        break
                    fi
                done
                if status_nagios > /dev/null; then
                    echo ''
                    echo 'Warning - nagios did not exit in a timely manner'
                else
                    echo 'done.'
                fi

                rm -f $NagiosStatusFile $NagiosRunFile $NagiosLockDir/$NagiosLockFile $NagiosCommandFile
                ;;

        status)
                pid_nagios
                printstatus_nagios nagios
                ;;

Now when i start and stop nagios using the centreon “start / stop / reload” options my ndo daemon is also started / stopped. Ps. This manual uses Nagios 3.0 and Centreon 2.2

This is what a restart looks like ;-)

[root@UX127 var]# service nagios restartndo
Ndo stopped succesfully
NDO deamon started succesfully

Rgrds,

Add comment August 14, 2009

Previous Posts


Meta

Category Cloud

Apache 2.2 Windows centreon Exchange Server Linux Linux Commands Nagios / Centreon Network Monitoring Perl PHP Tomcat Tooling Uncategorized VBS VMWare Windows 7 Professional Windows Command Line Windows Compontents Windows Server Windows XP SP2

My Tweets

Top Clicks