cpu usage over time

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
bladezz
Posts: 19
Joined: Thu Mar 10, 2016 11:28 am

Re: cpu usage over time

Post by bladezz »

please find the bischeckd config found in the /opt/socbox/addons/bischeck/bin of nagios server

Code: Select all

#!/bin/sh
#
# Copyright (C) 2009 Anders Håål, Ingenjorsbyn AB
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# chkconfig: 345 99 10
# description: bischeckd init script
#
#
### BEGIN INIT INFO
# Provides:          bischeckd
# Required-Start:    $syslog $network
# Required-Stop:     $syslog $network
# Default-Start:     3 4 5
# Default-Stop:      0 1 2 6
# Short-Description: Start bischeck daemon at boot time
### END INIT INFO

JAVA_HOME=
PATH=$JAVA_HOME/bin:$PATH

bishome=/opt/socbox/addons/bischeck
user=nagios
DISTRO=centos

processName=com.ingby.socbox.bischeck.Execute

pidFile=$(su $user -c "$bishome/bin/bischeck configuration.ConfigurationManager -p" | grep PidFile | cut -d: -f2)

isrunning() {
    ps -fu $user | grep $1 | grep java| tr -s " "| cut -f2 -d" " 
}

# Source function library.
if [ -f /etc/init.d/functions ] ; then
    . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
    . /etc/rc.d/init.d/functions
elif [ -f /lib/lsb/init-functions ] ; then
    . /lib/lsb/init-functions
else
    exit 0
fi

# Avoid using root's TMPDIR
unset TMPDIR
RETVAL=0


retstatus() {
     RETVAL=$1
     if [ $RETVAL -eq 0 ] ; then
        if [ "$DISTRO" = "debian" -o "$DISTRO" = "ubuntu" ] ; then
          log_end_msg $RETVAL
        elif [ "$DISTRO" = "rhel" -o "$DISTRO" = "rh" -o "$DISTRO" = "centos" ] ; then
          echo_success
          echo
        else 
          echo $RETVAL 
        fi
    else
        if [ "$DISTRO" = "debian" -o "$DISTRO" = "ubuntu" ] ; then
          log_end_msg $RETVAL
        elif [ "$DISTRO" = "rhel" -o "$DISTRO" = "rh" -o "$DISTRO" = "centos" ] ; then
          echo_failure
          echo
        else 
          echo $RETVAL 
        fi
    fi
}

start() {
    echo -n "bischeckd startup"
    status=`isrunning $processName` 
    if [ "x$status" = "x" ] ; then
        rm -f $pidFile
        
        su $user -c "$bishome/bin/bischeck Execute -d > /dev/null 2>&1" &
        
        sleep 5
        status=`isrunning $processName`
        
        echo $status > $pidFile
        chown $user:`id -gn $user` $pidFile
        
        status=`isrunning $processName`
        if [ ! "x$status" = "x" ] ; then
            RETVAL=0
        else
            RETVAL=1
        fi
    else
       RETVAL=2
    fi
    
    retstatus $RETVAL
}

stop() {
    echo -n "bischeck stopping"
    status=`isrunning $processName` 
    if [ ! "x$status" = "x" ] ; then
        kill `cat $pidFile`
        sleep 5
        status=`isrunning $processName`
        if [ "x$status" = "x" ] ; then
            RETVAL=0
        else
            RETVAL=1
        fi
    else
        RETVAL=2
    fi

    retstatus $RETVAL

}

status() {
    status=`isrunning $processName` 
    if [  ! "x$status" = "x" ] ; then
        echo -n "$scriptName is running, pid $status"
        RETVAL=0
    else
        echo -n "$scriptName is not running"
        RETVAL=1
    fi
    retstatus $RETVAL
}

case "$1" in
    start)
        start
        ;;
    stop) 
        stop
        ;;
    status)
        status 
        ;;
    pidstatus)
        status=`isrunning $processName` 
        if [  ! "x$status" = "x" ] ; then
           echo $status
        else
           echo "not running"
        fi
        ;;
    restart)
        stop  
        start
        ;;
    *)
        echo "Usage: $0 {start|stop|status|pidstatus|restart}"
        exit 1
esac

