Nagios Plugin for Cacti - External Configuration

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
dp1
Posts: 5
Joined: Tue Jul 18, 2006 4:56 am

Nagios Plugin for Cacti - External Configuration

Post by dp1 »

Hi

I found the very usefull NPC-Addon here, thanks. There was only the thing with the hardcoded mysql-credentials...
Because I didn't like the way it was solved, I fixed it by adding a configuration file... If you like it, don't hesitate to use the source or whatever...

Inside the tar file you'll find everything you need.

Greetings

dp

BTW: I'm new here, hope it helps!
Attachments
npc.tar.gz
Modified version of "inserter.c"
-----------------------------------

gunzip npc.tar.gz
tar xf npc.tar
---
OR tar -zxf npc.tar.gz
---
vi README
(31.18 KiB) Downloaded 540 times
gg234
Cacti User
Posts: 63
Joined: Fri Oct 07, 2005 11:14 am
Contact:

Re: Nagios Plugin for Cacti - External Configuration

Post by gg234 »

Hi ,

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

You need the nagios sources...

Post by dp1 »

Hi

This seems clearly like a problem with the nagios sources...

Get the tarball from www.nagios.org (http://prdownloads.sourceforge.net/nagi ... z?download)
and unpack it to a location, e.g /usr/src. Afterwards you'll have a folder /usr/src/nagios-<xxx> where you find another folder called "module". Put the inserter.c and the makefile there and run make.
-------------------
Look at the makefile and modify the path for "install" so you can run make install.
-------------------
If you use debian, do the following commands to get the sources..
cd /usr/src
apt-get source nagios2
Then you have to rename the header files from e.g. nagios.h.in to nagios.h, don't know why this is....
-------------------
You'll also need the mysql header files. Get them with `apt-get install libmysqlclient14-dev`... or just download the package from the mysql page.

If you encounter more problems, just ask or read the npc-manual. It's described there too.

Good luck.
gg234
Cacti User
Posts: 63
Joined: Fri Oct 07, 2005 11:14 am
Contact:

Re: You need the nagios sources...

Post by gg234 »

thanks for your help i followed you instructions

i run make it went well now

Look at the makefile and modify the path for "install" so you can run make install.

in my make file i have the following

gcc -g -O2 -Wall -o inserter.o inserter.c -shared -I../include -I/usr/include/mysql -lmysqlclient -fPIC

where i need to change the install path and by the way i have got inserter.o without running make install how come?

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

just comfort

Post by dp1 »

fine, pleased to hear that...

the make install is not needed, just a comfort thing...

inside my tar.gz file, you find my makefile with the install declaration, usefull for development...

the .o-File you'll get anyway.

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

Re: just comfort

Post by gg234 »

finally i got it working thanks for your great idea and i ahve one small problem i have downloaded npc from the following link

http://forums.cacti.net/about10327-0-asc-60.html

when i click npc tab under additinal views

when i click on hostgroups and servicegroups links are not working i am missing these two .php files in my npc plugin or how to fix this problem

thanks
dp1
Posts: 5
Joined: Tue Jul 18, 2006 4:56 am

well..

Post by dp1 »

I'm missing these too... you could ask the autor. Remember, I just added the config-stuff...

Perhaps I'm gonna add something here, mostly because I think it would be helpful to have them. I tell you as soon as I have something...
Mika2006
Cacti User
Posts: 178
Joined: Thu May 03, 2007 2:25 am

Post by Mika2006 »

Look at the makefile and modify the path for "install" so you can run make install.
what path i don' t understand ?
please help?
|Cacti Version - 0.8.6j||Plugin Architecture - 1.1||Poller Type - CMD.php|
|os - Red hat 4es | |Web Server - Apache/2.0.52 (Red Hat)|
|PHP - 4.3.9| |MySQL - 4.1.20| |RRDTool - 1.2.13||SNMP - 5.1.2|
|Plugins| Host Info (hostinfo - v0.1)
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests