Cacti/Bcache: Difference between revisions
From fakedWiki
(Created page with "== Host using bcache == Add to your '''/etc/snmp/snmpd.conf''' <pre> exec bcache /usr/bin/cacti-bcache.sh </pre> Create '''/usr/bin/cacti-bcache.sh''' <pre> #!/bin/bash PATH...") |
No edit summary |
||
| Line 1: | Line 1: | ||
== Host | == bcache Host == | ||
Add to your '''/etc/snmp/snmpd.conf''' | Add to your '''/etc/snmp/snmpd.conf''' | ||
<pre> | <pre> | ||
| Line 33: | Line 33: | ||
</pre> | </pre> | ||
== Cacti == | == Cacti Host == | ||
'''/usr/share/cacti/resource/scripts/get_bcache.sh''' | '''/usr/share/cacti/resource/scripts/get_bcache.sh''' | ||
<pre> | <pre> | ||
Revision as of 16:25, 5 September 2016
bcache Host
Add to your /etc/snmp/snmpd.conf
exec bcache /usr/bin/cacti-bcache.sh
Create /usr/bin/cacti-bcache.sh
#!/bin/bash
PATH='/sys/fs/bcache/'
if [ ! -d ${PATH} ]; then
echo "Error: bcache not loaded"
exit 1
fi
DIRTY_DATA=0
get_dirty_data () {
local size=$(<${PATH}/${1}/bdev0/dirty_data)
DIRTY_DATA=$(/usr/bin/numfmt --from=iec ${size})
}
for dir in "${PATH}/*/"; do
uuid=$(/usr/bin/basename ${dir})
get_dirty_data ${uuid}
done
echo "dirty_data:${DIRTY_DATA}"
exit 0
Cacti Host
/usr/share/cacti/resource/scripts/get_bcache.sh
#!/bin/bash
if [ ${#} -ne 3 ]; then
echo "Usage: $0 <host> <community>"
exit 0
fi
snmptable -c${2} -v1 ${1} .1.3.6.1.4.1.2021.8 | sed -n "s/\s*[0-9]+*\s*bcache.*\s*0\s*\(.*\)\s*noError/\1/p"
Data Template
tbc