Regex in an entity match not working right
Hi All,
I'm trying to match ports with the name port-channel1 through 19, and the "match" keyword isn't doing what I want.
What I think is correct is "ifName match port-channel([1-9]|1[0-9])"
However that gives me 0 matches. If I change it to something like ifName match port-channel*" I get all the port channels, so it's matching the device properly, but for this alert checker I just need port channels 1-19.
Any ideas? I've tried a bunch of combinations and nothing seems to work right. Even "port-channel." doesn't match the additional character.
*Spencer Ryan* | Senior Systems Administrator | sryan@arbor.net *Arbor Networks* +1.734.794.5033 (d) | +1.734.846.2053 (m) www.arbornetworks.com
I think you are confusing match with regex :)
Adam.
Sent with AquaMail for Android http://www.aqua-mail.com
On 7 December 2015 20:35:45 Spencer Ryan sryan@arbor.net wrote:
Hi All,
I'm trying to match ports with the name port-channel1 through 19, and the "match" keyword isn't doing what I want.
What I think is correct is "ifName match port-channel([1-9]|1[0-9])"
However that gives me 0 matches. If I change it to something like ifName match port-channel*" I get all the port channels, so it's matching the device properly, but for this alert checker I just need port channels 1-19.
Any ideas? I've tried a bunch of combinations and nothing seems to work right. Even "port-channel." doesn't match the additional character.
*Spencer Ryan* | Senior Systems Administrator | sryan@arbor.net *Arbor Networks* +1.734.794.5033 (d) | +1.734.846.2053 (m) www.arbornetworks.com
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
It would be great if the website even listed regexp as an option :)
*Spencer Ryan* | Senior Systems Administrator | sryan@arbor.net *Arbor Networks* +1.734.794.5033 (d) | +1.734.846.2053 (m) www.arbornetworks.com
On Mon, Dec 7, 2015 at 3:46 PM, Adam Armstrong adama@observium.org wrote:
I think you are confusing match with regex :)
Adam.
Sent with AquaMail for Android http://www.aqua-mail.com
On 7 December 2015 20:35:45 Spencer Ryan sryan@arbor.net wrote:
Hi All,
I'm trying to match ports with the name port-channel1 through 19, and the "match" keyword isn't doing what I want.
What I think is correct is "ifName match port-channel([1-9]|1[0-9])"
However that gives me 0 matches. If I change it to something like ifName match port-channel*" I get all the port channels, so it's matching the device properly, but for this alert checker I just need port channels 1-19.
Any ideas? I've tried a bunch of combinations and nothing seems to work right. Even "port-channel." doesn't match the additional character.
*Spencer Ryan* | Senior Systems Administrator | sryan@arbor.net *Arbor Networks* +1.734.794.5033 (d) | +1.734.846.2053 (m) www.arbornetworks.com _______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
... but that would destroy the mystery.
Adam.
Sent with AquaMail for Android http://www.aqua-mail.com
On 7 December 2015 20:50:39 Spencer Ryan sryan@arbor.net wrote:
It would be great if the website even listed regexp as an option :)
*Spencer Ryan* | Senior Systems Administrator | sryan@arbor.net *Arbor Networks* +1.734.794.5033 (d) | +1.734.846.2053 (m) www.arbornetworks.com
On Mon, Dec 7, 2015 at 3:46 PM, Adam Armstrong adama@observium.org wrote:
I think you are confusing match with regex :)
Adam.
Sent with AquaMail for Android http://www.aqua-mail.com
On 7 December 2015 20:35:45 Spencer Ryan sryan@arbor.net wrote:
Hi All,
I'm trying to match ports with the name port-channel1 through 19, and the "match" keyword isn't doing what I want.
What I think is correct is "ifName match port-channel([1-9]|1[0-9])"
However that gives me 0 matches. If I change it to something like ifName match port-channel*" I get all the port channels, so it's matching the device properly, but for this alert checker I just need port channels 1-19.
Any ideas? I've tried a bunch of combinations and nothing seems to work right. Even "port-channel." doesn't match the additional character.
*Spencer Ryan* | Senior Systems Administrator | sryan@arbor.net *Arbor Networks* +1.734.794.5033 (d) | +1.734.846.2053 (m) www.arbornetworks.com _______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium 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
On Mon, Dec 07, 2015 at 03:35:29PM -0500, Spencer Ryan wrote:
Any ideas? I've tried a bunch of combinations and nothing seems to work right. Even "port-channel." doesn't match the additional character.
https://github.com/mgmoerman/docs/blob/master/observium-alert-checkers.md
is a pretty good resource regarding alert checkers
Last time I ran into this, I had to dig into the code. It changes what keywords do what based on what type of entity you are matching, sometimes it's using SQL LIKE, sometimes it's using PREG, and the keywords between different entity types don't always match (regexp versus regex, etc)
Thanks Brandon,
This ended up working correctly, normal regex-y stuff wasn't going so well:
ifName regexp port-channel([1-9]|1[0-9])$
*Spencer Ryan* | Senior Systems Administrator | sryan@arbor.net *Arbor Networks* +1.734.794.5033 (d) | +1.734.846.2053 (m) www.arbornetworks.com
On Mon, Dec 7, 2015 at 3:46 PM, Brandon Ewing nicotine@warningg.com wrote:
On Mon, Dec 07, 2015 at 03:35:29PM -0500, Spencer Ryan wrote:
Any ideas? I've tried a bunch of combinations and nothing seems to work right. Even "port-channel." doesn't match the additional character.
https://github.com/mgmoerman/docs/blob/master/observium-alert-checkers.md
is a pretty good resource regarding alert checkers
Last time I ran into this, I had to dig into the code. It changes what keywords do what based on what type of entity you are matching, sometimes it's using SQL LIKE, sometimes it's using PREG, and the keywords between different entity types don't always match (regexp versus regex, etc)
-- Brandon Ewing (nicotine@warningg.com)
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
participants (3)
-
Adam Armstrong
-
Brandon Ewing
-
Spencer Ryan