Nagios Plugin for Cacti (NPC) Released

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
slander
Posts: 32
Joined: Thu Mar 16, 2006 12:01 pm

Post by slander »

I created it myelf and placed the recompiled inserter.c there - and added back the link. Still, no love.



You have an inserter.o, (the compiled one, not the source .c file) in /usr/local/nagios/module, right?
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

slander wrote: For me, that line is /usr/local/nagios/var/rw

the nagios.cmd file is a pipe. I think it will create it itself.
I don't have one - that I can find.
slander wrote: One other thing - did you remember to change the database info in the inserter source code, since that is compiled in?
Yeah, the second time. :) Well, and maybe this will make a difference: I recompiled the inserter file. Re-ran the nagios install, etc.. Then when I realized I had forgotten to change the db info I just recompiled inserter and copied it over the last one. Would that make a difference?
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

slander wrote:You have an inserter.o, (the compiled one, not the source .c file) in /usr/local/nagios/module, right?
Yeah, sorry, I do. But there wasn't a module folder until I created it...

Code: Select all

# ls -altr /usr/local/nagios/
total 3
drwxr-xr-x   2 nagios nagios 1904 Jun 19 15:37 libexec
drwxr-xr-x  13 root   root    336 Jun 22 10:19 ..
drwxrwxr-x   9 nagios nagios  360 Jun 23 12:48 share
drwxrwxr-x   2 nagios nagios  552 Jun 23 12:48 sbin
drwxrwxr-x   2 nagios nagios  104 Jun 23 12:48 bin
drwxr-xr-x   9 nagios nagios  216 Jun 23 12:52 .
drwxr-xr-x   2 root   root     80 Jun 23 12:52 modules
drwxrwxr-x   2 nagios nagios 1024 Jun 23 13:59 etc
drwxrwxr-x   4 nagios nagios  320 Jun 23 15:07 var
# ls -altr /usr/local/nagios/modules/
total 64
drwxr-xr-x  9 nagios nagios   216 Jun 23 12:52 ..
drwxr-xr-x  2 root   root      80 Jun 23 12:52 .
-rwxr-xr-x  1 root   root   61701 Jun 23 14:03 inserter.o
Perhaps chmod inserter.o? module rather than modules (its correct in nagios.cfg)?
slander
Posts: 32
Joined: Thu Mar 16, 2006 12:01 pm

Post by slander »

knobdy wrote:
slander wrote:You have an inserter.o, (the compiled one, not the source .c file) in /usr/local/nagios/module, right?
Yeah, sorry, I do. But there wasn't a module folder until I created it...

Code: Select all

# ls -altr /usr/local/nagios/
total 3
drwxr-xr-x   2 nagios nagios 1904 Jun 19 15:37 libexec
drwxr-xr-x  13 root   root    336 Jun 22 10:19 ..
drwxrwxr-x   9 nagios nagios  360 Jun 23 12:48 share
drwxrwxr-x   2 nagios nagios  552 Jun 23 12:48 sbin
drwxrwxr-x   2 nagios nagios  104 Jun 23 12:48 bin
drwxr-xr-x   9 nagios nagios  216 Jun 23 12:52 .
drwxr-xr-x   2 root   root     80 Jun 23 12:52 modules
drwxrwxr-x   2 nagios nagios 1024 Jun 23 13:59 etc
drwxrwxr-x   4 nagios nagios  320 Jun 23 15:07 var
# ls -altr /usr/local/nagios/modules/
total 64
drwxr-xr-x  9 nagios nagios   216 Jun 23 12:52 ..
drwxr-xr-x  2 root   root      80 Jun 23 12:52 .
-rwxr-xr-x  1 root   root   61701 Jun 23 14:03 inserter.o
Perhaps chmod inserter.o? module rather than modules (its correct in nagios.cfg)?
modules is correct.
your permisssions are the same as mine, should be ok.

How about, when you start nagios there should be an entry in /usr/local/nagios/var/nagios.log, something like:

