Alert templates not showing anything

Tags: #<Tag:0x00007f3b80bf1c48>

I’m trying to understand alerting templates and i have created alert rule from collection - Portstatus up/down. I’m using default template and attached rule to it.
When alert fires only thing i see in the text message(SMS) is the alert title.

What am i missing?

SMS is a short message so most probably you cannot send all that data.
You have to check what your SMS provider is expecting, and if only the title is sent, then you have to create a template that write the most important alert information in the title.

Hello!

So this message would result in over 160 characters? Let me add that i have also tried this template:

{{ $alert->title }}
Device Name: {{ $alert->hostname }}
@foreach ($alert->faults as $key => $value)
{{ $key }}: {{ $value[‘string’] }}
@endforeach

but it was still the same

It may or may not be over 160 but my explanation was not good anyway.

What is important is to check what the provider is expecting, and how the transport in LibreNMS is written.

Which transport do you use ? What does the documentation say about it ?

Im using smseagle as transport and documentation is pretty simple. Nothing special. When it comes to provider i’d say there should not be an issue since i have another system sending text messages with plenty characters.

I should mention that if i don’t use any template i get messages like this:

Alert for device 10.10.10.10 - Port status up/down

I will look into smseagle log just in case. Is there any log in librenms regarding transport?

It looks like you have only the title which is sent. Never used that transport so I can tell a lot more about it.
Probably a look at the source code would give you answers.

I’m not developer but i think that this could be the reason. line “‘message’ => $obj[‘title’],”
From the source code:

public static function contactSmseagle($obj, $opts)
{
    $params = [
        'login' => $opts['user'],
        'pass' => $opts['token'],
        'to' => implode(',', $opts['to']),
        'message' => $obj['title'],
    ];
    $url = Str::startsWith($opts['url'], 'http') ? '' : 'http://';
    $url .= $opts['url'] . '/index.php/http_api/send_sms?' . http_build_query($params);
    $curl   = curl_init($url);

    set_curl_proxy($curl);
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

    $ret = curl_exec($curl);
    if (substr($ret, 0, 2) == "OK") {
        return true;
    } else {
        return false;
    }
}

Yes, it is. As I told you, it appears normal to send only the title to a SMS provider, because of the 160 char limit.
That way, a single alert can be detailed in your email, and short in your SMS. So if you want more details in your SMS, add more details in your alert title.