Closed sarabveer closed 6 months ago
Also I did check if the config for discord-embed-fields
was applied.
$ lnms config:get --dump | jq | grep discord
"discord-embed-fields": "hostname,name,timestamp,severity",
The fix for this is to put hostname,name,timestamp,severity
in the field in the alert transport settings. If it is left empty, it seems an empty string is passed which causes the error.
Why were you trying to set discord-embed-fields in the global config?
Why were you trying to set discord-embed-fields in the global config?
I was trying to debug the issue. I did not realize the $this->config
variable being used in Discord.php
was the alert transport config, not global config.
The problem
This is showing up in the fields section of the Discord message. This behavior is happening by default on a new install when using the Discord alert transport with a webhook.
I have tried setting
discord-embed-fields
tohostname,sysName,timestamp,severity
by running the following command:and setting the following line in config.php:
but both of these methods did not fix the issue.
The issue lies in
Discord.php
on Line 105. Offending line: https://github.com/librenms/librenms/blob/master/LibreNMS/Alert/Transport/Discord.php#L105C48-L105C67The value of
$this->config['discord-embed-fields']
is an empty string. SoDEFAULT_EMBEDS
never gets used.Replacing Line 105 with:
$fields = explode(',', self::DEFAULT_EMBEDS);
yields correct behavior.There should be a check added to see if the config is set to an empty string and use the default embeds. I do not know why after setting the config, the an empty string is still returned as the config value.
Output of ./validate.php
What was the last working version of LibreNMS?
No response
Anything in the logs that might be useful for us?
No response