[1151089984] Nagios 2.4 starting... (PID=29359)
[1151089984] LOG VERSION: 2.0
[1151089984] initializing nagios-db mysql inserter...
[1151089984] nagios-db: inserter locked into db
[1151089984] Event broker module '/usr/local/nagios/modules/inserter.o' initialized successfully.
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

bingo! Its still the db authentication... will do it again, more carefully this time.

Still not sure of myself when it comes to linux file management commands...

So, anymore development on this plugin? I just registerd on the nagios-uk forum and they've mentioned it a couple of times.

And since you guys are answering: I've got several sites running on this Apache. For Nagios I finally created a seperate vhosts file (required, apparently, in order to use another scriptalias?). Unfortunately it seems I missed something because I *appear* to be missing some of the graphics. For instance, the Nagios "Tactical Overview" page has to Network Health images on the right hand side - I only get what looks like placeholders (which appear to grow with health). The green buttons in the menu bar on the left are there, but they're called at http://url/images/greendot.gif where as the health buttons are supposd to be at http://url/nagios/images/thermok.png.
Last edited by knobdy on Fri Jun 23, 2006 4:03 pm, edited 1 time in total.
slander
Posts: 32
Joined: Thu Mar 16, 2006 12:01 pm

Post by slander »

knobdy wrote:bingo! Its still the db authentication... will do it again, more carefully this time.

Still not sure of myself when it comes to linux file management commands...

So, anymore development on this plugin? I just registerd on the nagios-uk forum and they've mentioned it a couple of times.
I am not the author - just a user of it! I would like to see some more development here too. It is a great start, and is almost there!
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

Any ideas on the image issue though? :)
woodgdo1
Posts: 2
Joined: Wed Jun 21, 2006 4:15 pm

Post by woodgdo1 »

divagater wrote:
julpie wrote:Hi,

Does anyone know why this website http://www.divagater.com/npc/ isn't running ?
Does there exist a mirror ?
Hi all. I have been away from these forums for quite a while. I apologize that the site hosting NPC went down. Some one did post NPC to this forum with the following link:

http://forums.cacti.net/download.php?id=5127

That is still the latest release available. NPC has not been abandoned. My production environemnt relies heavily on Cacti and NPC. The little company I worked for was bought buy a very big comapny a few months ago. All my spare time has been involved with integrating our technologies and since NPC worked "good enough" I have not touched it. Thats the problem with 1 man projects :)

I am currently "albeit slowly" working on a big rewrite of NPC to use the ndo2db module written by Ethan Galstad. His module will support all Nagios events and will likely stay up to date with new Nagios features. I am also trying to integrate privilege seperation so hosts or services can be viewed only by people with the appropriate permissions.

I can't promise any time frame on this. If there are any PHP/MySQL folks that are interested in helping speed this along I would be glad to collaborate.

~Billy
divagater
I may be interested in helping out a little. Mainly one of the features that I would like to implement is the passing of check result data between the two. Currently I am writing a nagios plugin that checks the rrd files from cacti for certain thresholds and reports to Nagios. I don't think an all-encompassing plugin would be feasible right now, but a couple designed to submit the standard Cacti graphs could work. I am currently working with perl since the RRD::query and RRD::poller modules work nice, but it could be ported it to PHP in theory. We could use something like that running off of the cmd.php and reporting to nagios via passive service check (nagios.cmd). It is just a matter of changing the output a little.

-Doug
gg234
Cacti User
Posts: 63
Joined: Fri Oct 07, 2005 11:14 am
Contact:

npc make error

Post by gg234 »

Hi Guys,

I am running make from modules folder i am getting the following error can some one help me i am using debian sarge which package i need to install

