nut: Infer role from server name, set commands
Since the "primary" `upsmon` is always (for our purposes) running on the same host as `upsd`, there's no reason to specify both values. All systems need a shutdown command; one is not set by default. The primary system is the only one that should send notifications.master
parent
caccffcb65
commit
36fd137897
|
@ -73,7 +73,6 @@ nut: schema.#Nut & {
|
|||
#nut_monitor: {
|
||||
#server: string | *ups_server
|
||||
#username: string
|
||||
#role: "primary" | *"secondary"
|
||||
|
||||
monitor: [
|
||||
for k, v in nut.ups {
|
||||
|
@ -82,10 +81,19 @@ nut: schema.#Nut & {
|
|||
powervalue: 1
|
||||
username: #username
|
||||
password: nut.users[#username].password
|
||||
role: #role
|
||||
if #server == "localhost" {
|
||||
role: "primary"
|
||||
}
|
||||
if #server != "localhost" {
|
||||
role: "secondary"
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
shutdowncmd: "systemctl poweroff"
|
||||
if #server == "localhost" {
|
||||
notifycmd: "/usr/local/libexec/nut-notify"
|
||||
}
|
||||
minsupplies: 1
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ nut: prod.nut
|
|||
nut: monitor: prod.#nut_monitor & {
|
||||
#server: "localhost"
|
||||
#username: "upsmon"
|
||||
#role: "primary"
|
||||
}
|
||||
|
||||
collectd: prod.collectd
|
||||
|
|
Loading…
Reference in New Issue