PDA

View Full Version : Nagios CFG import available


diLLec
05-09-2006, 03:09 PM
hey folks,

we are running a nagios system which is currently administrated by nagman. this tool like oreon generates configuration data.

Is there any way to import those configuration data for nagios to oreon databases like some kind of import script ?

it would be nice if we could migrate to oreon.

Greetings,
diLLec

cih
05-09-2006, 04:13 PM
Hi diLLec!

I think better in English Forum, maybe somebody could not read English in French Forum, maybe I'm wrong ;)

Anyway, I don't know how to import that kind of configuration files cause i have never used nagman. The export files are not standard nagios cfg files?¿
Let us know something else about that files to try to help you!

Later!

diLLec
05-11-2006, 11:09 AM
Hey cih,

the files which i want to import are standard nagios cfg files which are generated by nagman, like oreon does. I've seen that oreon got a load function for nagios.cfg and resource.cfg but i need to import service checks and hosts etc.

I'm using Oreon 1.3 Beta.

Greetings,
diLLec

cih
05-11-2006, 11:34 AM
eps diLLec,

I managed to import all my config files from Nagios. I explained how I have done it in another post:

http://forum.oreon-project.org/viewtopic.php?t=1610

Hope it could help ... please let me know how are you doing.

Later!

diLLec
05-11-2006, 01:03 PM
thank you for your help. We've succeeded in importing the nagios files.

greetings,
diLLec

cih
05-11-2006, 03:14 PM
You're welcome :wink:

rom
05-11-2006, 03:41 PM
Hum ca m'interesse cette histoire, tu arrives a loader en rentrant les fichiers un a un, mais tt en mm temps ca merde ?

Peux tu limiter ton test avec tres peu d'host, voir si ca merde encore et le cas echeant me transmettre tes cfg ?

Je pense que le prob vient d'un parametre lie a nagios2, une broutille je pense.

cih
05-11-2006, 04:27 PM
Sorry rom, my French is very crappy ... I missed 40 % of your post ... :cry:

rom
05-11-2006, 04:33 PM
Ho excuse me ! I think you speak French ! :lol:

So I would like to understand how you can't upload a complete archive, and how it works when you upload the files one by one.

So, if you can test it with a very small number of hosts and see if the problem occurs again, please send me your hosts.cfg in order to test it by myself.
I think it's a little mistake with nagios 2 parameter..

Thanks.

cih
05-11-2006, 04:40 PM
I would try to test it again with a compressed file tomorrow morning, now I'm adding stuff to my production Nagios ;P

It's very strange but Oreon was not able to read any of the files in the tar.gz and parse it correctly ... but, maybe it's my mistake again ... let's see ;)

Maybe you could move this post to English forum, I understand more or less 50% of the posts in French because I speak Catalan, that's similar to French, but some words make me lost ;P I hope I could improve my French soon ( I'm right now doing a French Language Course :oops: )

cih
05-18-2006, 03:30 PM
Eps rom,

I restart all my setup again from zero, because something strange had happened to my oreon installation (no way to create files correctly from DB, and no errors at all ...). Anyway, I tried to load my config files again from a gzip file, and from a zip file, but no luck at all. I could only import my nagios config files doing it one by one. This way I find some other strange behaviours ( every file I load, first entry was missing in database ... first contact, first contacgroup, first host ...) but I managed to import these items with "Manual Filling" (cool feature). You ask me to send you my config files, but I'm not able to do that (legal stuff, you know) but I assure you nothing strange on files, because they're loading if I do it one by one ... I'm lost at this point.

Later!

rom
05-18-2006, 03:49 PM
Did you enable php error ? Because it seems that it's an upload problem.
Be sure that /oreon/filesUpload/nagiosCFG is apache writable. I temporary uncompress in this place (and delete it when the operation is finish).

You also say that first entry is not record for a single manual file upload.. strange, I'll have a look on it.

This header file doesn't work : "application/x-zip-compressed"
Those ones work : "application/x-gzip" / "application/octet-stream"

Archive I create are made with this command line :

tar -czf myArchive.tar.gz cfg1.cfg cfg2.cfg

