-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsmf
executable file
·47 lines (43 loc) · 787 Bytes
/
smf
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
#!/bin/sh
if [ "$1" = "autoconf" ]; then
echo 'yes'
exit 0
fi
if [ "$1" = "config" ]; then
cat <<EOF
graph_title SMF Services
graph_category processes
graph_scale no
graph_vlabel services
graph_args --base 1000 -l 0
graph_info Number of SMF services per state
online.label online
disabled.label disabled
maintenance.label maintenance
maintenance.warning 0
degraded.label degraded
degraded.warning 0
offline.label offline
legacy_run.label legacy_run
uninitialized.label uninitialized
EOF
exit 0
fi
svcs -a -o state,nstate | awk '
NR > 1 {
a[$1]++
}
BEGIN {
a["degraded"] = 0
a["disabled"] = 0
a["maintenance"] = 0
a["offline"] = 0
a["online"] = 0
a["uninitialized"] = 0
a["legacy_run"] = 0
}
END {
for(k in a) {
print k ".value", a[k]
}
}'