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_campaign=sent-from-mailbird]
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