if [ $RETVAL -eq 0 ] ; then
    exit 0
else
    exit 1
fi

I also have a bischeck file in the same path 

#!/bin/sh
#
# Copyright (C) 2009 Anders Håål, Ingenjorsbyn AB
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# The program starts any java class with main method located in the package
# com.ingby.socbox.bischeck
# The program is called from the init script bischeckd, but can also be
# used directly from command line
#

program=$1
shift
arg=$@

export LC_ALL=en_US.UTF-8

bishome=/opt/socbox/addons/bischeck

port=
serverip=
auth=false 
    
#JMX settings
if [ "x$port" != "x" -a "x$serverip" != "x" -a "x$auth" != "x" ]  ; then
    jmxport=-Dcom.sun.management.jmxremote.port=$port
    jmxrmiserver=-Djava.rmi.server.hostname=$serverip
    jmxauth=-Dcom.sun.management.jmxremote.authenticate=$auth 
    jmxssl=-Dcom.sun.management.jmxremote.ssl=false 
    jmxpasswd=-Dcom.sun.management.jmxremote.password.file=$bishome/etc/jmxremote.password
    jmxaccess=-Dcom.sun.management.jmxremote.access.file=$bishome/etc/jmxremote.access
    
    jmx="$jmxport $jmxrmiserver $jmxssl $jmxauth $jmxpasswd $jmxaccess"
fi

# resources must be before the bischeck-x.x.x.jar in the classpath
classpath=$bishome/resources:$bishome:$bishome/lib/*:$bishome/customlib/*

if [ "x$program" = "xExecute" -a "x$arg" = "x-d" ] ; then
  java $jmx -Dbishome=$bishome -classpath $classpath com.ingby.socbox.bischeck.$program $arg
#  java -Dbishome=$bishome -javaagent:$bishome/lib/jolokia-jvm-1.2.0-agent.jar=config=$bishome/resources/jolokia.conf -classpath $classpath com.ingby.socbox.bischeck.$program $arg
else
  java -Dbishome=$bishome -classpath $classpath com.ingby.socbox.bischeck.$program $arg
fi
Last edited by tmcdonald on Wed May 18, 2016 12:20 pm, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: cpu usage over time

Post by rkennedy »

Just to clarify, are you running Nagios XI, or Core with Socbox?
https://exchange.nagios.org/directory/D ... ox/details
Former Nagios Employee
bladezz
Posts: 19
Joined: Thu Mar 10, 2016 11:28 am

Re: cpu usage over time

Post by bladezz »

I was using the nagiosxi demo this has now expired so i am just using the core
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: cpu usage over time

Post by tmcdonald »

Honestly that doc is about 2 years old and the version of bischeck might not even work with the latest versions of Java. I can't off the top of my head remember the version I used but I think it was in the 7x range. I'll likely need to task one of the guys here with testing that doc and possibly (likely) updating it.
Former Nagios employee
bladezz
Posts: 19
Joined: Thu Mar 10, 2016 11:28 am

Re: cpu usage over time

Post by bladezz »

I have also tried using the latest bischeck from the bischeck website and still no luck i will downgrade java and see what happens it would be good to get some feed back from nagios once the documentation has been updated as the company i work for are just waiting on this to sign off the purchase of nagios as they want it proven that nagios can monitor things like cpu ramping over time, drive space being used over time. If there are any other ideas on how to do this i would be happy to hear about it.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: cpu usage over time

Post by tmcdonald »

Definitely keep us posted, but I have tasked @ischwartz with updating the doc to use the latest versions. I don't have an ETA, but this thread is linked in the task so we can update when we know more.
Former Nagios employee
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: cpu usage over time

Post by lmiltchev »

The " Integrating the Bischeck Plugin Extension with Nagios XI" document has been updated.
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!
thenodon
Posts: 1
Joined: Fri Dec 27, 2013 6:47 pm

Re: cpu usage over time

Post by thenodon »

If you still have a problem, you can send it to the bischeck mail list that you find under support on the http://www.bischeck.org web site or make an issue on https://github.com/thenodon/bischeck.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: cpu usage over time

Post by mcapra »

Thanks @thenodon !
Former Nagios employee
https://www.mcapra.com/
Locked