This file is indexed.

/usr/share/munin/plugins/nutups_ is in munin-plugins-extra 2.0.25-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/sh
# -*- sh -*-
#
# Plugin to monitor various statistics exported by a UPS.
#
# Written by Andras Korn in 2005. Licensed under the GPL.
#
# usage: ups_upsid_function
#
#%# family=contrib
#%# capabilities=autoconf suggest

UPS=$(basename $0 | cut -d_ -f2)
FUNCTION=$(basename $0 | cut -d_ -f3)

if [ "$1" = "autoconf" ]; then
	[ -x /bin/upsc ] && [ -r /etc/nut/ups.conf ] && echo yes && exit 0
	echo "no (/bin/upsc or /etc/nut/ups.conf not found)"
	exit 0
fi

if [ "$1" = "suggest" ]; then
	grep '^\[[^]]*\]$' /etc/nut/ups.conf \
		| tr -d '][' \
		| while read ups; do
			for i in voltages freq charge current; do
				echo ${ups}_${i}
			done
		done
fi

voltages() {
	if [ "$1" = "config" ]; then

		echo "graph_title $UPS voltages"
		echo "graph_args --base 1000 -l 0"
		echo "graph_vlabel Volt"
		for i in battery nominal input output; do
			echo "${i}.label $i"
			echo "${i}.type GAUGE"
			echo "${i}.max 1000"
			echo "${i}.min 0"
		done
	else
		upsc $UPS | sed -n '/volt/{
					s/://
					/nominal/s/.* /nominal.value /
					/voltage/s/\.[^ ]*/.value/
					p
				}'
	fi
}

charge() {
	if [ "$1" = "config" ]; then

		echo "graph_title $UPS charge"
		echo "graph_args --base 1000 -l 0"
		echo "graph_vlabel %"
		for i in charge low load; do
			echo "${i}.label $i"
			echo "${i}.type GAUGE"
			echo "${i}.max 100"
			echo "${i}.min 0"
		done
	else
		upsc $UPS | sed -n '/charge/{
					s/^[^:]*\.//g
					s/:/.value/
					p
				}
				/load/{
					s/.*:/load.value/
					p
				}'
	fi
}

frequency() {
	if [ "$1" = "config" ]; then

		echo "graph_title $UPS input AC frequency"
		echo "graph_args --base 1000 -l 0"
		echo "graph_vlabel frequency 1/s"
		echo "acfreq.label AC frequency"
		echo "acfreq.type GAUGE"
		echo "acfreq.max 100"
		echo "acfreq.min 5"
	else
		upsc $UPS | sed -n '/freq/{s/.*:/acfreq.value/;p}'
	fi
}

current() {
	if [ "$1" = "config" ]; then

		echo "graph_title $UPS output current"
		echo "graph_args --base 1000 -l 0"
		echo "graph_vlabel Amper"
		echo "current.label out-current"
		echo "current.type GAUGE"
		echo "current.max 100"
		echo "current.min 0"
	else
		upsc $UPS | sed -n '/current/{s/.*:/current.value/;p}'
	fi
}

[ "$1" = "config" ] && echo "graph_category sensors"

case "$FUNCTION" in
	voltages)
		voltages $1
		;;
	charge)
		charge $1
		;;
	freq)
		frequency $1
		;;
	current)
		current $1
		;;
esac