Nagios Plugin for Cacti (NPC) 2.x - Preview

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

Existing NPC versions can support Nagios 3.x ?
Which NPC version is latest one and where is it?
I think time to create a cacti plugin repository.
Right?
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

TFC wrote:Existing NPC versions can support Nagios 3.x ?


Yes
TFC wrote:Which NPC version is latest one and where is it?
http://trac2.assembla.com/npc

Cheers,
Billy
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

Ok. thanx..
But, I have another question.
I have a nagios 3.x and I still use it.
But I didnt install ndoutil at begining. If I install now, will be any problem existin my nagios structure?
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

TFC wrote:Ok. thanx..
But, I have another question.
I have a nagios 3.x and I still use it.
But I didnt install ndoutil at begining. If I install now, will be any problem existin my nagios structure?
No. ndoutils gets installed as a nagios module. if for some reason it made your nagios stop working then just remove the module although ndoutils is written by nagios author and works well with nagios.

Cheers,
Billy
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

I asked bec. I have a nagios and I collect the logs of it for erformance KPI. If there is any risk to destroy them, I forget the NPC.
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

Hi,
I install ndo2db and set config files etc. acording to nagios' and your documents But nothing change in npc tab on cacti. I look at the nagios.log
I see that:
ndomod: Still unable to connect to data sink. 17736 items lost, 5000 queued items to flush.
and in ndo2db.cfg file, there is a config like that:

Code: Select all

db_servertype=mysql
db_host=localhost
But my cacti runs on another server. Should I change to db_servertype as cacti server IP address instead of localhost?
...
Ok change it . But still same error I get:
[1226393109] ndomod: Shutdown complete.
[1226393109] Event broker module '/usr/local/nagios/bin/ndomod-3x.o' deinitialized successfully.
[1226393109] ndomod: NDOMOD 1.4b7 (10-31-2007) Copyright (c) 2005-2007 Ethan Galstad (nagios@nagios.org)
[1226393109] ndomod: Could not open data sink! I'll keep trying, but some output may get lost...
[1226393109] Event broker module '/usr/local/nagios/bin/ndomod-3x.o' initialized successfully.
[1226393125] ndomod: Still unable to connect to data sink. 7261 items lost, 5000 queued items to flush.
[1226393141] ndomod: Still unable to connect to data sink. 7461 items lost, 5000 queued items to flush.
Then , I check ndomod.cfg:
# OUTPUT
# This option determines the name and path of the file or UNIX domain
# socket to which output will be sent if the output type option specified
# above is "file" or "unixsocket", respectively. If the output type
# option is "tcpsocket", this option is used to specify the IP address
# of fully qualified domain name of the host that the module should
# connect to for sending output.

#output=/usr/local/nagios/var/ndo.dat
output=127.0.0.1
#output=/usr/local/nagios/var/ndo.sock
SO we use tcpsocket, and my cacti runs on another server; is this IP address must be cacti server IP address?
.....
I select 127.0.0.1 and in nagios.log something changes:
[1226395444] ndomod: Successfully reconnected to data sink! 363 items lost, 5000 queued items to flush.
[1226395444] ndomod: Error writing to data sink! Some output may get lost. 4584 queued items to flush.
Note that:
In nagios machine there is no nagios db. Should I create?
What is wrong?
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

It is fine that the cacti database is on another host. Just make sure that the IP address and credentials are correct in ndo2db.cfg.
[1226393125] ndomod: Still unable to connect to data sink. 7261 items lost, 5000 queued items to flush.
The datasink that ndomod is referring to in the log entry above is not the database but rather the ndo2db daemon. Is ndo2db started?

Here is the data flow:

Nagios -> ndomod (nagios module) -> ndo2db (daemon) -> MySQL

Nagios communicates to ndomod via the event broker api and is configured in nagios.cfg. ndomod should be talking to ndo2db via tcp socket on the localhost port 5668. ndo2db should be listening on localhost port 5668. It does not matter where the cacti database is as long as it is accessible on the network.

Now you need to be sure to start ndo2db. I had problems with it dying so I put it under control of init and I show this in the last couple steps of the quick start guide.
[07:08:40 - bgunn@exlap600 - monitor: ~]$ ps -ef | grep ndo2db
nagios 27324 1 0 Aug04 ? 00:00:00 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg

Hope this helps,
Billy
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

oot@yonyim1:/usr/local/nagios/var# /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg
Could not bind socket: Address already in use
I use ubuntu 8.04.But i am not mater about linux.
And u wrote down in quick start installation:
NOTE: I had some problems with the ndo2db process dying (regularly) on Fedora Core 7. To get around that I setup the process to respawn via init. If you have trouble with the daemon dying you can add the following line to /etc/inittab

ndo:345:respawn:/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
After editing inittab issue the following command:

telinit Q
You may see messages like the following in your syslog when using init to respawn ndo2db:

