diff --git a/plugins/syncthing/syncthing_ b/plugins/syncthing/syncthing_ index 8b41cad1..b71bb48b 100755 --- a/plugins/syncthing/syncthing_ +++ b/plugins/syncthing/syncthing_ @@ -22,10 +22,10 @@ To make the plugin connect to the Syncthing server one has to use this type of configuration [syncthing_*] -env.ST_APIKEY myapikey0123456789 -env.ST_HOST 127.0.0.1 -env.ST_PORT 8384 -env.ST_PROTO http +env.syncthing_apikey myapikey0123456789 +env.syncthing_host 127.0.0.1 +env.syncthing_port 8384 +env.syncthing_proto http =head1 AUTHOR Pierre-Alain TORET @@ -47,7 +47,7 @@ EOM exit 0;; *) printf "syncthing_cpu.value " - $CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/status | $JQ '.cpuPercent' + $CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/status | $JQ '.cpuPercent' esac } @@ -67,8 +67,8 @@ syncthing_mem_sys.cdef syncthing_mem_sys,8,* EOM exit 0;; *) - ALL=$($CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/status | $JQ '.alloc') - SYS=$($CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/status | $JQ '.sys') + ALL=$($CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/status | $JQ '.alloc') + SYS=$($CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/status | $JQ '.sys') printf "syncthing_mem_all.value $ALL\nsyncthing_mem_sys.value $SYS\n" esac } @@ -85,7 +85,7 @@ EOM exit 0;; *) printf "syncthing_uptime.value " - $CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/status | $JQ '.uptime' + $CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/status | $JQ '.uptime' esac } @@ -101,7 +101,7 @@ EOM exit 0;; *) printf "syncthing_goroutine.value " - $CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/status | $JQ '.goroutines' + $CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/status | $JQ '.goroutines' esac } @@ -125,8 +125,8 @@ syncthing_transfer_up.cdef syncthing_transfer_up,8,* EOM exit 0;; *) - IBT=$($CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/connections | $JQ '.total | .inBytesTotal') - OBT=$($CURL -s -X GET -H "X-API-Key: $ST_APIKEY" $ST_PROTO://$ST_HOST:$ST_PORT/rest/system/connections | $JQ '.total | .outBytesTotal') + IBT=$($CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/connections | $JQ '.total | .inBytesTotal') + OBT=$($CURL -s -X GET -H "X-API-Key: $syncthing_apikey" $syncthing_proto://$syncthing_host:$syncthing_port/rest/system/connections | $JQ '.total | .outBytesTotal') printf "syncthing_transfer_up.value $IBT\nsyncthing_transfer_down.value $OBT\n" esac }