NPC: Poller[0] DEBUG [NpcHostsController]

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
shahsaifi
Posts: 34
Joined: Tue May 10, 2011 1:09 am
Location: New Delhi, India
Contact:

NPC: Poller[0] DEBUG [NpcHostsController]

Post by shahsaifi »

Dear Friends,

I have been running into npc issue with cacti. it shows NPC tab and data but Nagios status is "off" :(

Code: Select all

OS: CentOS release 5.6 x86_64
Cacti: 0.8.7g
RRD: 1.4.4
Apache: httpd-2.2.3-45
It is throwing following errors in cacti.logs:

Code: Select all

06/01/2011 05:45:43 AM - NPC: Poller[0] DEBUG [NpcHostsController] (getHosts) - Script execution time: 0.03 seconds
06/01/2011 05:45:43 AM - NPC: Poller[0] DEBUG [NpcServicesController] (getServices) - Script execution time: 0.09 seconds
06/01/2011 05:45:43 AM - NPC: Poller[0] DEBUG [NpcServicegroupsController] (getServicegroups) - Method execution time: 0.02 seconds
06/01/2011 05:45:43 AM - NPC: Poller[0] DEBUG [NpcServicegroupsController] (getServicegroupServiceStatus) - Method execution time: 0.02 seconds
06/01/2011 05:45:43 AM - NPC: Poller[0] DEBUG [NpcServicegroupsController] (getServicegroupServiceStatus) - Script execution time: 0.02 seconds
06/01/2011 05:45:43 AM - NPC: Poller[0] DEBUG [NpcHostgroupsController] (getHostgroupServiceStatus) - Script execution time: 0.04 seconds
06/01/2011 05:45:43 AM - NPC: Poller[0] DEBUG [NpcServicegroupsController] (getServicegroups) - Method execution time: 0.02 seconds
06/01/2011 05:45:43 AM - NPC: Poller[0] DEBUG [NpcServicegroupsController] (getHostStatusPortlet) - Method execution time: 0.02 seconds
06/01/2011 05:45:43 AM - NPC: Poller[0] DEBUG [NpcServicegroupsController] (getHostStatusPortlet) - Script execution time: 0.02 seconds
06/01/2011 05:45:43 AM - NPC: Poller[0] DEBUG [NpcHostgroupsController] (getHostgroupHostStatus) - Script execution time: 0.02 seconds
06/01/2011 05:46:12 AM - NPC: Poller[0] DEBUG [NpcNagiosController] (getProgramStatus) - Script execution time: 0.02 seconds
06/01/2011 05:46:12 AM - NPC: Poller[0] DEBUG [NpcHostsController] (summary) - Script execution time: 0.02 seconds
06/01/2011 05:46:12 AM - NPC: Poller[0] DEBUG [NpcServicesController] (summary) - Script execution time: 0.02 seconds
06/01/2011 05:46:13 AM - NPC: Poller[0] DEBUG [NpcHostsController] (getHosts) - Script execution time: 0.03 seconds
06/01/2011 05:46:13 AM - NPC: Poller[0] DEBUG [NpcServicesController] (getServices) - Script execution time: 0.04 seconds
06/01/2011 05:46:13 AM - NPC: Poller[0] DEBUG [NpcServicegroupsController] (getServicegroups) - Method execution time: 0.02 seconds
06/01/2011 05:46:13 AM - NPC: Poller[0] DEBUG [NpcServicegroupsController] (getServicegroupServiceStatus) - Method execution time: 0.02 seconds
06/01/2011 05:46:13 AM - NPC: Poller[0] DEBUG [NpcServicegroupsController] (getServicegroupServiceStatus) - Script execution time: 0.02 seconds
06/01/2011 05:46:13 AM - NPC: Poller[0] DEBUG [NpcHostgroupsController] (getHostgroupServiceStatus) - Script execution time: 0.05 seconds
06/01/2011 05:46:13 AM - NPC: Poller[0] DEBUG [NpcServicegroupsController] (getServicegroups) - Method execution time: 0.02 seconds
06/01/2011 05:46:13 AM - NPC: Poller[0] DEBUG [NpcServicegroupsController] (getHostStatusPortlet) - Method execution time: 0.02 seconds
06/01/2011 05:46:13 AM - NPC: Poller[0] DEBUG [NpcServicegroupsController] (getHostStatusPortlet) - Script execution time: 0.02 seconds
06/01/2011 05:46:13 AM - NPC: Poller[0] DEBUG [NpcHostgroupsController] (getHostgroupHostStatus) - Script execution time: 0.02 seconds
Attachments
npc.png
npc.png (43.55 KiB) Viewed 1203 times
Greetings,
Shah
shahsaifi
Posts: 34
Joined: Tue May 10, 2011 1:09 am
Location: New Delhi, India
Contact:

Re: NPC: Poller[0] DEBUG [NpcHostsController]

Post by shahsaifi »

Friends,

Please help me in resolving above issue :(


Thanks in advance!
Greetings,
Shah
DWAyotte
Posts: 32
Joined: Wed Mar 28, 2007 1:37 pm

Re: NPC: Poller[0] DEBUG [NpcHostsController]

Post by DWAyotte »

I have just spent a lot of time working with NPC and whenever I had this issue happen to me it was because ndo2db daemon was not running.

You can launch it manually by the following command (adjust your paths as needed).

/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg

You can setup an init script to start it automatically when your server reboots. I have done everything on ubuntu VMs, so I am not sure if this script will be compatible with centos, but I am willing to be it will be. You may just want to browse over all the paths and make sure they point to the correct locations according to your build. You can also google for other examples. I have seen a few in the last few days. Here is the one I use, it works great.

Code: Select all

#!/bin/sh
#
#
# chkconfig: 345 99 01
# description: Nagios to mysql
#
# Author : Gaëtan Lucas
# Realase : 07/02/08
# Version : 0.1 b
# File : ndo2db
# Description: Starts and stops the Ndo2db daemon
#              used to provide network services status in a database.
#

status_ndo ()
{
        if ps -p $NdoPID > /dev/null 2>&1; then
                return 0
        else
                return 1
        fi

        return 1
}

printstatus_ndo()
{
        if status_ndo $1 $2; then
                echo "ndo (pid $NdoPID) is running..."
        else
                echo "ndo is not running"
        fi
}

killproc_ndo ()
{
        echo "kill $2 $NdoPID"
        kill $2 $NdoPID
}

pid_ndo ()
{
        if test ! -f $NdoRunFile; then
                echo "No lock file found in $NdoRunFile"
                echo -n "         checking runing process..."
                NdoPID=`ps h -C ndo2db -o pid`
                if [ -z "$NdoPID" ]; then
                        echo "     No ndo2db process found"
                        exit 1
                else
                        echo "     found process pid: $NdoPID"
                        echo -n "         reinit $NdoRunFile ..."
                        touch $NdoRunFile
                        chown $NdoUser:$NdoGroup $NdoRunFile
                        echo "$NdoPID" > $NdoRunFile
                        echo "     done"
                fi
        fi

        NdoPID=`head $NdoRunFile`
}

# Source function library
# Solaris doesn't have an rc.d directory, so do a test first
if [ -f /etc/rc.d/init.d/functions ]; then
        . /etc/rc.d/init.d/functions
elif [ -f /etc/init.d/functions ]; then
        . /etc/init.d/functions
fi

prefix=/usr/local/nagios
exec_prefix=${prefix}
NdoBin=${exec_prefix}/bin/ndo2db
NdoCfgFile=${prefix}/etc/ndo2db.cfg
NdoRunFile=${prefix}/var/ndo2db.run
NdoLockDir=/var/lock/subsys
NdoLockFile=ndo2db.lock
NdoUser=nagios
NdoGroup=nagios

# Check that ndo exists.
if [ ! -f $NdoBin ]; then
   echo "Executable file $NdoBin not found.  Exiting."
   exit 1
fi

# Check that ndo.cfg exists.
if [ ! -f $NdoCfgFile ]; then
   echo "Configuration file $NdoCfgFile not found.  Exiting."
   exit 1
fi

# See how we were called.
case "$1" in

        start)
                echo -n "Starting ndo:"
                touch $NdoRunFile
                chown $NdoUser:$NdoGroup $NdoRunFile
                $NdoBin -c $NdoCfgFile
                if [ -d $NdoLockDir ]; then
                        touch $NdoLockDir/$NdoLockFile;
                fi
                ps h -C ndo2db -o pid > $NdoRunFile
                if [ $? -eq 0 ]; then
                        echo " done."
                        exit 0
                else
                        echo " failed."
                        $0 stop
                        exit 1
                fi
                ;;

        stop)
                echo -n "Stopping ndo: "

                pid_ndo
                killproc_ndo

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

                rm -f $NdoRunFile $NdoLockDir/$NdoLockFile
                ;;

        status)
                pid_ndo
                printstatus_ndo ndo
                ;;

        restart)
                $0 stop
                $0 start
                ;;

        *)
                echo "Usage: ndo {start|stop|restart|status}"
                exit 1
                ;;
esac
# End of this script
FYI, the results of the NPC debug actually look fine, they aren't errors just informational.

Hope this gets you working. :)
shahsaifi
Posts: 34
Joined: Tue May 10, 2011 1:09 am
Location: New Delhi, India
Contact:

Re: NPC: Poller[0] DEBUG [NpcHostsController]

Post by shahsaifi »

Friend,

It doesn't seem to be issue with ndoutils because data is populating in tables. I need to find out the exact reason of it and will post soon.

Thanks for updating you solution.
Greetings,
Shah
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests