I just have a rather easy misunderstanding of something, The services page says:
%services.service_status = “2”
If you want to be alerted of Nagios errors, but what file does this go in? I assume it goes in alerts.php but I want to be sure.
And while I’m here, http://docs.librenms.org/Extensions/Alerting/ talks about %macros.port_down, do all those lines go in the same file the above line I am asking about go? I originally put the %services.service in config.php and when I restarted apache, LibeNMS wouldnt load, so I dont think thats right. Can someone help guide me quickly? Just give me a example of what file to edit and how to write a nagios alert?
Thanks
No. I read that prior to posting this, unless Im incredibly stupid they dont really say where exactly to set up this stuff file wise. I need an example of the EXACT location on linux to open and configure those lines.
Those rules don’t go into a file, they are managed via the webinterface. If you click up in the main menu on “Alerts” and then “Alert Rules” you should arrive at a list of rules.
I have two alerts configured for services:
- Service warning: %services.service_status = “1”
- Service critical: %services.service_status = “2”
with matching templates to send me nicely formatted HTML emails with big red letters, if something goes into critical.
@florianbeer I suggest submitting a PR to add those to the alert rule collection ![:slight_smile: :slight_smile:](https://community.librenms.org/images/emoji/twitter/slight_smile.png?v=5)
./misc/alert_rules.json
I wasn’t sure if they where defaults or I added them at some point.
Will make a PR shortly ![:slight_smile: :slight_smile:](https://community.librenms.org/images/emoji/twitter/slight_smile.png?v=5)
1 Like
Thanks. Another dumb simple question, when using the WebUI do you just the && ending? Since you have to choose &&/or to end the alert rule.
Thanks
If there is only one entry it doesn’t matter if it ends in && or ||. I always pick && myself.
@florianbeer Care to share your templates? Would love to see what others are using!
<div style="font-family:Helvetica;">
<h2>{if %state == 1}<span style="color:red;">%severity{else}<span style="color:green;">recovering{/if}</span></h2>
<b>Host:</b> %hostname<br>
<b>Duration:</b> %elapsed<br>
<br>
{if %faults}
{foreach %faults}<b>%value.service_desc - %value.service_type</b><br>
%value.service_message<br>
<small>%value.service_param</small><br>
<br>
{/foreach}
{/if}
</div>
1 Like