I want to remove "#1: sysObjectID =" from SMS transport, but how?

====================================

Component Version
LibreNMS 1.69-4-g28591c033
DB Schema 2020_07_27_00522_alter_devices_snmp_algo_columns (188)
PHP 7.4.12
Python 3.6.9
MySQL 10.1.47-MariaDB-0ubuntu0.18.04.1
RRDTool 1.7.0
SNMP NET-SNMP 5.7.3
OpenSSL

====================================

[OK] Composer Version: 1.10.17
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

Alert Template

{{ $alert->title }}
Severity: {{ $alert->severity }}
@if ($alert->state == 0) Time elapsed: {{ $alert->elapsed }} @endif
Timestamp: {{ $alert->timestamp }}
#Unique-ID: {{ $alert->uid }}
Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
@if ($alert->faults) Faults:
@foreach ($alert->faults as $key => $value)
{{ $key }}: {{ $value[‘string’] }}
Port: {{ $value[‘ifName’] }}
Port Name: {{ $value[‘ifAlias’] }}
#Port Status: {{ $value[‘message’] }}
#Port Descr: {{ $value[‘ifDescr’] }}
@endforeach
@endif

One of my delivered transport

Alert for device router.domain.local - Port status up/down, Alert for device router.domain.local - Port status up/down
Severity: critical
Timestamp: 2020-11-04 09:55:16
Unique-ID: 384
Rule: Port status up/down Faults:
#1: sysObjectID = .1.3.6.1.4.1.14988.1; sysDescr = RouterOS CCR1009-7G-1C-1S ; port_id = 723; ifDescr = ether5;
Port: ether5
Port Name: DBBL-Mirrirbazar
Port Status:
Port Descr: ether5

Now I want to only get

Alert for device router.domain.local - Port status up/down
Timestamp: 2020-11-04 09:55:16
Port: ether5
Port Name: DBBL-Mirrirbazar

Plain text is written in plain in the template, variables are written in “{{}}”.
So just compare the template with the received output and you can see what to remove.

Also read through this:

https://docs.librenms.org/Alerting/

1 Like

Hi @sakibmahmud

The variable “string” contains a few elements, including the sysObjectID. So get rid of it, and manually put only the variables you need.

{{ $value[‘string’] }}

Bye

1 Like