Cacti/Bcache
From fakedWiki
Host using bcache
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
/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