Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hi, i have a problem with nagios notification via email in fedora core 6 box.
i hope anybody can assist me in configuring very simple config
to make nagios make email notification if services are down.
I tried to follow the notification procedure but it wont work.
So you read some documentation. Great!
But what are the *exact* steps (and which details in which configuration files) you edited? The first thing you want to do (after reading more documentation because there is *no* substitute for reading it) is set up the hosts to monitor (unless filenames changed that'll be in hosts.cfg and hostgroups.cfg), then the services to monitor (services.cfg), (then the dependencies if you want to have any), then the escalations(.cfg), then the different users to alert in contactgroups(.cfg) and finally the users and e-mail addresses in contacts.cfg.
And how (http://nagios.sourceforge.net/docs/3...fications.html) did you test it did not work?
Did you bring a service down? Did it trigger a notice in the log? Did you try to poll the service manually with one of the commands in checkcommands.cfg?
it just weird because some config files are not present after the installation like host.cgi, hostgroup.cgi,contactgroup.cgi,escalation.cgi. (..) Some of my config's are switch.cgi,windows.cgi,localhost.cgi.
In Nagios release 3.0a5 release notes it read "changes to sample config files and installation location", and since there's been no mention of deprecating configuration files, maybe you should look in a different location?
Quote:
Originally Posted by ny101880
do you have any reference for Nagios in Fedora box that allow email notification?
I gave you a hint and steps to look at already. And the documentation explains exactly what needs to be done to make Nagios e-mail alerts. It really is not hard to do. If you start posting *exactly* which configuration files you changed (and what), if the verification check on Nagios startup went OK, how you made it check a failed service and what the logs say about that event, then I can assist. If you keep on posting descriptions of what you did, then there's nothing there that helps me help you.
Yes I can, but you'll have to agree you do the work.
I. Please have Nagios configured and running beforehand. If you have problems making Nagios itself run, start Nagios and review the warnings it posts on screen or to the logfile. Post any warnings you can't solve yourself.
II. For now it is best you choose a service to check on the host you run Nagios as. Pick a webserver or something.
III. When posting please use BB code tags.
Here's what I need to know:
0. From commands.cfg post any changes you made.
1. From contacts.cfg post the contactgroup and contact you changed or added.
2. From localhost.cgi post the host, hostgroup and service you changed or added.
3. From templates.cgi and timeperiods.cfg post any definition you changed or added.
4. Start Nagios and review any warnings it posts on screen or to the logfile. Post any warnings you can't solve yourself.
Yes I can, but you'll have to agree you do the work.
I. Please have Nagios configured and running beforehand. If you have problems making Nagios itself run, start Nagios and review the warnings it posts on screen or to the logfile. Post any warnings you can't solve yourself.
II. For now it is best you choose a service to check on the host you run Nagios as. Pick a webserver or something.
III. When posting please use BB code tags.
Here's what I need to know:
0. From commands.cfg post any changes you made.
1. From contacts.cfg post the contactgroup and contact you changed or added.
2. From localhost.cgi post the host, hostgroup and service you changed or added.
3. From templates.cgi and timeperiods.cfg post any definition you changed or added.
4. Start Nagios and review any warnings it posts on screen or to the logfile. Post any warnings you can't solve yourself.
Not everyone has spent their childhood in front of a Linux Box!
Last edited by Tinkster; 07-15-2008 at 03:54 PM.
Reason: language clean-up
Not everyone has spent their childhood in front of a Linux Box! ... and walk him through it as if it were a clean install.
Dear me... well, I'll jump in, mainly because I'm having the same problem. I've read the docs, I've installed nagios, and it works lovely! The only thing I can't figure out for the life of me is how the whole email thing-a-ma-bob works. Much like the fellow above, it's not a question of starting Nagios and seeing if it works. It does. It's lovely, pretty, but won't spit out emails! So I'll ask the painfully obvious questions because as above, I have spent my childhood in front of a WINDOWS box. And before you say it, yes, heavy retardation...
Question 1) mailx appears to be the 'go to' command, the mac daddy, the daddy mac, THIS is the thing to run (thus speaketh every thread). Ok, so I type in mailx -s tacos myemail@hurrah.com - now, I expect to get an email with no body, but instead, it just -hangs-. I ^c my way clear (twice to cancel sending message) and now I'm back at step one. Assuming that Nagios is smart enough to -try- to send the email and then just give up, where would I find it? tail of every log in /var/log shows nada, and tail nagios.log just shows the alerts.
Question 2) Let's assume that much like Mr. OP, I'm missing something basic. I installed mailx (oh wait, Ubuntu 8.04, and 7.10, nagios 3.0.1) and it didn't need postfix. But everyone says it's the shizzle, so I installed it as well. Now what? I'm no smartie pants (windows user, remember?) but something tells me I need to configure something -else- not in the docs that you geniuses configure as easily as breathing. So I'm missing something... how does nagios know a) where to send the email (what address), and b) can it just -blindly- spit out an email that my mail server will accept even though there's no mail server on my nagios box? Or, to put the question a different way, if you had JUST installed Ubuntu, can you type "mailx" with some string and have it send without editing anything? I have a feeling THIS is why my email notifications aren't working, I'm missing a step that I haven't seen ANYWHERE...
What's this magical file I must pico? Once I know that, I have a funny feeling that nagios will begin happily hammering me with emails!
-SE
Last edited by Tinkster; 07-15-2008 at 04:00 PM.
Reason: language clean-up
Not everyone has spent their childhood in front of a Linux Box!
First of all - this is not your thread.
Secondly, we don't really appreciate verbal abuse at LQ,
if you don't like that go somewhere else; if you do it
again you'll be slapped over the beak.
Thirdly - if you're unhappy with my comments, contact me
off the boards, otherwise you're running the risk of being
slapped sooner than you expected.
Fourthly: there's no point in trying to talk to someone
about a complex to configure system as nagios as if it
were a clean install - the flexibility is the whole point
of the product, and a screwed up config that's being replaced
with a non-config scenario won't help anyone.
And last not least: it's not a good idea to pick a fight
with mods or senior members.
Hurrah again! Well... hopefully (no offense) everyone will skip over the little epsiode of name-calling I partook in, and get right to the goodies. Please keep in mind I myself am a linux n00blet so this little trial/error thing might get cleaned up. Finally... YOU! Yeah, YOU! Be nice, take a look at this whenever and make it a little nicer. Not for me, I got my system working! But for everyone else who has this problem. Be kind, help others, pay it forward. Prologue over, time for the goodies!
First, let's do a reality check. For Ubuntu users, we want mailx and postfix. I know, mailx has no postfix need, but do it. We'll be editing files later. All installed? Awesomeness!
Now, let's give a peek at a magical file. It's important, and we'll need to remember it for later. Again, for Ubuntu users, we want to check on the mail logfile. For the benefit of doing this from the nagios objects directory, we want to type the following:
tail /var/log/mail.info
If it has errors (and it should), save 'em. I saw a bunch of nasty ones, and this indicates that the mystical magical file above that wasn't edited belonged to postfix! Let's check that file out now!
sudo su (ubuntu users... muahahaha, just makes things easier)
pico /etc/postfix/main.cf
My file was pretty generic, and I only zeroed in on a handful of options towards the bottom. While other users might look at this and cry foul, it WORKS! Deal with it!
I forgot what I changed (obviously the yourname.com stuff) - and I was uable to figure out what it was sending as (nagios@yourname.com I believe) so I set up a whole truckload of aliases on our mail server (root, nagios, nagcmd) and I'll begin deleting them one by one until it's just nagios forwarding to myself and a co-admin, but that should at least get you in the right direction!
"But Solemn-brah, I still can't get this snot to work!"
GET A TISSUE AND SAVE YOUR ISSUE! ...I kid! I kid, silly boy... scroll up for that tail command, and tail /var/log/mail.info - the message at the bottom (tail shows you the last couple lines of a logfile, convenient if you're troubleshooting) will have an error code in it. Take that error, go to your favorite search engine and look it up! You should find some helpful info on what the error really means and how to fix it, or at least point you in the right direction.
And no, I don't write fixes I just try to help out where I can and provide information to those who need it. Feel free to post in this thread if you have further questions and I'll see what I can do, but the BEST THING you can do is LOOK IT UP!
Things we learned from the linux idiot:
tail is awesome, tail is good, get yourself some tail.
/var/log is also awesome... lots of tail in there, tail it ALL!
/etc/postfix/main.cf is evil and confusing... cry hard, I'm sorry!
/usr/local/nagios/var/nagios.log is relatively blah for email testing
A byproduct of this is that you'll start getting OTHER email messages, especially if you set up 'root' as a valid email on your server. I'm seeing some cool stuff I've wondered about for a while (cron jobs not working because I typo'd, etc.) all because now root can send out email to 'itself'. I am not sure what that's all about, but I have a feeling that the 'localhost' combined with the other yourname.com's are allowing all those happy emergent messages to actually get through!
-SE
P.S.: Hiroyatamoto - you're my "Hiro" You're right, and I've taken your words to heart and haven't chewed out a windows user for the 'any key' question in almost... two whole hours! ^_^ New leafs are cool!
Last edited by Tinkster; 07-16-2008 at 01:17 PM.
Reason: ...
Last edited by Tinkster : Today at 01:17 PM. Reason: ...
*snickers*
Anyway, assuming this will get the same faux editing, I'll just jump right to it.
Stuff forgotten in last post:
After each change to your .cf file for postfix, remember to tail the mail.info file! If you see nothing has changed, do that magical restart command:
sudo /etc/init.d/postfix restart
Remember boys and girls (girls use linux?!), if you change a config, you must restart your proggy!
And since I was a little vague, since root is now able to send emails as well, you'll get any glitches (I got anacron and cron emails for zimbra... whoopsie!) mailed to you for free! Always a nice perk...
What else... ahhh yes... for sanity, it may be a good idea to change the notification times in Nagios so it doesn't do it ever half-hour. I believe this is in the templates.cfg file for nagios for the "generic-service". I changed mine to 360 minutes (6 hours) so that I don't get -slammed- with messages.
Beyond that, I'm sure if you clean this all up and pull out the commands, you'll get a fairly straight-forward way of not only figuring out -why- the emails aren't sending (half of the magic) and then the -how- to get them working!
[mod_edit]snip[/mod_edit]
-SE the beakless
Last edited by Tinkster; 07-16-2008 at 03:23 PM.
Reason: ...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.