Skip to content

Commit

Permalink
clients/upsmon.h, docs: default "ALARM" message format to two "%s" pl…
Browse files Browse the repository at this point in the history
…aceholders [#415]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Dec 3, 2024
1 parent 380b3e4 commit 1ac8b9a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions clients/upsmon.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ static struct {
{ NOTIFY_ECO, "ECO", NULL, "UPS %s: in ECO mode (as defined by vendor)", NOTIFY_DEFAULT },
{ NOTIFY_NOTECO, "NOTECO", NULL, "UPS %s: no longer in ECO mode", NOTIFY_DEFAULT },

/* FIXME: Remember the ups.alarm value and report it here,
* maybe optionally - e.g. check if the "ALARM" formatting
* string has actually one or two "%s" placeholders inside.
* Do issue a new notification if ups.alarm value changes.
/* NOTE: We remember the ups.alarm value and report it here,
* maybe optionally - e.g. check if the "ALARM" formatting
* string has actually one or two "%s" placeholders inside.
* Do issue a new notification if ups.alarm value changes.
*/
{ NOTIFY_ALARM, "ALARM", NULL, "UPS %s: one or more active alarms (check ups.alarm)", NOTIFY_DEFAULT },
{ NOTIFY_ALARM, "ALARM", NULL, "UPS %s: one or more active alarms: [%s]", NOTIFY_DEFAULT },
{ NOTIFY_NOTALARM, "NOTALARM", NULL, "UPS %s is no longer in an alarm state (no active alarms)", NOTIFY_DEFAULT },

/* Special handling, two string placeholders!
Expand Down
3 changes: 2 additions & 1 deletion conf/upsmon.conf.sample.in
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ POWERDOWNFLAG "@POWERDOWNFLAG@"
# NOTIFYMSG NOTBYPASS "UPS %s: no longer on bypass"
# NOTIFYMSG ECO "UPS %s: in ECO mode (as defined by vendor)"
# NOTIFYMSG NOTECO "UPS %s: no longer in ECO mode (as defined by vendor)"
# NOTIFYMSG ALARM "UPS %s: one or more active alarms (check ups.alarm)"
# NOTIFYMSG ALARM "UPS %s: one or more active alarms: [%s]"
# or NOTIFYMSG ALARM "UPS %s: one or more active alarms (check ups.alarm)"
# NOTIFYMSG NOTALARM "UPS %s is no longer in an alarm state (no active alarms)"
#
# Special handling is provided for surprise tokens seen in ups.status, which
Expand Down
4 changes: 3 additions & 1 deletion docs/man/upsmon.conf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ for more details see linkman:upsmon[8].

NOTECO;; UPS no longer in ECO mode (see above)

ALARM;; UPS has one or more active alarms (check ups.alarm)
ALARM;; UPS has one or more active alarms (check ups.alarm);
for this notification, the `message` can contain a second `%s` placeholder
to substitute the current value of `ups.alarm`.

NOTALARM;; UPS is no longer in an alarm state (no active alarms)

Expand Down

0 comments on commit 1ac8b9a

Please sign in to comment.