gcc -g -O2 -Wall -o inserter.o inserter.c -shared -I../include -I/usr/include/mysql -lmysqlclient -lz -fPIC
inserter.c:47:35: ../include/nebmodules.h: No such file or directory
inserter.c:48:37: ../include/nebcallbacks.h: No such file or directory
inserter.c:49:35: ../include/nebstructs.h: No such file or directory
inserter.c:50:31: ../include/broker.h: No such file or directory
inserter.c:53:31: ../include/config.h: No such file or directory
inserter.c:54:31: ../include/common.h: No such file or directory
inserter.c:55:31: ../include/nagios.h: No such file or directory
inserter.c:56:32: ../include/objects.h: No such file or directory
inserter.c:64: warning: type defaults to `int' in declaration of `NEB_API_VERSION'
inserter.c:64: warning: parameter names (without types) in function declaration
inserter.c:64: warning: data definition has no type or storage class
inserter.c:78: error: syntax error before '*' token
inserter.c:78: warning: type defaults to `int' in declaration of `hostgroup_list'
inserter.c:78: warning: data definition has no type or storage class
inserter.c:79: error: syntax error before '*' token
inserter.c:79: warning: type defaults to `int' in declaration of `servicegroup_list'
inserter.c:79: warning: data definition has no type or storage class
inserter.c:80: error: syntax error before '*' token
inserter.c:80: warning: type defaults to `int' in declaration of `host_list'
inserter.c:80: warning: data definition has no type or storage class
inserter.c:81: error: syntax error before '*' token
inserter.c:81: warning: type defaults to `int' in declaration of `service_list'
inserter.c:81: warning: data definition has no type or storage class
inserter.c:121: error: `FALSE' undeclared here (not in a function)
inserter.c:124: error: syntax error before "nebmodule"
inserter.c: In function `nebmodule_init':
inserter.c:130: error: `handle' undeclared (first use in this function)
inserter.c:130: error: (Each undeclared identifier is reported only once
inserter.c:130: error: for each function it appears in.)
inserter.c:132: warning: implicit declaration of function `write_to_logs_and_console'
inserter.c:132: error: `NSLOG_INFO_MESSAGE' undeclared (first use in this function)
inserter.c:132: error: `TRUE' undeclared (first use in this function)
inserter.c:137: warning: implicit declaration of function `schedule_new_event'
inserter.c:137: error: `EVENT_USER_FUNCTION' undeclared (first use in this function)
inserter.c:144: warning: implicit declaration of function `sprintf'
inserter.c:151: warning: implicit declaration of function `neb_register_callback'
inserter.c:151: error: `NEBCALLBACK_TIMED_EVENT_DATA' undeclared (first use in this function)
inserter.c: In function `nebmodule_deinit':
inserter.c:162: warning: implicit declaration of function `deschedule_event'
inserter.c:162: error: `EVENT_USER_FUNCTION' undeclared (first use in this function)
inserter.c:162: error: `TRUE' undeclared (first use in this function)
inserter.c:164: error: `NSLOG_INFO_MESSAGE' undeclared (first use in this function)
inserter.c:168: warning: implicit declaration of function `neb_deregister_callback'
inserter.c:168: error: `NEBCALLBACK_HOST_STATUS_DATA' undeclared (first use in this function)
inserter.c:169: error: `NEBCALLBACK_SERVICE_STATUS_DATA' undeclared (first use in this function)
inserter.c:170: error: `NEBCALLBACK_HOST_CHECK_DATA' undeclared (first use in this function)
inserter.c:171: error: `NEBCALLBACK_SERVICE_CHECK_DATA' undeclared (first use in this function)
inserter.c: In function `loadconfig':
inserter.c:179: error: `host' undeclared (first use in this function)
inserter.c:179: error: `hl' undeclared (first use in this function)
inserter.c:180: error: `service' undeclared (first use in this function)
inserter.c:180: error: `sl' undeclared (first use in this function)
inserter.c:181: error: `hostgroup' undeclared (first use in this function)
inserter.c:181: error: `hg' undeclared (first use in this function)
inserter.c:182: error: `servicegroup' undeclared (first use in this function)
inserter.c:182: error: `sg' undeclared (first use in this function)
inserter.c:188: error: `NEBCALLBACK_TIMED_EVENT_DATA' undeclared (first use in this function)
inserter.c:191: error: `nebstruct_timed_event_data' undeclared (first use in this function)
inserter.c:191: error: syntax error before ')' token
inserter.c:191: error: `NEBTYPE_TIMEDEVENT_ADD' undeclared (first use in this function)
inserter.c:196: warning: implicit declaration of function `asprintf'
inserter.c:256: error: `nebstruct_host_status_data' undeclared (first use in this function)
inserter.c:256: error: syntax error before "ds"
inserter.c:257: error: `ds' undeclared (first use in this function)
inserter.c:261: error: `NEBCALLBACK_HOST_STATUS_DATA' undeclared (first use in this function)
inserter.c:267: error: `NSLOG_INFO_MESSAGE' undeclared (first use in this function)
inserter.c:267: error: `TRUE' undeclared (first use in this function)
inserter.c:272: error: `nebstruct_service_status_data' undeclared (first use in this function)
inserter.c:272: error: syntax error before "ds"
inserter.c:275: error: `NEBCALLBACK_SERVICE_STATUS_DATA' undeclared (first use in this function)
inserter.c:292: error: `hostgroupmember' undeclared (first use in this function)
inserter.c:292: error: `hgm' undeclared (first use in this function)
inserter.c:347: error: `servicegroupmember' undeclared (first use in this function)
inserter.c:347: error: `sgm' undeclared (first use in this function)
inserter.c:429: error: `NEBCALLBACK_HOST_CHECK_DATA' undeclared (first use in this function)
inserter.c:430: error: `NEBCALLBACK_SERVICE_CHECK_DATA' undeclared (first use in this function)
inserter.c:253: warning: value computed is not used
inserter.c:269: warning: value computed is not used
inserter.c:290: warning: value computed is not used
inserter.c:345: warning: value computed is not used
inserter.c: In function `processCheck':
inserter.c:445: error: `NEBCALLBACK_HOST_CHECK_DATA' undeclared (first use in this function)
inserter.c:447: error: `nebstruct_host_check_data' undeclared (first use in this function)
inserter.c:447: error: `host_check_data' undeclared (first use in this function)
inserter.c:447: error: syntax error before ')' token
inserter.c:449: error: `NEBTYPE_HOSTCHECK_PROCESSED' undeclared (first use in this function)
inserter.c:464: error: `NEBCALLBACK_SERVICE_CHECK_DATA' undeclared (first use in this function)
inserter.c:466: error: `nebstruct_service_check_data' undeclared (first use in this function)
inserter.c:466: error: `service_check_data' undeclared (first use in this function)
inserter.c:466: error: syntax error before ')' token
inserter.c:468: error: `NEBTYPE_SERVICECHECK_PROCESSED' undeclared (first use in this function)
inserter.c:488: error: `NSLOG_INFO_MESSAGE' undeclared (first use in this function)
inserter.c:488: error: `TRUE' undeclared (first use in this function)
inserter.c: In function `processStatus':
inserter.c:500: error: `service' undeclared (first use in this function)
inserter.c:500: error: `tmp_service' undeclared (first use in this function)
inserter.c:501: error: `host' undeclared (first use in this function)
inserter.c:501: error: `tmp_host' undeclared (first use in this function)
inserter.c:507: error: `TRUE' undeclared (first use in this function)
inserter.c:514: error: `NEBCALLBACK_HOST_STATUS_DATA' undeclared (first use in this function)
inserter.c:516: error: `nebstruct_host_status_data' undeclared (first use in this function)
inserter.c:516: error: `host_status_data' undeclared (first use in this function)
inserter.c:516: error: syntax error before ')' token
inserter.c:517: error: syntax error before ')' token
inserter.c:560: error: `FALSE' undeclared (first use in this function)
inserter.c:709: error: `NEBCALLBACK_SERVICE_STATUS_DATA' undeclared (first use in this function)
inserter.c:711: error: `nebstruct_service_status_data' undeclared (first use in this function)
inserter.c:711: error: `service_status_data' undeclared (first use in this function)
inserter.c:711: error: syntax error before ')' token
inserter.c:712: error: syntax error before ')' token
inserter.c:888: error: `NSLOG_INFO_MESSAGE' undeclared (first use in this function)
inserter.c: In function `append':
inserter.c:945: error: `NSLOG_INFO_MESSAGE' undeclared (first use in this function)
inserter.c:945: error: `TRUE' undeclared (first use in this function)
inserter.c: In function `err_out':
inserter.c:978: error: `NSLOG_INFO_MESSAGE' undeclared (first use in this function)
inserter.c:978: error: `TRUE' undeclared (first use in this function)
inserter.c: In function `sql_dump':
inserter.c:1007: error: `TRUE' undeclared (first use in this function)
inserter.c:1067: warning: implicit declaration of function `printf'
make: *** [all] Error 1


Thanks for your help
dp1
Posts: 5
Joined: Tue Jul 18, 2006 4:56 am

@gg234: double post

Post by dp1 »

@gg234:

I think you shouldn't post the same message twice... I gave you an answer, look at the other topic...
User avatar
benzopila
Posts: 14
Joined: Thu Aug 03, 2006 6:51 am
Location: Ukraine, Kiev
Contact:

Post by benzopila »

Hello!


I have this messages when compiling insterter.o:
gcc -g -O2 -Wall -o inserter.o inserter.c -shared -L/usr/local/lib/mysql -I../include -I/usr/local/include/ -lmysqlclient -fPIC
inserter.c: In function `processStatus':
inserter.c:666: warning: long unsigned int format, time_t arg (arg 5)
inserter.c:666: warning: long unsigned int format, time_t arg (arg 6)
inserter.c:696: warning: long unsigned int format, time_t arg (arg 3)
inserter.c:842: warning: long unsigned int format, time_t arg (arg 5)
inserter.c:842: warning: long unsigned int format, time_t arg (arg 6)
inserter.c:872: warning: long unsigned int format, time_t arg (arg 3)
but file is compiled finally.

