Reputation: 2025
I have a total of 30 hosts whose hostnames follow this pattern: hostname-1.local to hostname-30.local
Printing the up status for all of them is easy: up{instance=~"hostname-[0-9]?[0-9].local"})
However, I want to list the up status only for hosts between hostname-5.local to hostname-12.local.
How do I do that?
Upvotes: 0
Views: 1965
Reputation: 929
Just split the logic into two alternatives: single digit numbers (5 to 9), and double-digit numbers (10 to 12):
up{instance=~"hostname-([5-9]|1[0-2]).local"})
Upvotes: 1