nut: Configure collectd NUT plugin
All checks were successful
infra/cfg/pipeline/head This commit looks good
All checks were successful
infra/cfg/pipeline/head This commit looks good
This commit is contained in:
6
env/prod/nut.cue
vendored
6
env/prod/nut.cue
vendored
@@ -55,3 +55,9 @@ nut: n.#Nut & {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let _nut = nut
|
||||||
|
|
||||||
|
collectd: nut: n.#CollectdNut & {
|
||||||
|
ups: [for k, v in _nut.ups {k + "@localhost"}]
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,3 +5,5 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
nut: prod.nut
|
nut: prod.nut
|
||||||
|
|
||||||
|
collectd: prod.collectd
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ import (
|
|||||||
"du5t1n.me/cfg/schema/app/nut"
|
"du5t1n.me/cfg/schema/app/nut"
|
||||||
)
|
)
|
||||||
|
|
||||||
render: nut.templates
|
render: nut.templates + nut.collectd.templates
|
||||||
|
|||||||
20
schema/app/nut/collectd.cue
Normal file
20
schema/app/nut/collectd.cue
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package nut
|
||||||
|
|
||||||
|
#CollectdNut: {
|
||||||
|
ups: [...string]
|
||||||
|
load_plugin: bool | *true
|
||||||
|
}
|
||||||
|
|
||||||
|
collectd: {
|
||||||
|
templates: [
|
||||||
|
{
|
||||||
|
template: "nut/collectd.conf"
|
||||||
|
dest: "/etc/collectd.d/nut.conf"
|
||||||
|
hooks: {
|
||||||
|
changed: [
|
||||||
|
{run: "systemctl try-restart collectd"},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
8
templates/nut/collectd.conf
Normal file
8
templates/nut/collectd.conf
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{% if collectd.nut.load_plugin -%}
|
||||||
|
LoadPlugin nut
|
||||||
|
{% endif %}
|
||||||
|
<Plugin nut>
|
||||||
|
{%- for ups in collectd.nut.ups %}
|
||||||
|
UPS "{{ ups }}"
|
||||||
|
{%- endfor %}
|
||||||
|
</Plugin>
|
||||||
Reference in New Issue
Block a user