When restarting nagios, having this log message:
[1155900046] Successfully shutdown... (PID=63380)
[1155900055] Nagios 2.0b3 starting... (PID=67795)
[1155900055] LOG VERSION: 2.0
[1155900055] Error: Module '/usr/local/etc/nagios/modules/inserter.o' is using an old or unspecified version of the event broker API. Module will be unloaded.
[1155900055] Event broker module '/usr/local/etc/nagios/modules/inserter.o' deinitialized successfully.
[1155900056] Finished daemonizing... (New PID=67796)
I tryed with "-lz" option and without, but have same result.
Anybody know why?

And if I use inserter.o posted a few pages ago(for SUSE) I have this messages:
[1155902873] Caught SIGTERM, shutting down...
[1155902873] Successfully shutdown... (PID=67796)
[1155902873] Nagios 2.0b3 starting... (PID=1305)
[1155902873] LOG VERSION: 2.0
[1155902873] Error: Could not load module '/usr/local/etc/nagios/modules/inserter.o' -> Shared object "libmysqlclient.so.14" n
ot found, required by "inserter.o"
[1155902873] Finished daemonizing... (New PID=1319)
1По


Thanks for any help. Sorry for my poor english.


Cacti 0.8.6h, plugin arch, npc-0.1.1a, Nagios 2.0b3, FreeBSD 6.0
Last edited by benzopila on Tue Aug 22, 2006 7:32 am, edited 1 time in total.
User avatar
benzopila
Posts: 14
Joined: Thu Aug 03, 2006 6:51 am
Location: Ukraine, Kiev
Contact:

