Nagios ping fails

I recently setup NagiosXI with their provided amazon ami. It was very simple to setup and everything looked good. Added a couple servers and they all could not be pinged from Nagios. I couldn’t ping them from Nagios’ ping tool. I could ping them from the command line so I knew it was a configuration error.

First I tried:

$ /usr/local/nagios/libexec/check_ping -H www.google.com -c 100,90% -w 100,90%
CRITICAL - Network Unreachable (www.google.com)

Then I saw I needed to add the -4 to the command.

$ sudo vim /usr/local/nagios/etc/commands.cfg

Go to line 221 and add the “-4”

define command {
       command_name                             check_ping
       command_line                             $USER1$/check_ping -4 -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
}

Then you’ll need to restart Nagios.

$ sudo service nagios restart

Error starting Tomcat7 “no JDK found – please set JAVA_HOME”

After I had set JAVA_HOME in the /etc/profile

export JAVA_HOME=/usr/lib/jvm/java-7-oracle/bin/java

But Tomcat wasn’t happy with that. So I went to Tomcat configuration directly. File: /etc/default/tomcat7

$ vim /etc/default/tomcat7
...

# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.5. If JAVA_HOME is not set, some common directories for
# OpenJDK, the Sun JDK, and various J2SE 1.5 versions are tried.
#JAVA_HOME=/usr/lib/jvm/openjdk-6-jdk
JAVA_HOME=/usr/lib/jvm/java-7-oracle

...

How to install java 7 on debian

HOW TO INSTALL JAVA 7 ON DEBIAN 7

Debian is my distro of choice for servers, but due to licencing issues it cannot provide Oracle Java 7+ in the repos. Personally Oracle needs to undo their restrictive licensing on a VERY popular language.

Need to add an older repository that has the stuff we need:

sudo su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update

This adds the packages that contain java7 by oracle.

Install:

sudo apt-get install oracle-java7-installer

Then you’ll see a couple of screens asking you to accept their license. It’s fine, just accept both screens and it will now install.

Now you’ll want to make sure java 7 is default.

sudo apt-get install oracle-java7-set-default

Verification

$ java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

Thanks to the blog that had this information originally. Please visit them and give them a little link juice. SOURCE