[HN Gopher] Show HN: Monitor your el-cheapo UPS via SNMP
___________________________________________________________________
Show HN: Monitor your el-cheapo UPS via SNMP
Author : AstroNoise58
Score : 22 points
Date : 2021-03-14 09:37 UTC (1 days ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| AstroNoise58 wrote:
| I made this to serve my own need (which it does), to allow my
| Synology NAS a clean shutdown in case of a power cut. My UPS is
| not recognized if plugged into the NAS via USB, so it is plugged
| into a different (SBC) computer instead, which runs this.
|
| Speaking of prior art, I am only aware of this one:
| https://github.com/luizluca/nut-snmpagent I am not a fan of Ruby
| and I only trust software I wrote (a.k.a.: I prefer my own bugs
| in critical pieces of my infra), so here it is.
|
| Posting in case someone else finds it useful, but will answer
| more general questions (should they come up) as well.
| anon870 wrote:
| > I prefer my own bugs
|
| In which case, you might wanna double check these return values
| https://github.com/tomszilagyi/upsc-snmp-agent/blob/8f35379d...
| AstroNoise58 wrote:
| Not sure what problem you see with that, care to elaborate
| and/or open an issue?
| readflaggedcomm wrote:
| It never returns 1, and returns 4 in two cases. This varies
| from the comment before the function, which I presume
| documents return values (though at first glance I thought
| the "name(number)" format was a function call example).
| AstroNoise58 wrote:
| Oh, ok, I guess that might be a bit confusing. :)
|
| The comment documents the interpretation (by the UPS MIB)
| of possible return values. The same is true for the
| surrounding few functions (upsAutoRestart,
| upsBeeperStatus and upsOutputSource) that are similar in
| form and purpose. Obviously, there is no requirement that
| all possible output values are generated (exactly once or
| at all).
|
| The function upsBatteryStatus returns 4 in two cases,
| because in both of those cases the battery is deemed
| 'depleted'. And it does not return 1 because there is no
| input case from upsc (that I know of, at least) where it
| would make sense to report the battery status as
| 'unknown'.
___________________________________________________________________
(page generated 2021-03-15 23:02 UTC)