cih
05-19-2006, 10:25 AM
Hi rom,

I solved my problems on tuesday. Reinstalled all again, and now is up and working. ;)

Regarding loading cfg files from a gzip, I create the file nearly the same way

tar -czvf myNagiosConfig.tar.gz *.cfg

So I don't know why the hell is not loading any file. I hope I'm the only one suffering this kind of X files, because i even don't understand the strange behaviour concerning loosing the first item in the one by one file loading ...

Well, the good news are that all is working quite fine now ;)

Later.

rom
05-19-2006, 10:36 AM
So I don't know why the hell is not loading any file. I hope I'm the only one suffering this kind of X files, because i even don't understand the strange behaviour concerning loosing the first item in the one by one file loading ...

With your old install isn't it ? The problem is fix now ?

cih
05-19-2006, 05:05 PM
Hi rom,

no way to load config files from a gzip or tar archive in the new installation neither. I was able to load config files one by one, but loosing the first item in every config file (in the new installation). Anyway, I do it by hand to complete all the configs, and now is fully working, but problems may still be there. When beta2 comes out would do again fresh install and let you know how it works for me.

Thanks for the interest!

Later.

rom
05-19-2006, 05:53 PM
Quite impossible for me to reproduce your problem...


define contact{
contact_name rom1
alias rom1
host_notification_period 24x7
host_notification_options d,u
host_notification_commands host-notify-by-email
service_notification_period 24x7
service_notification_options w,u,c,r
service_notification_commands notify-by-email
email rom1@localhost
}

define contact{
contact_name rom2
alias rom2
host_notification_period 24x7
host_notification_options d,u
host_notification_commands host-notify-by-email
service_notification_period 24x7
service_notification_options w,u,c,r
service_notification_commands notify-by-email
email rom2@localhost
}


Here is a contact.cfg file which is working when I upload it alone.. Can you tell me if it work with your Oreon ?

cih
05-23-2006, 10:05 AM
Hey rom!

really strange, now I'm completely lost ... I copied your contacts to a new config file, loaded the file, and now both contacts are loaded correctly ... I don't understand that behaviour. Sorry to make you loose some time on this, I don't know how to deal with it, because I have done the config loading 3 times, and 2 of the three didn't load first item ... Would try again with next release.

Thanks for your time and support.

rom
05-23-2006, 10:11 AM
Whats the difference between your contact.cfg and mine ?

cih
05-23-2006, 11:58 AM
My first two contacts, for example:

define contact {
use generic-contact
contact_name blackberry-tme
alias Blackberry Guardias TME
email blackberry5@xxx.com
pager bb5
service_notification_period 24x7
host_notification_period 24x7
service_notification_options u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email,notify-by-tmesms
host_notification_commands host-notify-by-email,host-notify-by-tmems
}
define contact {
use generic-contact
contact_name blackberry-vod
alias Blackberry Guardias VOD
email blackberry5@xxx.com
pager bb5
service_notification_period 24x7
host_notification_period 24x7
service_notification_options u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email,notify-by-vodsms
host_notification_commands host-notify-by-email,host-notify-by-vodsms
}

Little differences as pager or "use generic-contact" lines, but these lines are correct ...

rom
05-23-2006, 12:15 PM
Yes, but we use the template reference "use" only for Host and Service...
I'll try with yours and see whats the problem.

rom
05-23-2006, 01:50 PM
Ok, I've got the same problem when I upload an archive file.
With a manual fill or a not compress file it's ok.

The problem comes from the gzfile() function wich 'eat' the first line of the file and I can't do anything against thaht.. very strange.

If your file name is contacts.cfg, the buffer will contain :


contacts.cfg
use generic-contact
contact_name blackberry-tme
alias Blackberry Guardias TME


And the load doesn't work...

So, for a better load, be sure that your conf file don't begin with a define, but a comment, a \n, or anything without meaning.

cih
05-25-2006, 11:56 AM
Hi rom!

Thanks for the answer. I was going mad ... Actually, my config files began with defines. I would put a comment in the beginning of the file so that strange behaviour doesn't happen again.

Thanks again for your time!

Keep up the good work!