Post by benzopila »

or, please, can anyone attach his own compiled insterter.o? :)
maybe some match to my os.

Thanks.
JJX
Cacti User
Posts: 402
Joined: Thu Oct 06, 2005 5:03 am

Post by JJX »

hi all, where can i get this file?
The url in the first post isnt working


thx
cacti rulez!
User avatar
benzopila
Posts: 14
Joined: Thu Aug 03, 2006 6:51 am
Location: Ukraine, Kiev
Contact:

Post by benzopila »

Hello!
I have some progress in that question.
I've updated nagios from 2.0b3 to 2.5 and now there is so problem:
There is this messages when compiling insterter.o:
gcc -g -O2 -Wall -o inserter.o inserter.c -shared -L/usr/local/lib/mysql -I../include -I/usr/local/include/ -lmysqlclient -fPIC
inserter.c: In function `processStatus':
inserter.c:666: warning: long unsigned int format, time_t arg (arg 5)
inserter.c:666: warning: long unsigned int format, time_t arg (arg 6)
inserter.c:696: warning: long unsigned int format, time_t arg (arg 3)
inserter.c:842: warning: long unsigned int format, time_t arg (arg 5)
inserter.c:842: warning: long unsigned int format, time_t arg (arg 6)
inserter.c:872: warning: long unsigned int format, time_t arg (arg 3)
What about this warnings? Are they critical?
but file is compiled finally.

When restarting nagios, having this log message:
[1156750357] Nagios 2.5 starting... (PID=61840)
[1156750357] LOG VERSION: 2.0
[1156750357] initializing nagios-db mysql inserter...
[1156750357] nagios-db: inserter locked into db
[1156750357] Event broker module '/usr/local/etc/nagios/modules/inserter.o' initialized successfully.
[1156750357] Lockfile '/var/spool/nagios/nagios.lock' is held by PID 41815. Bailing out...
[1156750357] nagios-db: inserter unloading...
[1156750357] Event broker module '/usr/local/etc/nagios/modules/inserter.o' deinitialized successfully.
[1155900056] Finished daemonizing... (New PID=67796)
Why do it loading and right away unloading ?

Thanks for any help. Sorry for my poor english.

Cacti 0.8.6h, plugin arch, npc-0.1.1a, Nagios 2.5, FreeBSD 6.0
JJX wrote:hi all, where can i get this file?
The url in the first post isnt working
thx
What file do you mean?
User avatar
benzopila
Posts: 14
Joined: Thu Aug 03, 2006 6:51 am
Location: Ukraine, Kiev
Contact:

Post by benzopila »

Hello!
I've found mistake:
[1156750357] Lockfile '/var/spool/nagios/nagios.lock' is held by PID 41815. Bailing out...
This file /var/spool/nagios/nagios.lock must be deleted before restarting nagios.

Now NPC working so I have a few new questions :)
Caliban wrote:Not possible but you can link graphs to NPC so they're embedded.
While under console click Devices pick a device that's also in Nagios you'll see a new option called Nagios Host Mapping.. select the right Nagios Host and save it. When in NPC viewing the host there will be a Graph View option under the Host name that will take you to the hosts for that graph.
This feature is working properly and I can choose hosts from nagios at dropping menu(Nagios Host Mapping - Select the Nagios host that maps to this host).
And after that as result I can view associated graphs for host
(while under host at the top of the page - "View graphs").
Caliban wrote: While under the services for a host at the bottom of the page you'll see Graph Mapping.. select the Cacti graph that goes with that service and when you view that service the graph will be at the bottom. Also while viewing a list of services there will be an extra graph icon that when click will display the graph under the service.. its pretty cool..
But I can't to associate graph at Graph mapping.
There are no associated graphs for services
(while under the services for a host at the bottom "Graph mapping").
I mean there is nothing but "none" at dropping menu in "Associated graph:".
Can anybody help?
knobdy wrote: Hey, just out of curiosity, how hard would it be to create a web frontend for editing the nagios config files (for adding hosts and such)?
Caliban wrote: Now if they can only get the hostgroups/Servicegroups and config working. Oh and the acknowledge in the list of commands would be ncie.
What about these features?
divagater wrote: I can't promise any time frame on this. If there are any PHP/MySQL folks that are interested in helping speed this along I would be glad to collaborate.
~Billy
Billy, I'm a nooby at this question, but I need to learn PHP and MySQL and want to help in development. I'll send this message to you by email.
If you need help, just reply.

Thanks. Sorry for my poor English.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests