Custom Macro GUI only shows for boolean

Hi!

I’m trying to create an alert for my device, when it reaches a percentage of the use of the capacity of a specific interface y received an alert:

(config.php)

$config[‘alert’][‘macros’][‘rule’][‘af_in_traffic’] = ‘((%ports.ifInOctets_rate*8)/%wireless_sensors.sensor_current)*100’;

My problem is that when i create the alert rule, i can choose it, but librenms show only radio button yes or no, i i don’t know how to show a textbox to set my percent.

Sorry if this question is already answer, i can’t find anything… :frowning:

Thanks

You did a macro. A Macro is for match/doesnt match (YES or NO).

Instead of that, create that rule directly on the alerts.

ahh! ok!, i get confused while reading DOCs:

**
Port-Usage in Percent (Decimal)
Entity: macros.port_usage_perc
Description: Return port-usage in percent.
Source: ((ports.ifInOctets_rate*8) / ports.ifSpeed)*100
**

I though, that means, i can add that on config.php.

Ok! i’ll try to make it on alerts…

Thanks for your quickly reply!

There is an exception for rate macros. Try putting rate in the name or have the name end with _perc.

Ok Murrant!

My next problem, is a need to compare rate with other field, in my case: wireless_sensor.sensor_current, is there away to do this in GUI?, for the moment i’m trying to build a custom SQL.

thx

Surround the field with backticks ` and it will work.

Thanksss, now im on holidaya, when i come back i will try!

Thx again!!

Hi Daniel,

DId you ever managed to make this work using Murrant’s solution?
I’m facing the same issue but appeding _perc or putting rate in the name is not helping.

Hi!

I found in the database “ports.ifOutOctets_rate” so i can use it, but i had to filter by ‘ports.ifName’ and ‘wireless_sensors.sensor_type’.

dont know if it helps you…