Hello,
For now I see that we can put custom value as label for Alertmanager in the corresponding transport.
But it is only static string value.
I needed to add a dynamic label to get information such as the corresponding port name for a Port down alert.
The following lines of code worked for me. (in ./LibreNMS/Alert/Transport/Alertmanager.php in function contactAlertmanager)
# Add ifName in case of port alert
if (!empty($obj['faults'][1]['ifName'])) {
$data[0]['labels']['ifName'] = $obj['faults'][1]['ifName'];
}
But I was wondering if it is useful to add the possibility to add those custom label and reach all the $alert[‘faults’] value.
I can propose a PR for this but first I need some advice please.
Should I add a new textarea in the Alertmanager transport popup or use the existing one called Alertmanager Options and add like a prefix to handle dynamic value instead of static one.
Thanks in advance for your help and have a nice day!
geg347