# no need for shebang - this file is loaded from charts.d.plugin # netdata # real-time performance and health monitoring, done right! # (C) 2016 Costa Tsaousis # GPL v3+ # apcupsd_ip=127.0.0.1 apcupsd_port=3551 # how frequently to collect UPS data apcupsd_update_every=10 apcupsd_timeout=3 # the priority of apcupsd related to other charts apcupsd_priority=90000 apcupsd_get() { run -t $apcupsd_timeout apcaccess status "$1:$2" } apcupsd_check() { # this should return: # - 0 to enable the chart # - 1 to disable the chart require_cmd apcaccess || return 1 run apcupsd_get $apcupsd_ip $apcupsd_port >/dev/null if [ $? -ne 0 ] then error "cannot get information for apcupsd server." return 1 elif [ $(apcupsd_get $apcupsd_ip $apcupsd_port | awk '/^STATUS.*/{ print $3 }') != "ONLINE" ] then error "APC UPS not online." return 1 fi return 0 } apcupsd_create() { # create the charts cat <