Alert template for Services

I’m trying to send a alert when a service status is changed to warning.

That is working, but i seems that the alert is sent for all services, but not the one with warning.

Is it possible to get the alert template send me only the de details about the service in warning state?

This my ‘dummy’ device, where i added the services; the services are checking each site using a nagios plugin.

Here is the template; nothing special here:

Here is the alert template i’ve found on the forum:

Severity: {{ $alert->severity }}
Rule: @if ($alert->name)
{{ $alert->name }}
@else
{{ $alert->rule }}
@endif
@if ($alert->state == 0)
Time elapsed: {{ $alert->elapsed }}
@endif
Timestamp: {{ $alert->timestamp }}
Unique-ID: {{ $alert->uid }}

@if ($alert->faults)
Faults:

@foreach ($alert->faults as $key => $value)
#{{ $key }}: Service: {{ $value['service_ip'] }}
Description: {{ $value['service_desc'] }}
Message: {{ $value['service_message'] }}

@endforeach 
@endif

Only now the array contains all the services that are Green, but not the yellow Warning; and that latter i’m interessted in :slight_smile:

Thank you for your help so far.

It is fixed now; now I only get the warnings and criticals of only the services that have this status.

These alert rules i’ve found in the rule library, under services warning and critical, i only changed them to Certificate waring and critical:

And this template i’ve found on the LibreNMS forum:

Service Alert:
` Time     : {{ $alert->timestamp }} `
` State    : @if ($alert->state == 1) <span style="color:red;">✋Warning</span> @endif @if ($alert->state == 2) <span style="color:goldenrod;">Acknowledged</span>  @endif @if ($alert->state == 3) <span style="color:green;">Recovering</span> @endif @if ($alert->state == 0) <span style="color:green;">Recovered</span> @endif`
` Rule     : @if ($alert->name){{ $alert->name }} @else {{ $alert->rule }} @endif `
` Unique-ID: {{ $alert->uid }}`
` ⏳ Time elapsed: {{ $alert->elapsed }}`
@if ($alert->faults)

Faults:

@foreach ($alert->faults as $key => $value)
#{{ $key }}: Service: {{ $value['service_ip'] }}
Description: {{ $value['service_desc'] }}
Message: {{ $value['service_message'] }}

@endforeach 
@endif
@if ($alert->alert_notes)
✍ *Notes:* 
{{$alert->alert_notes}}
@endif

I attached this template to both of the alert rules.

The result is this via PushOver: