Afternoon all, I’m a new LibreNMS user getting used to everything. And it’s awesome so far. At the moment, I’m having trouble in creating a macro that would allow me to create “Business hours” and “After hours” so that only certain devices (within their group) will only report of an outage during those certain hours.
I found this link: Alert rules - Time range - #3 by ospfbgp
And I’ve applied them in a couple of alert rules
And here’s the macro I put into my config.php file:
$config[ ‘alert’ ][ ‘macros’ ][ ‘rule’ ][ ‘business_hours’ ] = ‘(HOUR(now)) >= 7 OR HOUR(now()) <= 16) OR WEEKDAY(now)) <= 4’ ;
$config[ ‘alert’ ][ ‘macros’ ][ ‘rule’ ][ ‘after_hours’ ] = ‘(HOUR(now)) <= 5 OR HOUR(now()) >= 19) OR WEEKDAY(now)) >= 5’ ;
(I can only post 1 picture at the moment)
However, I’m getting NO alerts whatsoever now. What am I doing wrong?
Here’s my validate.php output:
Component | Version |
---|---|
LibreNMS | 1.56-75-gbd8cb826c |
DB Schema | 2019_02_05_140857_remove_config_definition_from_db (145) |
PHP | 7.2.19-0ubuntu0.18.04.2 |
MySQL | 10.1.41-MariaDB-0ubuntu0.18.04.1 |
RRDTool | 1.7.0 |
SNMP | NET-SNMP 5.7.3 |
==================================== |
[OK] Composer Version: 1.9.0
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
EDIT: Forgot the other macro