Skip to content

Commit

Permalink
Fix nut reporting in netdata
Browse files Browse the repository at this point in the history
  • Loading branch information
Qubad786 committed Jul 8, 2024
1 parent 31ec7f1 commit 0f1f4b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/freenas/usr/lib/netdata/charts.d/nut_ups.chart.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
source /usr/lib/netdata/charts.d/nut.chart.sh

nut_ups_update_every=60


nut_get_all() {
run -t $nut_timeout upsc -l || echo "ix-dummy-ups"
run -t $nut_timeout upsc -l || echo "skip-get-values"
}

nut_get() {
if [ $1 == "ix-dummy-ups" ]; then
if [ $1 == "skip-get-values" ]; then
return 0;
fi

Expand All @@ -33,7 +31,6 @@ nut_ups_check() {
nut_ids=()

if [ ! -f /run/nut/upsmon.pid ]; then
nut_ids["ix-dummy-ups"]="$(fixid "ix-dummy-ups")"
return 0
fi

Expand Down Expand Up @@ -73,6 +70,10 @@ nut_ups_update() {
# do all the work to collect / calculate the values
# for each dimension
# remember: KEEP IT SIMPLE AND SHORT
if [ ! -f /run/nut/upsmon.pid ]; then
return 0
fi

nut_ups_check
nut_ups_create
nut_update $@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def generate_ups_config(middleware):

ups_group = middleware.call_sync('group.query', [['group', '=', UPS_USER]], {'get': True})
os.chown(UPS_VARPATH, 0, ups_group['gid'])
os.chmod(UPS_VARPATH, 0o770)
os.chmod(UPS_VARPATH, 0o775)


def render(service, middleware):
Expand Down

0 comments on commit 0f1f4b3

Please sign in to comment.