LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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



Reply
 
Search this Thread
Old 05-28-2008, 11:37 PM   #1
ny101880
LQ Newbie
 
Registered: May 2008
Posts: 5

Rep: Reputation: 0
NAGIOS notification


Good day,

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.

Hope somebody can help.

Thanks a lot,
ny101880
 
Old 05-29-2008, 09:19 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,688
Blog Entries: 54

Rep: Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955
Maybe start by explaining in more detail what you tried to configure?
 
Old 05-30-2008, 09:29 AM   #3
ny101880
LQ Newbie
 
Registered: May 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Nagios notification

Hi,

Thanks for the question and the reply.

I install nagios from the quick install guide from this link
http://nagios.sourceforge.net/docs/3...rt-fedora.html
using fedora core 6.

Currently i wanted to have my nagios send notification incase some services is down.
I tried to follow the notification procedure but it wont work.

im still newbie in linux and nagios.

Im hoping you could help me setup email notification in nagios.

Thanks a lot,
ny101880
 
Old 05-30-2008, 10:24 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,688
Blog Entries: 54

Rep: Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955
Quote:
Originally Posted by ny101880 View Post
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?
 
Old 06-02-2008, 04:28 AM   #5
ny101880
LQ Newbie
 
Registered: May 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Nagios Notification

Good day,

Actually the instructions are in the path below,

it just weird because some config files are not present after the installation like host.cgi, hostgroup.cgi,contactgroup.cgi,escalation.cgi.

No email was sent if the host is down.

Some of my config's are switch.cgi,windows.cgi,localhost.cgi.

do you have any reference for Nagios in Fedora box that allow email
notification?

thanks a lot,
Louwil
 
Old 06-02-2008, 06:09 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,688
Blog Entries: 54

Rep: Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955
Quote:
Originally Posted by ny101880 View Post
Actually the instructions are in the path below,
Am I missing something here?


Quote:
Originally Posted by ny101880 View Post
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 View Post
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.
 
Old 06-03-2008, 05:19 AM   #7
ny101880
LQ Newbie
 
Registered: May 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Hi,

sorry i make my post so confusing... anyway, can you help me setup from the scratch using FC6?
Thanks
 
Old 06-03-2008, 10:32 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,688
Blog Entries: 54

Rep: Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955
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.
 
Old 06-25-2008, 11:27 PM   #9
Hiroyatamoto
LQ Newbie
 
Registered: Jun 2008
Posts: 12

Rep: Reputation: 0
Angry Take the stick out of your behind!

Quote:
Originally Posted by unSpawn View Post
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 04:54 PM. Reason: language clean-up
 
Old 07-15-2008, 03:55 PM   #10
SolemnEntropy
LQ Newbie
 
Registered: Jul 2008
Posts: 3

Rep: Reputation: 0
Nagios email stuffs

Quote:
Originally Posted by Hiroyatamoto View Post
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 05:00 PM. Reason: language clean-up
 
Old 07-15-2008, 04:58 PM   #11
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,004
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Quote:
Originally Posted by Hiroyatamoto View Post
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.



Cheers,
Tink
 
0 members found this post helpful.
Old 07-16-2008, 11:37 AM   #12
SolemnEntropy
LQ Newbie
 
Registered: Jul 2008
Posts: 3

Rep: Reputation: 0
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!

myhostname = yourname.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = yourname.com
mydestination = localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

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 02:17 PM. Reason: ...
 
Old 07-16-2008, 03:34 PM   #13
SolemnEntropy
LQ Newbie
 
Registered: Jul 2008
Posts: 3

Rep: Reputation: 0
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 04:23 PM. Reason: ...
 
Old 07-16-2008, 04:24 PM   #14
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,004
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Btw, you COULD have just edited your previous post to reflect the
changes you'd like to see in it.



Cheers,
Tink
 
Old 01-04-2009, 02:10 AM   #15
mma0204
LQ Newbie
 
Registered: Aug 2004
Location: USA East
Posts: 1

Rep: Reputation: 0
I also modified my command.cfg file to use the correct path for mailx. I also installed ssmtp if that helps.

define command{
command_name notify-service-by-email
command_line /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$

Last edited by mma0204; 01-06-2009 at 11:49 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios Daemon, PID not found but rc.nagios runs agentc0re Slackware 1 07-03-2007 03:47 PM
LXer: Nagios 2.5 and Oreon 1.3 (Nagios web front end) installation with screenshots LXer Syndicated Linux News 0 08-11-2006 06:33 PM
LXer: Nagios and Oreon (Nagios web front end) installation and Configuration LXer Syndicated Linux News 0 07-18-2006 09:33 PM
Any help on NAGIOS ? sunlinux Linux - Software 1 07-18-2006 08:26 AM
E-Mail notification to users via SMS (gateway script ok, but notification script?!?) Riku2015 Linux - Networking 10 03-08-2002 11:16 AM


All times are GMT -5. The time now is 05:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration