Define standard subject line containing CPU load in LibreNMS

Hello All,

I am trying to define standard subject line (followed by organization in previous monitoring tool) for LibreNMS with the alerting.

So far all works.

Question:

  1. Is there a way to edit the title of the messages?

Expected subject for mail as per previous monitoring tool is,

WARNING : My server name : CPU load : WARNING
eg.
WARNING : MYDB01 : Load : 19.73 16.09 11.49 : 19.73 15 : WARNING

  1. How i can display CPU usage, Memory Usage, Disk Usage in mail body. (I mean output of w, free, df command) ?

Please suggest.

Yes you can edit the subject ā€œAlert titleā€ within your Alert templates with placeholders like

WARNING : {{ $alert->sysName }} : CPU load : WARNING
or
WARNING : {{ $alert->hostname }} ( {{ $alert->sysName }} ) : CPU load : WARNING

i think if the data is in an array then maybe you canā€™t put it in your subject as they are part of the for loop in your template to iterate through each item. Your possibly interested in $value['processor_usage'] for CPU, as for storage and memory, see the examples in here https://docs.librenms.org/Alerting/Templates/

Hello All

@Chas, Thanks for help.

My query is resolved.
Here, I have used PHP query to display CPU load in ā€œAlert Titleā€ within ā€œAlert Templateā€.

My requirement was
##############################################################
WARNING : My server name : CPU load : WARNING
eg.
WARNING : MYDB01 : Load : 19.73 16.09 11.49 : 19.73 15 : WARNING
##############################################################

Solution applied
##############################################################
WARNING : CPU utilization : {{ strtoupper($alert->sysName) }} : <?php echo `w | head -1 | awk '{ print "CPU"" "$8" "$9" "$10" "$11" "$12 }'` ?> : WARNING

Output:
WARNING : CPU utilization : MYDB01 : CPU average: 1.01, 1.14, 1.05 : WARNING
##############################################################

1 Like