Search code examples
rubyregexsensu

Trying to get a regex value for > 30,000


I'm using this sensu plugin https://github.com/sensu-plugins/sensu-plugins-process-checks/blob/master/bin/check-cmd.rb

to run

sudo lsof | grep couchbase | grep ESTABLISHED | wc -l

I'm trying to come up with a regex for the output. I want it to alert if the value is over 30,000 connections.

What would be the regex I can use?


Solution

  • > 30000 = 3\d{3}[1-9]|[4-9]\d{4}|[1-9]\d{5,17}|[1-8]\d{18}|9\d{18,}

    Add boundary conditions where needed.