Created
September 21, 2017 17:46
-
-
Save aheadley/9e57f4df63a660ad1f7b441d36de1d5c to your computer and use it in GitHub Desktop.
Telegraf on FreeNAS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# full path to the telegraf executable in the jail it was installed in | |
TELEGRAF_BIN='/mnt/tank0/jails/telegraf-test/usr/local/bin/telegraf' | |
# dir for storing the pid, config, and log files | |
BASE_DIR='/mnt/tank0/home/aheadley' | |
if [ -f $BASE_DIR/telegraf.pid ] && kill -0 $(cat $BASE_DIR/telegraf.pid) &>/dev/null; then | |
# don't start it again if it's already running | |
echo "Telegraf running ($(cat $BASE_DIR/telegraf.pid))..." | |
else | |
# start it | |
$TELEGRAF_BIN --config $BASE_DIR/telegraf.conf & | |
echo "$!" > $BASE_DIR/telegraf.pid | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[global_tags] | |
role = "freenas" | |
fqdn = "<YOUR-FREENAS-FQDN>" | |
[agent] | |
hostname = "<YOUR-FREENAS-HOSTNAME>" | |
omit_hostname = false | |
interval = "10s" | |
round_interval = true | |
metric_buffer_limit = 1000 | |
flush_buffer_when_full = true | |
collection_jitter = "0s" | |
flush_interval = "10s" | |
flush_jitter = "0s" | |
debug = false | |
quiet = false | |
# see BASE_DIR in start-telegraf.sh | |
logfile = "/mnt/tank0/home/aheadley/telegraf.log" | |
# | |
# OUTPUTS: | |
# | |
[[outputs.influxdb]] | |
database = "<INFLUXDB-DATABASE-NAME>" | |
username = "<INFLUXDB-USERNAME>" | |
password = "<INFLUXDB-PASSWORD>" | |
urls = ["http://INFLUXDB-HOST:8086"] | |
# | |
# INPUTS: | |
# | |
[[inputs.cpu]] | |
percpu = true | |
totalcpu = true | |
#[[inputs.disk]] | |
[[inputs.internal]] | |
[[inputs.io]] | |
[[inputs.mem]] | |
[[inputs.net]] | |
[[inputs.swap]] | |
[[inputs.system]] | |
[[inputs.diskio]] | |
[[inputs.netstat]] | |
[[inputs.zfs]] | |
poolMetrics = true | |
kstatMetrics = ["arcstats", "zfetchstats", "vdev_cache_stats", "zcompstats", "zio_trim"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How is telegraf able to get information about your pool, system, etc via the jail? for example, the new smarmon/smartctl plugin needs to be able to talk to the disks...AFAIK a jail won't allow this sort of low level access. Did you find a way around this?