Nagios e-mail notifications on RPi

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have a PC on my network that I want to monitor with a simple periodic ping from a Raspberry Pi. I'm totally new to the RPi and Linux and this seemingly simple project is turning into a massive headache. However, I've made massive progress in installing Nagios PI on the RPi and configuring it to monitor my PC with a periodic ping via NConf. So within the Nagios GUI I can see when my PC is up and down (this took 2 days to get this far). I also setup e-mail on the RPi using sSMTP and I can send e-mails from the command line (this took another long day).



So all I now need to do is get Nagios/NConf to send me an e-mail when it sees my PC is down. Unfortunately, this is where my luck or talent (or both!) have run out. Can anyone help point me in the right direction to get these e-mail notifications working within Nagios/NConf please?



Any ideas greatly appreciated!



Cheers
Simon







share|improve this question
















  • 1




    If not for a learning experience, monitoring a PC with Nagios seems like using a cannon to kill a flea.
    – Rui F Ribeiro
    Jan 30 at 19:08










  • sure it starts out with "just one e-mail" but then 10,000 emails later nagios is all like why don't you talk to me any more?
    – thrig
    Jan 30 at 19:14










  • Oh dear, I had no idea. What would you recommend to run on the RPi that will notify me once when my PC is down then>?
    – AnimalHungry
    Jan 30 at 19:26














up vote
0
down vote

favorite












I have a PC on my network that I want to monitor with a simple periodic ping from a Raspberry Pi. I'm totally new to the RPi and Linux and this seemingly simple project is turning into a massive headache. However, I've made massive progress in installing Nagios PI on the RPi and configuring it to monitor my PC with a periodic ping via NConf. So within the Nagios GUI I can see when my PC is up and down (this took 2 days to get this far). I also setup e-mail on the RPi using sSMTP and I can send e-mails from the command line (this took another long day).



So all I now need to do is get Nagios/NConf to send me an e-mail when it sees my PC is down. Unfortunately, this is where my luck or talent (or both!) have run out. Can anyone help point me in the right direction to get these e-mail notifications working within Nagios/NConf please?



Any ideas greatly appreciated!



Cheers
Simon







share|improve this question
















  • 1




    If not for a learning experience, monitoring a PC with Nagios seems like using a cannon to kill a flea.
    – Rui F Ribeiro
    Jan 30 at 19:08










  • sure it starts out with "just one e-mail" but then 10,000 emails later nagios is all like why don't you talk to me any more?
    – thrig
    Jan 30 at 19:14










  • Oh dear, I had no idea. What would you recommend to run on the RPi that will notify me once when my PC is down then>?
    – AnimalHungry
    Jan 30 at 19:26












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a PC on my network that I want to monitor with a simple periodic ping from a Raspberry Pi. I'm totally new to the RPi and Linux and this seemingly simple project is turning into a massive headache. However, I've made massive progress in installing Nagios PI on the RPi and configuring it to monitor my PC with a periodic ping via NConf. So within the Nagios GUI I can see when my PC is up and down (this took 2 days to get this far). I also setup e-mail on the RPi using sSMTP and I can send e-mails from the command line (this took another long day).



So all I now need to do is get Nagios/NConf to send me an e-mail when it sees my PC is down. Unfortunately, this is where my luck or talent (or both!) have run out. Can anyone help point me in the right direction to get these e-mail notifications working within Nagios/NConf please?



Any ideas greatly appreciated!



Cheers
Simon







share|improve this question












I have a PC on my network that I want to monitor with a simple periodic ping from a Raspberry Pi. I'm totally new to the RPi and Linux and this seemingly simple project is turning into a massive headache. However, I've made massive progress in installing Nagios PI on the RPi and configuring it to monitor my PC with a periodic ping via NConf. So within the Nagios GUI I can see when my PC is up and down (this took 2 days to get this far). I also setup e-mail on the RPi using sSMTP and I can send e-mails from the command line (this took another long day).



So all I now need to do is get Nagios/NConf to send me an e-mail when it sees my PC is down. Unfortunately, this is where my luck or talent (or both!) have run out. Can anyone help point me in the right direction to get these e-mail notifications working within Nagios/NConf please?



Any ideas greatly appreciated!



Cheers
Simon









share|improve this question











share|improve this question




share|improve this question










asked Jan 30 at 18:39









AnimalHungry

1




1







  • 1




    If not for a learning experience, monitoring a PC with Nagios seems like using a cannon to kill a flea.
    – Rui F Ribeiro
    Jan 30 at 19:08










  • sure it starts out with "just one e-mail" but then 10,000 emails later nagios is all like why don't you talk to me any more?
    – thrig
    Jan 30 at 19:14










  • Oh dear, I had no idea. What would you recommend to run on the RPi that will notify me once when my PC is down then>?
    – AnimalHungry
    Jan 30 at 19:26












  • 1




    If not for a learning experience, monitoring a PC with Nagios seems like using a cannon to kill a flea.
    – Rui F Ribeiro
    Jan 30 at 19:08










  • sure it starts out with "just one e-mail" but then 10,000 emails later nagios is all like why don't you talk to me any more?
    – thrig
    Jan 30 at 19:14










  • Oh dear, I had no idea. What would you recommend to run on the RPi that will notify me once when my PC is down then>?
    – AnimalHungry
    Jan 30 at 19:26







1




1




If not for a learning experience, monitoring a PC with Nagios seems like using a cannon to kill a flea.
– Rui F Ribeiro
Jan 30 at 19:08




If not for a learning experience, monitoring a PC with Nagios seems like using a cannon to kill a flea.
– Rui F Ribeiro
Jan 30 at 19:08












sure it starts out with "just one e-mail" but then 10,000 emails later nagios is all like why don't you talk to me any more?
– thrig
Jan 30 at 19:14




sure it starts out with "just one e-mail" but then 10,000 emails later nagios is all like why don't you talk to me any more?
– thrig
Jan 30 at 19:14












Oh dear, I had no idea. What would you recommend to run on the RPi that will notify me once when my PC is down then>?
– AnimalHungry
Jan 30 at 19:26




Oh dear, I had no idea. What would you recommend to run on the RPi that will notify me once when my PC is down then>?
– AnimalHungry
Jan 30 at 19:26










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Nagios uses contact definitions that must be linked to the host or other such monitoring bit. The contact could be placed in in contacts.cfg or some other configuration file, depending on how you want to manage things:



define contact 
contact_name foobar
alias admin of something
email fixmeyouremailhere@example.net
host_notification_commands notify-host-by-email
host_notification_options d,u,r
host_notification_period 24x7
service_notification_commands notify-service-by-email
service_notification_options w,u,c,r
service_notification_period 24x7



And then in your host definition reference the contact:



define host 
host_name ...
...
contacts foobar



And then restart nagios, fix any errors, etc.






share|improve this answer




















  • Thanks! I have contacts_nagio2.cfg in the etc/nagio3/conf.d directory which now looks like this: define contact contact_name root alias Root email simon@mydomain.com host_notification_commands notify-host-by-email host_notification_options d,r host_notification_period 24x7 service_notification_commands notify-service-by-email service_notification_options w,u,c,r service_notification_period 24x7
    – AnimalHungry
    Jan 30 at 23:00










  • I didn’t include the “u” option in host_notification_options as I only want to know when the PC goes down, and not when it’s back online. I don’t know whether I need to change the contact_name and alias so I left it as default. Then I don’t have a file called hosts, but I have one called localhost_nagios2.cfg. But in there I only have three “define service” sections. Which file is the host definition in? Thanks again! Simon
    – AnimalHungry
    Jan 30 at 23:00










  • Nagios probably includes any *.cfg file in the /etc/nagio3/conf.d directory automatically, so you likely should create a new hosts.cfg in that directory to hold your host definitions.
    – thrig
    Jan 30 at 23:13










  • Thanks again. I tried that and it still doesn't work. I'm afraid I've spent four days trying to get this to work and I've now run out of time I can spend on it right now. Thanks for trying!
    – AnimalHungry
    Jan 31 at 2:11










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f420760%2fnagios-e-mail-notifications-on-rpi%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Nagios uses contact definitions that must be linked to the host or other such monitoring bit. The contact could be placed in in contacts.cfg or some other configuration file, depending on how you want to manage things:



define contact 
contact_name foobar
alias admin of something
email fixmeyouremailhere@example.net
host_notification_commands notify-host-by-email
host_notification_options d,u,r
host_notification_period 24x7
service_notification_commands notify-service-by-email
service_notification_options w,u,c,r
service_notification_period 24x7



And then in your host definition reference the contact:



define host 
host_name ...
...
contacts foobar



And then restart nagios, fix any errors, etc.






share|improve this answer




















  • Thanks! I have contacts_nagio2.cfg in the etc/nagio3/conf.d directory which now looks like this: define contact contact_name root alias Root email simon@mydomain.com host_notification_commands notify-host-by-email host_notification_options d,r host_notification_period 24x7 service_notification_commands notify-service-by-email service_notification_options w,u,c,r service_notification_period 24x7
    – AnimalHungry
    Jan 30 at 23:00










  • I didn’t include the “u” option in host_notification_options as I only want to know when the PC goes down, and not when it’s back online. I don’t know whether I need to change the contact_name and alias so I left it as default. Then I don’t have a file called hosts, but I have one called localhost_nagios2.cfg. But in there I only have three “define service” sections. Which file is the host definition in? Thanks again! Simon
    – AnimalHungry
    Jan 30 at 23:00










  • Nagios probably includes any *.cfg file in the /etc/nagio3/conf.d directory automatically, so you likely should create a new hosts.cfg in that directory to hold your host definitions.
    – thrig
    Jan 30 at 23:13










  • Thanks again. I tried that and it still doesn't work. I'm afraid I've spent four days trying to get this to work and I've now run out of time I can spend on it right now. Thanks for trying!
    – AnimalHungry
    Jan 31 at 2:11














up vote
0
down vote













Nagios uses contact definitions that must be linked to the host or other such monitoring bit. The contact could be placed in in contacts.cfg or some other configuration file, depending on how you want to manage things:



define contact 
contact_name foobar
alias admin of something
email fixmeyouremailhere@example.net
host_notification_commands notify-host-by-email
host_notification_options d,u,r
host_notification_period 24x7
service_notification_commands notify-service-by-email
service_notification_options w,u,c,r
service_notification_period 24x7



And then in your host definition reference the contact:



define host 
host_name ...
...
contacts foobar



And then restart nagios, fix any errors, etc.






share|improve this answer




















  • Thanks! I have contacts_nagio2.cfg in the etc/nagio3/conf.d directory which now looks like this: define contact contact_name root alias Root email simon@mydomain.com host_notification_commands notify-host-by-email host_notification_options d,r host_notification_period 24x7 service_notification_commands notify-service-by-email service_notification_options w,u,c,r service_notification_period 24x7
    – AnimalHungry
    Jan 30 at 23:00










  • I didn’t include the “u” option in host_notification_options as I only want to know when the PC goes down, and not when it’s back online. I don’t know whether I need to change the contact_name and alias so I left it as default. Then I don’t have a file called hosts, but I have one called localhost_nagios2.cfg. But in there I only have three “define service” sections. Which file is the host definition in? Thanks again! Simon
    – AnimalHungry
    Jan 30 at 23:00










  • Nagios probably includes any *.cfg file in the /etc/nagio3/conf.d directory automatically, so you likely should create a new hosts.cfg in that directory to hold your host definitions.
    – thrig
    Jan 30 at 23:13










  • Thanks again. I tried that and it still doesn't work. I'm afraid I've spent four days trying to get this to work and I've now run out of time I can spend on it right now. Thanks for trying!
    – AnimalHungry
    Jan 31 at 2:11












up vote
0
down vote










up vote
0
down vote









Nagios uses contact definitions that must be linked to the host or other such monitoring bit. The contact could be placed in in contacts.cfg or some other configuration file, depending on how you want to manage things:



define contact 
contact_name foobar
alias admin of something
email fixmeyouremailhere@example.net
host_notification_commands notify-host-by-email
host_notification_options d,u,r
host_notification_period 24x7
service_notification_commands notify-service-by-email
service_notification_options w,u,c,r
service_notification_period 24x7



And then in your host definition reference the contact:



define host 
host_name ...
...
contacts foobar



And then restart nagios, fix any errors, etc.






share|improve this answer












Nagios uses contact definitions that must be linked to the host or other such monitoring bit. The contact could be placed in in contacts.cfg or some other configuration file, depending on how you want to manage things:



define contact 
contact_name foobar
alias admin of something
email fixmeyouremailhere@example.net
host_notification_commands notify-host-by-email
host_notification_options d,u,r
host_notification_period 24x7
service_notification_commands notify-service-by-email
service_notification_options w,u,c,r
service_notification_period 24x7



And then in your host definition reference the contact:



define host 
host_name ...
...
contacts foobar



And then restart nagios, fix any errors, etc.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 30 at 19:37









thrig

22.3k12852




