I’m trying to setup a port utilization over threshold alert on Libre. I’ve created the macro using (%macros.port_up = “1” && %macros.port = “1” && (%macros.port_out_usage_perc > “80” || %macros.port_in_usage_perc > “80”)) parameters. Problem is even thoug Libre itself sees the traffic being over the threshold, alert does not trigger. Any ideas why?
Also, when i create a template, i want to see which way(recieve or transmit) gets over the threshold. Which value should i use for this?
This might be a bug. Please paste this into mysql:
UPDATE `config` SET `config_value`='((%ports.ifInOctets_rate*8) / %ports.ifSpeed)*100', `config_default`='((%ports.ifInOctets_rate*8) / %ports.ifSpeed)*100' WHERE `config_name`='alert.macros.rule.port_in_usage_perc';
UPDATE `config` SET `config_value`='((%ports.ifOutOctets_rate*8) / %ports.ifSpeed)*100', `config_default`='((%ports.ifOutOctets_rate*8) / %ports.ifSpeed)*100' WHERE `config_name`='alert.macros.rule.port_out_usage_perc';
However your rule won’t work anyway, don’t use ||, separate the rules into two. That will then also solve your template issue as you can set a name to each one.
I know about the ||, i did macro the rule, that was just to give an idea. Separating the rule is a good idea, i’ll try that. If that doesn’t work then i’ll update the config.
I haven’t. I seperated the rule, let it stay for the night. It still didn’t trigger any alert. I’ll update the db as next step,will let you know how it went.
I’m not allowed the mess with the database, unfortunately will this work as a rule?
%macros.port_up = “1” && %macros.port = “1” && %macros.port_utilization > “80”
Hey Laf, i’ve been testing this for almost a week now and it seems to work. Big thanks for your help.
I have an additional question tho: How would i see in the mail whether or not utilization in ingress or egress?
The macro i’ve created has 2 checks about utilization %macros.port_out_usage_perc > “80” and %macros.port_in_usage_perc > "80. Template is stating something like;
{if %faults}Faults:
{foreach %faults}
#%key:
Port: %value.ifName
Port Name: %value.ifAlias
{/foreach}
{/if}
What should i add here to see whether the the port receiving this traffic or transmitting this traffic?
Unfortunately, formatRates doesn’t work for me. i need to do the calculation on the template it looks like, HTML doesn’t do any arithmetics AFAIK. Any idea?
I’ve dig through functions.inc.php and found a function called humanspeed that uses formatrates. It also didn’t work. I’m using HTML templates btw,
How and where? I can calculate using the ifInOctet_Rate value, however HTML doesn’t allow me to calculate in the template. Where would i do this calculation and how would i add it into the template?