tumblr / collins

groovy kind of love
tumblr.github.com/collins
Apache License 2.0
572 stars 99 forks source link

improve power status reporting #539

Closed gtorre closed 7 years ago

gtorre commented 7 years ago

@defect @qx-xp @roymarantz rfr

We need to tighten the regex for power status results. We had an incident where ipmitool was returning a string with the word "on" in the result so collins reported servers as on when they were actually unreachable via ipmi at the time.

Regex behaves as expected:

scala> val result = """Chassis Power is on
     |
     | SUCCESS"""
result: String =
Chassis Power is on

SUCCESS

scala> result.contains("Chassis Power is on")
res15: Boolean = true

scala> result.contains("Chassis Power is off")
res16: Boolean = false

consolr:

[gtorre@collins A:UTIL ~]$ sudo /usr/local/bin/consolr2 -t tag --status
Chassis Power is on

SUCCESS

ipmitool:

-bash-4.1$ ipmitool -H **** -U **** -P **** -I lanplus power status
Chassis Power is on