22.3k12852











  • Thanks! I have contacts_nagio2.cfg in the etc/nagio3/conf.d directory which now looks like this: define contact contact_name root alias Root email simon@mydomain.com host_notification_commands notify-host-by-email host_notification_options d,r host_notification_period 24x7 service_notification_commands notify-service-by-email service_notification_options w,u,c,r service_notification_period 24x7
    – AnimalHungry
    Jan 30 at 23:00










  • I didn’t include the “u” option in host_notification_options as I only want to know when the PC goes down, and not when it’s back online. I don’t know whether I need to change the contact_name and alias so I left it as default. Then I don’t have a file called hosts, but I have one called localhost_nagios2.cfg. But in there I only have three “define service” sections. Which file is the host definition in? Thanks again! Simon
    – AnimalHungry
    Jan 30 at 23:00










  • Nagios probably includes any *.cfg file in the /etc/nagio3/conf.d directory automatically, so you likely should create a new hosts.cfg in that directory to hold your host definitions.
    – thrig
    Jan 30 at 23:13










  • Thanks again. I tried that and it still doesn't work. I'm afraid I've spent four days trying to get this to work and I've now run out of time I can spend on it right now. Thanks for trying!
    – AnimalHungry
    Jan 31 at 2:11
















  • Thanks! I have contacts_nagio2.cfg in the etc/nagio3/conf.d directory which now looks like this: define contact contact_name root alias Root email simon@mydomain.com host_notification_commands notify-host-by-email host_notification_options d,r host_notification_period 24x7 service_notification_commands notify-service-by-email service_notification_options w,u,c,r service_notification_period 24x7
    – AnimalHungry
    Jan 30 at 23:00










  • I didn’t include the “u” option in host_notification_options as I only want to know when the PC goes down, and not when it’s back online. I don’t know whether I need to change the contact_name and alias so I left it as default. Then I don’t have a file called hosts, but I have one called localhost_nagios2.cfg. But in there I only have three “define service” sections. Which file is the host definition in? Thanks again! Simon
    – AnimalHungry
    Jan 30 at 23:00










  • Nagios probably includes any *.cfg file in the /etc/nagio3/conf.d directory automatically, so you likely should create a new hosts.cfg in that directory to hold your host definitions.
    – thrig
    Jan 30 at 23:13










  • Thanks again. I tried that and it still doesn't work. I'm afraid I've spent four days trying to get this to work and I've now run out of time I can spend on it right now. Thanks for trying!
    – AnimalHungry
    Jan 31 at 2:11















Thanks! I have contacts_nagio2.cfg in the etc/nagio3/conf.d directory which now looks like this: define contact contact_name root alias Root email simon@mydomain.com host_notification_commands notify-host-by-email host_notification_options d,r host_notification_period 24x7 service_notification_commands notify-service-by-email service_notification_options w,u,c,r service_notification_period 24x7
– AnimalHungry
Jan 30 at 23:00




Thanks! I have contacts_nagio2.cfg in the etc/nagio3/conf.d directory which now looks like this: define contact contact_name root alias Root email simon@mydomain.com host_notification_commands notify-host-by-email host_notification_options d,r host_notification_period 24x7 service_notification_commands notify-service-by-email service_notification_options w,u,c,r service_notification_period 24x7
– AnimalHungry
Jan 30 at 23:00












I didn’t include the “u” option in host_notification_options as I only want to know when the PC goes down, and not when it’s back online. I don’t know whether I need to change the contact_name and alias so I left it as default. Then I don’t have a file called hosts, but I have one called localhost_nagios2.cfg. But in there I only have three “define service” sections. Which file is the host definition in? Thanks again! Simon
– AnimalHungry
Jan 30 at 23:00




I didn’t include the “u” option in host_notification_options as I only want to know when the PC goes down, and not when it’s back online. I don’t know whether I need to change the contact_name and alias so I left it as default. Then I don’t have a file called hosts, but I have one called localhost_nagios2.cfg. But in there I only have three “define service” sections. Which file is the host definition in? Thanks again! Simon
– AnimalHungry
Jan 30 at 23:00












Nagios probably includes any *.cfg file in the /etc/nagio3/conf.d directory automatically, so you likely should create a new hosts.cfg in that directory to hold your host definitions.
– thrig
Jan 30 at 23:13




Nagios probably includes any *.cfg file in the /etc/nagio3/conf.d directory automatically, so you likely should create a new hosts.cfg in that directory to hold your host definitions.
– thrig
Jan 30 at 23:13












Thanks again. I tried that and it still doesn't work. I'm afraid I've spent four days trying to get this to work and I've now run out of time I can spend on it right now. Thanks for trying!
– AnimalHungry
Jan 31 at 2:11




Thanks again. I tried that and it still doesn't work. I'm afraid I've spent four days trying to get this to work and I've now run out of time I can spend on it right now. Thanks for trying!
– AnimalHungry
Jan 31 at 2:11












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f420760%2fnagios-e-mail-notifications-on-rpi%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?