Apr 19 11:11:55 acid init: Id "ndo" respawning too fast: disabled for 5 minutes
I dont know how to do these steps in ubuntu actually.
:(
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

Do this:

Code: Select all

ps -ef | grep ndo2b
If its running already then thats why the port is in use. Kill and restart ndo2db. You need to make sure the daemon starts successfully. Before restarting it enable debugging in ndo2db.cfg. Make sure to specify the logfile path.

After restarting ndo2db watch the debug log for any errors.
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

Here is my output:
root@yonyim1:/home/awtadm# /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg
root@yonyim1:/home/awtadm# ps -ef |grep ndo2db
nagios 12102 1 0 16:15 ? 00:00:00 /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg
root 12176 8536 0 16:15 pts/0 00:00:00 grep ndo2db
root@yonyim1:/home/awtadm# tail -f /usr/local/nagios/var/ndo2db.debug
As you see debug file is empty!
And here is nagios.log:
root@yonyim1:/home/awtadm# tail -f /usr/local/nagios/var/nagios.log |grep ndomod
[1226412967] ndomod: Successfully reconnected to data sink! 28 items lost, 5000 queued items to flush.
[1226412967] ndomod: Error writing to data sink! Some output may get lost. 4375 queued items to flush.
And here is my ndo2db.cfg file:
ndo2db_user=nagios
ndo2db_group=nagios

socket_type=tcp
socket_name=/usr/local/nagios/var/ndo.sock

tcp_port=5668

db_servertype=mysql
db_host=10.65.8.48 << my cacti server
db_port=3306
db_name=cacti
db_prefix=npc_
db_user=cacti
db_pass=cacti123

max_timedevents_age=1440
max_systemcommands_age=10080
max_servicechecks_age=10080
max_hostchecks_age=10080
max_eventhandlers_age=44640

debug_level=-1
debug_verbosity=1
debug_file=/usr/local/nagios/var/ndo2db.debug
max_debug_file_size=1000000
And finally here is my ndomod.cfg file:
instance_name=default
output_type=tcpsocket
output=127.0.0.1 << my nagios server (should be cacti server?)
tcp_port=5668

output_buffer_items=5000
buffer_file=/usr/local/nagios/var/ndomod.tmp

file_rotation_interval=14400
file_rotation_timeout=60

reconnect_interval=15
reconnect_warning_interval=15

data_processing_options=-1
config_output_options=2
Is there any incorrect item in these files?
I didnt see any item in my dashboard. I can see statusmap. But no host no service etc.
Note again: I have only one db called cacti on cacti server.
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

SOLVED!
Ok I found the error source.
Nagios couldn't connect to cacti DB.
Then, in /etc/mysql/my.cnf, I commented out the line

Code: Select all

[...]
#bind-address           = 127.0.0.1
[...]
After that everything is ok now :)
For ubuntu this link has very good installation directives:
http://www.howtoforge.com/perfect_setup_ubuntu_6.06_p4
hiptoss
Posts: 3
Joined: Fri Nov 14, 2008 10:19 pm

Post by hiptoss »

So, I am having difficulty understanding how to get NPC to read the database entries that ndo2db is writing. I have ndoutils setup, and I have verified that there is data getting written properly to mysql. I have cacti setup, and the plugin architecture installed with NPC as a plugin. NPC is installed, but I have an empty dashboard which would seem to indicate that NPC doesn't know where to read the database information.

Is there somewhere to configure the database, login, password, etc so that NPC knows where to look for it's data?

This project looks amazing, and I'd really like to take advantage of it. Any help is greatly appreciated.

EDIT: Nevermind. I didn't realize that the cacti database was modified with the required tables, prefixed with npc_. I was using a different database, and that was causing the problem.
tumutbound
Posts: 2
Joined: Tue Nov 18, 2008 5:12 am

n2c cant's see templates

Post by tumutbound »

I have everything installed and working (nagios, ndoutils, cacti) and I can see the hosts
in npc.
If I try to use n2c to import hosts, I can see the hostgroups but no templates are visible.
I'm assuming that the standard Cacti templates would be visible - or do I have to create my own?
labby
Posts: 2
Joined: Tue Dec 02, 2008 9:58 am

Post by labby »

Hello divagater, first thanks for the good work, the plugin is really nice work and integrates nicely with Cacti.

I haven't used it much, but I gave your plugin a try because I wanted to be able to graph all the data collected by nagios instead of using a seperate tool such as zabbix.

It seems to me that right now it's not possible to directly graph the data collected by nagios, am I right or am I missing something?

Is this a feature? or a future goal?
* Must import (graph) Nagios performance data (semi-auto)

Thanks for your time and effort!

Nick
labby
Posts: 2
Joined: Tue Dec 02, 2008 9:58 am

Re: n2c cant's see templates

Post by labby »

tumutbound wrote:I have everything installed and working (nagios, ndoutils, cacti) and I can see the hosts
in npc.
If I try to use n2c to import hosts, I can see the hostgroups but no templates are visible.
I'm assuming that the standard Cacti templates would be visible - or do I have to create my own?
Have you tried using Internet Explorer? I had issues with the N2C with chrome and Firefox 3, the one that worked best was IE8...
An arrow with a dropdown box should appear when you click under template next to a hostgroup...
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest