Nagios Plugin for Cacti (NPC) Released

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
spoonman
Cacti User
Posts: 305
Joined: Tue May 03, 2005 8:54 am
Location: GA

Post by spoonman »

Need help with starting nagios with the compiled inserter.o file.......Nagios starts fine and works but not with the module..

Nagios.log >>>>>
[1147197399] Nagios 2.2 starting... (PID=7305)
[1147197399] LOG VERSION: 2.0
[1147197399] initializing nagios-db mysql inserter...
[1147197399] nagios-db: inserter failed to connect to db (Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)), disabling module!
[1147197399] Event broker module '/usr/local/nagios/modules/inserter.o' initialized successfully.
[1147197399] Finished daemonizing... (New PID=7306)

Where do I specify my mysql.sock in the inserter.c file to re- make it///

seems the NULL variable that's in inserter.c points to /var/run/mysqld.sock... my socket is /tmp/mysql.sock

THANKS
spoonman
Cacti User
Posts: 305
Joined: Tue May 03, 2005 8:54 am
Location: GA

Post by spoonman »

I figured it out////

Step 1) modified my inserter.c file again...replaced socket variable that was NULL to "/tmp/mysql.sock" which is the socket mysql runs // Copied the new inserter.c file to Nagios src....re-ran make to recreate inserter.o ...etc...U know the rest.

(!mysql_real_connect(&mysql,"localhost","***","***","cactidb",3306,"/tmp/mysql.sock",0)) {sprintf(error,"nagios-db: inserter failed to connect to db (%s), disabling module!", mysql_error(&mysql));

Step 2) went into mysql and had to change my password settings to use the old_password style ......i'm running mysql 4.1.15 but this still gave me an error.. log into mysql>>>

mysql> set password for root@localhost=old_password('***');
mysql> set password for root=old_password('***');
mysql> flush privileges;

*** NOTE> please use whatever user u enabled in your inserter.c file as your permissions to connect to your DB.

then restarted Nagios and it worked...\ Here is the output from my nagios.log>>>>>

[1147201285] Nagios 2.2 starting... (PID=27018)
[1147201285] LOG VERSION: 2.0
[1147201285] initializing nagios-db mysql inserter...
[1147201285] nagios-db: inserter locked into db
[1147201285] Event broker module '/usr/local/nagios/modules/inserter.o' initialized successfully.
[1147201285] Finished daemonizing... (New PID=27019)
[1147201285] nagios-db: configured 1 hosts
[1147201285] nagios-db: configured 5 services
[1147201285] nagios-db: loaded 1 hostgroups
[1147201285] nagios-db: loaded 0 servicegroups
[1147201285] nagios-db: configuration complete. Registering for status notifications...


DONE!!
fozzy
Cacti User
Posts: 54
Joined: Mon Jan 09, 2006 11:33 am
Location: SE of LIML
Contact:

Post by fozzy »

Just curious about what could be done....
has anybody thought of reading the nagios perdata and parsing it?
it has the info about the hosts and services from nagios. reading it once every five minutes it should be possible to create some sort of interface for adding data into the cacti db.. possibly a long shot but it could be quite useful... sure it's easier the other side around (using cacti data in nagios) but the options to configrue nagios are way more than thos used in cacti...

any thoughts?

Ciao, Luca
wd
Posts: 9
Joined: Fri May 12, 2006 8:35 pm

Post by wd »

I can't connect http://www.divagater.com/npc/...
Who can tell me where I can get this plugin?

thx.
julpie
Posts: 15
Joined: Mon Apr 03, 2006 7:43 am
Location: Wuerzburg (Germany)

Post by julpie »

wd wrote:I can't connect http://www.divagater.com/npc/...
Who can tell me where I can get this plugin?

thx.
On this topic, page 5...
keithw
Posts: 1
Joined: Mon May 22, 2006 12:11 pm

error ??

Post by keithw »

Error: Could not load module '/usr/local/nagios/modules/inserter.o' -> /usr/local/nagios/modules/inserter.o: undefined symbol: __builtin_delete


Anyone have this issue.?
Dinfree
Posts: 13
Joined: Wed May 24, 2006 9:20 am

Re: Solaris 9 and NPC

Post by Dinfree »

stinkybob wrote:I seem to be having all kinds of library problems relating to mysql.

Code: Select all

gcc -g -O2 -Wall -shared -o inserter.o inserter.c -L/usr/lib -L/usr/local/lib -L/usr/local/ssl/lib -L/usr/local/my                                            sql/lib -I../include -I/usr/include -I/usr/local/include -I/usr/local/mysql/include -I/usr/local/ssl/include -lmys                                            qlclient -lz -fPIC
inserter.c: In function `loadconfig':
inserter.c:196: warning: implicit declaration of function `asprintf'
Text relocation remains                         referenced
    against symbol                  offset      in file
<unknown>                           0x0         /usr/local/mysql/lib/libmysqlclient.a(ctype.o)
<unknown>                           0x4         /usr/local/mysql/lib/libmysqlclient.a(ctype.o)
<unknown>                           0x8         /usr/local/mysql/lib/libmysqlclient.a(ctype.o)
<unknown>                           0xc         /usr/local/mysql/lib/libmysqlclient.a(ctype.o)
<unknown>                           0x0         /usr/local/mysql/lib/libmysqlclient.a(default.o)
<unknown>                           0x1c        /usr/local/mysql/lib/libmysqlclient.a(default.o)
strlen                              0x10a8      /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
strlen                              0x230       /usr/local/mysql/lib/libmysqlclient.a(password.o)
strlen                              0x29c       /usr/local/mysql/lib/libmysqlclient.a(password.o)
strlen                              0x9c8       /usr/local/mysql/lib/libmysqlclient.a(password.o)
strlen                              0xa4c       /usr/local/mysql/lib/libmysqlclient.a(password.o)
strlen                              0x108       /usr/local/mysql/lib/libmysqlclient.a(my_malloc.o)
strlen                              0x44        /usr/local/mysql/lib/libmysqlclient.a(mf_pack.o)
strlen                              0x78        /usr/local/mysql/lib/libmysqlclient.a(mf_pack.o)
strlen                              0xdc        /usr/local/mysql/lib/libmysqlclient.a(mf_pack.o)
strlen                              0x128       /usr/local/mysql/lib/libmysqlclient.a(mf_pack.o)
strlen                              0x220       /usr/local/mysql/lib/libmysqlclient.a(mf_pack.o)
strlen                              0x5ec       /usr/local/mysql/lib/libmysqlclient.a(mf_pack.o)
strlen                              0x67c       /usr/local/mysql/lib/libmysqlclient.a(mf_pack.o)
strlen                              0x7a8       /usr/local/mysql/lib/libmysqlclient.a(mf_pack.o)
strlen                              0x5f0       /usr/local/mysql/lib/libmysqlclient.a(my_alloc.o)
strlen                              0x108       /usr/local/mysql/lib/libmysqlclient.a(mf_format.o)
strlen                              0x114       /usr/local/mysql/lib/libmysqlclient.a(mf_format.o)
strlen                              0xb4        /usr/local/mysql/lib/libmysqlclient.a(mf_loadpath.o)
strlen                              0x124       /usr/local/mysql/lib/libmysqlclient.a(my_once.o)
strlen                              0x1c8       /usr/local/mysql/lib/libmysqlclient.a(my_vsnprintf.o)
strlen                              0x3cc       /usr/local/mysql/lib/libmysqlclient.a(ctype.o)
strlen                              0x80c       /usr/local/mysql/lib/libmysqlclient.a(ctype-utf8.o)
strlen                              0x918       /usr/local/mysql/lib/libmysqlclient.a(ctype-utf8.o)
strlen                              0x7f0       /usr/local/mysql/lib/libmysqlclient.a(ctype-ucs2.o)
strlen                              0x7fc       /usr/local/mysql/lib/libmysqlclient.a(ctype-ucs2.o)
strlen                              0xa28       /usr/local/mysql/lib/libmysqlclient.a(ctype-ucs2.o)
strlen                              0x2410      /usr/local/mysql/lib/libmysqlclient.a(ctype-ucs2.o)
strlen                              0x241c      /usr/local/mysql/lib/libmysqlclient.a(ctype-ucs2.o)
strlen                              0x11bc      /usr/local/mysql/lib/libmysqlclient.a(ctype-uca.o)
strlen                              0x2010      /usr/local/mysql/lib/libmysqlclient.a(client.o)
strlen                              0x201c      /usr/local/mysql/lib/libmysqlclient.a(client.o)
strlen                              0x2028      /usr/local/mysql/lib/libmysqlclient.a(client.o)
strlen                              0x2414      /usr/local/mysql/lib/libmysqlclient.a(client.o)
strlen                              0x27a8      /usr/local/mysql/lib/libmysqlclient.a(client.o)
strlen                              0x3310      /usr/local/mysql/lib/libmysqlclient.a(client.o)
strlen                              0x3354      /usr/local/mysql/lib/libmysqlclient.a(client.o)
strlen                              0xcc        /usr/local/mysql/lib/libmysqlclient.a(default.o)
strlen                              0x120       /usr/local/mysql/lib/libmysqlclient.a(default.o)
strlen                              0x358       /usr/local/mysql/lib/libmysqlclient.a(default.o)
strlen                              0x9cc       /usr/local/mysql/lib/libmysqlclient.a(default.o)
strlen                              0xa70       /usr/local/mysql/lib/libmysqlclient.a(default.o)
strlen                              0xa7c       /usr/local/mysql/lib/libmysqlclient.a(default.o)
strlen                              0xadc       /usr/local/mysql/lib/libmysqlclient.a(default.o)
strlen                              0xc84       /usr/local/mysql/lib/libmysqlclient.a(default.o)
strlen                              0x14        /usr/local/mysql/lib/libmysqlclient.a(ctype-mb.o)
strlen                              0xa4        /usr/local/mysql/lib/libmysqlclient.a(ctype-mb.o)
strlen                              0x20c       /usr/local/mysql/lib/libmysqlclient.a(ctype-mb.o)
mysql_close                         0x11f8      /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
mysql_close                         0x2684      /usr/local/mysql/lib/libmysqlclient.a(client.o)
mysql_close                         0x272c      /usr/local/mysql/lib/libmysqlclient.a(client.o)
mysql_close                         0x29f4      /usr/local/mysql/lib/libmysqlclient.a(client.o)
mysql_close                         0x2a20      /usr/local/mysql/lib/libmysqlclient.a(client.o)
exit                                0x98        /usr/local/mysql/lib/libmysqlclient.a(my_malloc.o)
exit                                0x30        /usr/local/mysql/lib/libmysqlclient.a(str_alloc.o)
exit                                0xc94       /usr/local/mysql/lib/libmysqlclient.a(client.o)
exit                                0x328       /usr/local/mysql/lib/libmysqlclient.a(default.o)
exit                                0x884       /usr/local/mysql/lib/libmysqlclient.a(default.o)
exit                                0x8a4       /usr/local/mysql/lib/libmysqlclient.a(default.o)
printf                              0x7ac       /usr/local/mysql/lib/libmysqlclient.a(default.o)
printf                              0x7dc       /usr/local/mysql/lib/libmysqlclient.a(default.o)
mysql_real_query                    0x10b4      /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
mysql_real_query                    0x6994      /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
mysql_real_query                    0x69bc      /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
mysql_real_query                    0x69f4      /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
mysql_real_query                    0x6a14      /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
mysql_real_query                    0x2424      /usr/local/mysql/lib/libmysqlclient.a(client.o)
mysql_real_query                    0x3364      /usr/local/mysql/lib/libmysqlclient.a(client.o)
malloc                              0x10        /usr/local/mysql/lib/libmysqlclient.a(my_malloc.o)
malloc                              0x94        /usr/local/mysql/lib/libmysqlclient.a(my_once.o)
malloc                              0x14        /usr/local/mysql/lib/libmysqlclient.a(str_alloc.o)
strcat                              0x844       /usr/local/mysql/lib/libmysqlclient.a(mf_pack.o)
strcat                              0xdc        /usr/local/mysql/lib/libmysqlclient.a(mf_loadpath.o)
sprintf                             0xeb4       /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
sprintf                             0x37d8      /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
sprintf                             0x3934      /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
sprintf                             0x4b7c      /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
sprintf                             0x4bac      /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
sprintf                             0x5d94      /usr/local/mysql/lib/libmysqlclient.a(libmysql.o)
sprintf                             0x258       /usr/local/mysql/lib/libmysqlclient.a(password.o)
sprintf                             0x6dc       /usr/local/mysql/lib/libmysqlclient.a(password.o)
sprintf                             0x1c0       /usr/local/mysql/lib/libmysqlclient.a(my_init.o)
sprintf                             0x23c       /usr/local/mysql/lib/libmysqlclient.a(my_init.o)
sprintf                             0x290       /usr/local/mysql/lib/libmysqlclient.a(my_init.o)
sprintf                             0x64c       /usr/local/mysql/lib/libmysqlclient.a(ctype.o)
sprintf                             0x568       /usr/local/mysql/lib/libmysqlclient.a(xml.o)
sprintf                             0x6d0       /usr/local/mysql/lib/libmysqlclient.a(xml.o)
sprintf                             0x7dc       /usr/local/mysql/lib/libmysqlclient.a(xml.o)
sprintf                             0x8dc       /usr/local/mysql/lib/libmysqlclient.a(xml.o)
sprintf                             0xa58       /usr/local/mysql/lib/libmysqlclient.a(xml.o)
sprintf                             0xab0       /usr/local/mysql/lib/libmysqlclient.a(xml.o)
sprintf                             0xadc       /usr/local/mysql/lib/libmysqlclient.a(xml.o)
........
(lots more of the same deleted for the sake of brevity)
I'm running Solaris 9 (sparc) with the latest patches, mysql 4.1.18 (i've tried 5.0.18 and it does the same thing. Is there any way to compile the object without needing -lmysqlclient or -lz? Can they be linked after the fact with ld? If so, how would I go about doing that?
Hello everybody,

Stinkybob, what was your issue? I'm getting the same error.

Me, I use Solaris 8 with sparc processor.
Thanks for all help !
Dinfree
Posts: 13
Joined: Wed May 24, 2006 9:20 am

Post by Dinfree »

Code: Select all


...
...
...

compiled_charsets  0x320  /usr/local/mysql/lib/libmysqlclient.a(charsetdef.o)
<unknown>       0x304       /usr/local/mysql/lib/libmysqlclient.a(sha1.o)
<unknown>       0x33c       /usr/local/mysql/lib/libmysqlclient.a(sha1.o)
...
...
...

<unknown>        0x15bc      /usr/local/mysql/lib/libmysqlclient.a(ctype-big5.o)
<unknown>        0x15ec      /usr/local/mysql/lib/libmysqlclient.a(ctype-big5.o)
<unknown>        0x15f0      /usr/local/mysql/lib/libmysqlclient.a(ctype-big5.o)
<unknown>        0x1620      /usr/local/mysql/lib/libmysqlclient.a(ctype-big5.o)
<unknown>        0x1624      /usr/local/mysql/lib/libmysqlclient.a(ctype-big5.o)
<unknown>        0x1654      /usr/local/mysql/lib/libmysqlclient.a(ctype-big5.o)
<unknown>        0x1658      /usr/local/mysql/lib/libmysqlclient.a(ctype-big5.o)
<unknown>        0x167c      /usr/local/mysql/lib/libmysqlclient.a(ctype-big5.o)
<unknown>        0x1680      /usr/local/mysql/lib/libmysqlclient.a(ctype-big5.o)

ld: fatal: relocations remain against allocatable but non-writable sections
collect2: ld returned 1 exit status
make: *** [all] Error 1
#

When I execute the " make " with the file "inserter.c" to generate the "inserter.o" file, I have this error.

Can you help me?
I don't understand these the lines of errors ?
Thanks
julpie
Posts: 15
Joined: Mon Apr 03, 2006 7:43 am
Location: Wuerzburg (Germany)

Post by julpie »

Maybe you should install mysql-devel package ?
sgaucho
Posts: 20
Joined: Fri Mar 24, 2006 8:07 am

Post by sgaucho »

Hi,

The link http://www.divagater.com/npc/ doesnt seem to working anymore. any alternative download link ?

thnkx,

sg
julpie
Posts: 15
Joined: Mon Apr 03, 2006 7:43 am
Location: Wuerzburg (Germany)

Post by julpie »

sgaucho wrote:Hi,

The link http://www.divagater.com/npc/ doesnt seem to working anymore. any alternative download link ?

thnkx,

sg
Just have a look some messages above in *this* topic, you'll find what you're looking for.
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

Can anyone say if this plugin should work with the latest version of Nagios?

If so, can anyone describe the process of getting the plugin to see the upgrade? I only had a single host in the old version (which worked well with the plugin), the localhost. However, after the upgrade Nagios has that host configured again but the plugin still shows it as down, as it has since I began the upgrade process.
slander
Posts: 32
Joined: Thu Mar 16, 2006 12:01 pm

Post by slander »

knobdy wrote:Can anyone say if this plugin should work with the latest version of Nagios?

If so, can anyone describe the process of getting the plugin to see the upgrade? I only had a single host in the old version (which worked well with the plugin), the localhost. However, after the upgrade Nagios has that host configured again but the plugin still shows it as down, as it has since I began the upgrade process.
I am using it with Nagios 2.4 as of a few days ago. I have several hundred hosts.

I didn't need to make any changes for the plugin to work - but, I did have to recompile the inserter to work with the new nagios version.
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

slander wrote:I didn't need to make any changes for the plugin to work - but, I did have to recompile the inserter to work with the new nagios version.
Yeah, I had completely forgotten about the module.

I don't recall if I had to create a "module" directory for nagios before - but I recompiled it with the event broker enabled and reinstalled and it didn't create it. I created it myelf and placed the recompiled inserter.c there - and added back the link. Still, no love.

One thing that also changed with the new version is that Nagios was installed in usr/share/nagios and now it's in /usr/local/nagios. I changed the pointer in NPC's configuration through the Cacti console - but it's asking for nagios.cmd (which I don't have)...??
slander
Posts: 32
Joined: Thu Mar 16, 2006 12:01 pm

Post by slander »

knobdy wrote:
slander wrote:I didn't need to make any changes for the plugin to work - but, I did have to recompile the inserter to work with the new nagios version.
Yeah, I had completely forgotten about the module.

I don't recall if I had to create a "module" directory for nagios before - but I recompiled it with the event broker enabled and reinstalled and it didn't create it. I created it myelf and placed the recompiled inserter.c there - and added back the link. Still, no love.

One thing that also changed with the new version is that Nagios was installed in usr/share/nagios and now it's in /usr/local/nagios. I changed the pointer in NPC's configuration through the Cacti console - but it's asking for nagios.cmd (which I don't have)...??

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

the nagios.cmd file is a pipe. I think it will create it itself.

One other thing - did you remember to change the database info in the inserter source code, since that is compiled in?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests