Skip to content

Commit

Permalink
Merge pull request #2127 from desertwitch/issue-2126
Browse files Browse the repository at this point in the history
upsmon: fix discrepancies between linestate & status flags resulting in critical UPS
  • Loading branch information
jimklimov authored Oct 25, 2023
2 parents 7979e20 + 7c2a215 commit dc368ad
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions clients/upsmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1221,10 +1221,21 @@ static void ups_fsd(utype_t *ups)
/* cleanly close the connection to a given UPS */
static void drop_connection(utype_t *ups)
{
upsdebugx(2, "Dropping connection to UPS [%s]", ups->sys);
if (ups->linestate == 1 && flag_isset(ups->status, ST_ONLINE))
upsdebugx(2, "Dropping connection to UPS [%s], last seen as fully online.", ups->sys);
else
upsdebugx(2, "Dropping connection to UPS [%s], last seen as not fully online (might be considered critical later).", ups->sys);

if(ups->offstate == 1 || flag_isset(ups->status, ST_OFF))
upsdebugx(2, "Disconnected UPS [%s] was last seen in status OFF, this UPS might be considered critical later.", ups->sys);

if(ups->bypassstate == 1 || flag_isset(ups->status, ST_BYPASS))
upsdebugx(2, "Disconnected UPS [%s] was last seen in status BYPASS, this UPS might be considered critical later.", ups->sys);

if(flag_isset(ups->status, ST_CAL))
upsdebugx(2, "Disconnected UPS [%s] was last seen in status CAL, this UPS might be considered critical later.", ups->sys);

ups->commstate = 0;
ups->linestate = 0;

/* forget poll-failure logging throttling */
ups->pollfail_log_throttle_count = -1;
Expand Down

0 comments on commit dc368ad

Please sign in to comment.