mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added two html alert template examples (#8360)
Added two html alert template examples. Asked pii100 for permission to include his and he said ok. Included my html service alert check that includes service_message. Added a note for html and graphs. I believe most people will find it useful on this page.
This commit is contained in:
committed by
Neil Lathwood
parent
25b96c1ab3
commit
7946f15b44
@@ -191,6 +191,56 @@ Conditional formatting example, will display a link to the host in email or just
|
||||
|
||||
Note the use of double-quotes. Single quotes (`'`) in templates will be escaped (replaced with `\'`) in the output and should therefore be avoided.
|
||||
|
||||
## Examples HTML
|
||||
|
||||
Note: To use HTML emails you must set HTML email to Yes in the WebUI under Global Settings > Alerting Settings > Email transport > Use HTML emails
|
||||
|
||||
Note: To include Graphs you must enable unauthorized graphs in config.php. Allow_unauth_graphs_cidr is optional, but more secure.
|
||||
```
|
||||
$config['allow_unauth_graphs_cidr'] = array(127.0.0.1/32');
|
||||
$config['allow_unauth_graphs'] = true;
|
||||
```
|
||||
|
||||
Service Alert:
|
||||
```<div style="font-family:Helvetica;">
|
||||
<h2>{if %state == 1}<span style="color:red;">%severity{/if}
|
||||
{if %state == 2}<span style="color:goldenrod;">acknowledged{/if}</span>
|
||||
{if %state == 3}<span style="color:green;">recovering{/if}</span>
|
||||
{if %state == 0}<span style="color:green;">recovered{/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>
|
||||
<br>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
```
|
||||
|
||||
Processor Alert with Graph:
|
||||
```%title <br>
|
||||
Severity: %severity <br>
|
||||
{if %state == 0}Time elapsed: %elapsed{/if}
|
||||
Timestamp: %timestamp <br>
|
||||
Alert-ID: %id <br>
|
||||
Rule: {if %name}%name{else}%rule{/if} <br>
|
||||
{if %faults}Faults:
|
||||
{foreach %faults}
|
||||
#%key: %value.string <br>
|
||||
{/foreach}
|
||||
{if %faults}<b>Faults:</b><br>
|
||||
{foreach %faults}<img src="https://server/graph.php?device=%value.device_id&type=device_processor&width=459&height=213&lazy_w=552&from=end-72h%22/%3E<br>
|
||||
https://server/graphs/id=%value.device_id/type=device_processor/<br>
|
||||
{/foreach}
|
||||
Template: CPU alert <br>
|
||||
{/if}
|
||||
{/if}
|
||||
```
|
||||
|
||||
## Included
|
||||
|
||||
We include a few templates for you to use, these are specific to the type of alert rules you are creating. For example if you create a rule that would alert on BGP sessions then you can
|
||||
|
Reference in New Issue
Block a user