Regex in alert checkers
![](https://secure.gravatar.com/avatar/0896e673efe2e0118c2617b5af6c817b.jpg?s=120&d=mm&r=g)
When you have a problem that can be solved with regex, you now have two problems...
I'm having trouble making a fairly basic regex string match in the alerting system.
I want to not match any devices that have hostnames starting with a digit. Easy, right.
I think my problem is not finding the right bracing to build the syntax within the ui.
Things I have tried that don't seem to work:
hostname notregexp \b\d.* hostname notregexp /\b\d.*/ hostname notregexp /(\b\d.*)/ hostname notregexp '/\b\d.*/' hostname notregexp "\b\d.*" hostname notregexp "/\b\d.*/" hostname notregexp '\b\d.*'
Has anybody figured out what the secret handshake is?
Michael
![](https://secure.gravatar.com/avatar/e84b70344031e0a392bb26fcbe232abb.jpg?s=120&d=mm&r=g)
hostname notregexp ^[0-9]
On Nov 14, 2016 4:39 PM, "Michael" obslist@smarsz.com wrote:
When you have a problem that can be solved with regex, you now have two problems...
I'm having trouble making a fairly basic regex string match in the alerting system.
I want to not match any devices that have hostnames starting with a digit. Easy, right.
I think my problem is not finding the right bracing to build the syntax within the ui.
Things I have tried that don't seem to work:
hostname notregexp \b\d.* hostname notregexp /\b\d.*/ hostname notregexp /(\b\d.*)/ hostname notregexp '/\b\d.*/' hostname notregexp "\b\d.*" hostname notregexp "/\b\d.*/" hostname notregexp '\b\d.*'
Has anybody figured out what the secret handshake is?
Michael _______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
![](https://secure.gravatar.com/avatar/0896e673efe2e0118c2617b5af6c817b.jpg?s=120&d=mm&r=g)
Thanks, that worked.
Though I can't figure out why the others aren't working (even ^\d.*). Does the interface choke on the backslashes?
On 15 November 2016 10:02:26 am AEDT, Ed Iwanski ed@iwanski.com wrote:
hostname notregexp ^[0-9]
On Nov 14, 2016 4:39 PM, "Michael" obslist@smarsz.com wrote:
When you have a problem that can be solved with regex, you now have
two
problems...
I'm having trouble making a fairly basic regex string match in the alerting system.
I want to not match any devices that have hostnames starting with a
digit.
Easy, right.
I think my problem is not finding the right bracing to build the
syntax
within the ui.
Things I have tried that don't seem to work:
hostname notregexp \b\d.* hostname notregexp /\b\d.*/ hostname notregexp /(\b\d.*)/ hostname notregexp '/\b\d.*/' hostname notregexp "\b\d.*" hostname notregexp "/\b\d.*/" hostname notregexp '\b\d.*'
Has anybody figured out what the secret handshake is?
Michael _______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
![](https://secure.gravatar.com/avatar/0fa97865a0e1ab36152b6b2299eedb49.jpg?s=120&d=mm&r=g)
Did you try ^\d.* ?
adam.
Sent from Mailbird [http://www.getmailbird.com/?utm_source=Mailbird&utm_medium=email&utm...] On 14/11/2016 23:51:34, Michael obslist@smarsz.com wrote: Thanks, that worked.
Though I can't figure out why the others aren't working (even ^\d.*). Does the interface choke on the backslashes?
On 15 November 2016 10:02:26 am AEDT, Ed Iwanski wrote:
hostname notregexp ^[0-9]
On Nov 14, 2016 4:39 PM, "Michael" wrote:
When you have a problem that can be solved with regex, you now have
two
problems...
I'm having trouble making a fairly basic regex string match in the alerting system.
I want to not match any devices that have hostnames starting with a
digit.
Easy, right.
I think my problem is not finding the right bracing to build the
syntax
within the ui.
Things I have tried that don't seem to work:
hostname notregexp \b\d.* hostname notregexp /\b\d.*/ hostname notregexp /(\b\d.*)/ hostname notregexp '/\b\d.*/' hostname notregexp "\b\d.*" hostname notregexp "/\b\d.*/" hostname notregexp '\b\d.*'
Has anybody figured out what the secret handshake is?
Michael _______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
_______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
![](https://secure.gravatar.com/avatar/0896e673efe2e0118c2617b5af6c817b.jpg?s=120&d=mm&r=g)
No, that didn't work either...
^\d.* also didn't help, just in case
Meh. Initial problem solved, but maybe it's not going to go so well with more complex regex syntax.
On 15 November 2016 10:52:21 am AEDT, Adam Armstrong adama@memetic.org wrote:
Did you try ^\d.* ?
adam.
Sent from Mailbird [http://www.getmailbird.com/?utm_source=Mailbird&utm_medium=email&utm...] On 14/11/2016 23:51:34, Michael obslist@smarsz.com wrote: Thanks, that worked.
Though I can't figure out why the others aren't working (even ^\d.*). Does the interface choke on the backslashes?
On 15 November 2016 10:02:26 am AEDT, Ed Iwanski wrote:
hostname notregexp ^[0-9]
On Nov 14, 2016 4:39 PM, "Michael" wrote:
When you have a problem that can be solved with regex, you now have
two
problems...
I'm having trouble making a fairly basic regex string match in the alerting system.
I want to not match any devices that have hostnames starting with a
digit.
Easy, right.
I think my problem is not finding the right bracing to build the
syntax
within the ui.
Things I have tried that don't seem to work:
hostname notregexp \b\d.* hostname notregexp /\b\d.*/ hostname notregexp /(\b\d.*)/ hostname notregexp '/\b\d.*/' hostname notregexp "\b\d.*" hostname notregexp "/\b\d.*/" hostname notregexp '\b\d.*'
Has anybody figured out what the secret handshake is?
Michael _______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
![](https://secure.gravatar.com/avatar/6187c2a03e7d3a83f7a224bed4672a05.jpg?s=120&d=mm&r=g)
The code which builds the alert checker associations uses a MySQL query, so the regexp syntax you need to use in that box is limited to what MySQL can handle (which is not as powerful as the PCRE standard, of course). From the match_device_entities() function in <root>/includes/alerts.inc.php, line 724 (r8181, we use the stable branch):
case 'notregexp': case 'notregex': case '!regexp': case '!regex': $sql .= ' AND IFNULL(`' . $attrib['attrib'] . '`, "") NOT REGEXP ?'; $param[] = $attrib['value']; break;
The code which actually tests the checker conditions, on the other hand, uses PHP's preg_match() function (within the test_condition() function, line 512 of the same alerts.inc.php file on my install), so you can use PCRE standard regexes in those (though there isn't as much of a need for anything terribly complex for the conditions itself, I would imagine.)
Hope that helps!
On Tue, 2016-11-15 at 11:22 +1100, Michael wrote:
No, that didn't work either...
^\d.* also didn't help, just in case
Meh. Initial problem solved, but maybe it's not going to go so well with more complex regex syntax.
On 15 November 2016 10:52:21 am AEDT, Adam Armstrong adama@memetic.org wrote:
Did you try ^\d.* ?
adam.
Sent from Mailbird [http://www.getmailbird.com/?utm_source=Mailbird&utm_medium=email&utm...] On 14/11/2016 23:51:34, Michael obslist@smarsz.com wrote: Thanks, that worked.
Though I can't figure out why the others aren't working (even ^\d.*). Does the interface choke on the backslashes?
On 15 November 2016 10:02:26 am AEDT, Ed Iwanski wrote:
hostname notregexp ^[0-9]
On Nov 14, 2016 4:39 PM, "Michael" wrote:
When you have a problem that can be solved with regex, you now have
two
problems...
I'm having trouble making a fairly basic regex string match in the alerting system.
I want to not match any devices that have hostnames starting with a
digit.
Easy, right.
I think my problem is not finding the right bracing to build the
syntax
within the ui.
Things I have tried that don't seem to work:
hostname notregexp \b\d.* hostname notregexp /\b\d.*/ hostname notregexp /(\b\d.*)/ hostname notregexp '/\b\d.*/' hostname notregexp "\b\d.*" hostname notregexp "/\b\d.*/" hostname notregexp '\b\d.*'
Has anybody figured out what the secret handshake is?
Michael _______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
![](https://secure.gravatar.com/avatar/0fa97865a0e1ab36152b6b2299eedb49.jpg?s=120&d=mm&r=g)
Yeah. It annoys me that I had to do it this way, but I thought it was preferable to dragging all of the data out of the database to do it in php.
Adam.
Sent from BlueMail
On 15 Nov 2016, 19:51, at 19:51, Joseph Zancocchio joseph@nyi.net wrote:
The code which builds the alert checker associations uses a MySQL query, so the regexp syntax you need to use in that box is limited to what MySQL can handle (which is not as powerful as the PCRE standard, of course). From the match_device_entities() function in <root>/includes/alerts.inc.php, line 724 (r8181, we use the stable branch):
case 'notregexp': case 'notregex': case '!regexp': case '!regex': $sql .= ' AND IFNULL(`' . $attrib['attrib'] . '`, "") NOT REGEXP ?'; $param[] = $attrib['value']; break;
The code which actually tests the checker conditions, on the other hand, uses PHP's preg_match() function (within the test_condition() function, line 512 of the same alerts.inc.php file on my install), so you can use PCRE standard regexes in those (though there isn't as much of a need for anything terribly complex for the conditions itself, I would imagine.)
Hope that helps!
On Tue, 2016-11-15 at 11:22 +1100, Michael wrote:
No, that didn't work either...
^\d.* also didn't help, just in case
Meh. Initial problem solved, but maybe it's not going to go so well
with more complex regex syntax.
On 15 November 2016 10:52:21 am AEDT, Adam Armstrong
adama@memetic.org wrote:
Did you try ^\d.* ?
adam.
Sent from Mailbird
[http://www.getmailbird.com/?utm_source=Mailbird&utm_medium=email&utm...]
On 14/11/2016 23:51:34, Michael obslist@smarsz.com wrote: Thanks, that worked.
Though I can't figure out why the others aren't working (even
^\d.*).
Does the interface choke on the backslashes?
On 15 November 2016 10:02:26 am AEDT, Ed Iwanski wrote:
hostname notregexp ^[0-9]
On Nov 14, 2016 4:39 PM, "Michael" wrote:
When you have a problem that can be solved with regex, you now
have
two
problems...
I'm having trouble making a fairly basic regex string match in
the
alerting system.
I want to not match any devices that have hostnames starting with
a
digit.
Easy, right.
I think my problem is not finding the right bracing to build the
syntax
within the ui.
Things I have tried that don't seem to work:
hostname notregexp \b\d.* hostname notregexp /\b\d.*/ hostname notregexp /(\b\d.*)/ hostname notregexp '/\b\d.*/' hostname notregexp "\b\d.*" hostname notregexp "/\b\d.*/" hostname notregexp '\b\d.*'
Has anybody figured out what the secret handshake is?
Michael _______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
![](https://secure.gravatar.com/avatar/e406b9337af825660d3c93e0e3733afe.jpg?s=120&d=mm&r=g)
Hi,
I use Observium every day for my job. In Observium graphs, I understand perfectly UPLOAD(blue) and DOWNLOAD(green) traffics, but
there is 2 kind of blue and 2 kind of green ?What is the different between the two color shades ??
In attachement, you'll find an example of this.
Thank you for reply,
Cordialement,
Maxime JEGO
_______________________________________________ observium mailing list observium@observium.org
![](https://secure.gravatar.com/avatar/0fa97865a0e1ab36152b6b2299eedb49.jpg?s=120&d=mm&r=g)
Hi,
One is showing the maximum value in that period, the other is showing the average.
adam.
Sent from Mailbird [http://www.getmailbird.com/?utm_source=Mailbird&utm_medium=email&utm...] On 15/11/2016 10:00:22, Maxime Jégo maxime.jego@netensia.fr wrote: Hi, I use Observium every day for my job. In Observium graphs, I understand perfectly UPLOAD(blue) and DOWNLOAD(green) traffics, but
there is 2 kind of blue and 2 kind of green ?What is the different between the two color shades ?? In attachement, you'll find an example of this.
Thank you for reply,
Cordialement, Maxime JEGO
_______________________________________________ observium mailing list observium@observium.org [mailto:observium@observium.org]
participants (5)
-
Adam Armstrong
-
Ed Iwanski
-
Joseph Zancocchio
-
Maxime Jégo
-
Michael