1. telegraf的配置
[root@agent-pg135 log]# cat /etc/telegraf/telegraf.conf [global_tags] [agent] interval = "10s" round_interval = true metric_batch_size = 1000 metric_buffer_limit = 10000 collection_jitter = "0s" flush_interval = "10s" flush_jitter = "0s" precision = "" debug = true quiet = false logfile = "/tmp/telegraf.log" hostname = "" omit_hostname = false [[outputs.influxdb]] # urls = ["http://192.168.1.129:8086"] urls = ["http://192.168.162.137:8086"] database = "telegraf" username = "fxkj" password = "123456" [[inputs.cpu]] percpu = true totalcpu = true collect_cpu_time = false report_active = false fieldpass = ["usage_idle", "usage_iowait", "usage_system", "usage_user"] [[inputs.system]] fieldpass = ["load1", "load5", "load15"] [[inputs.mem]] #fieldpass = ["available"] [[inputs.disk]] fieldpass = ["free", "inodes_free", "used_percent"] ignore_fs = ["tmpfs", "devtmpfs", "devfs", "overlay", "aufs", "squashfs"] [[inputs.diskio]] fieldpass = ["read_bytes", "write_bytes", "reads","writes"] [[inputs.net]] interfaces = ["ens33"] fieldpass = ["bytes_recv", "bytes_sent"] [[inputs.netstat]] [[inputs.processes]] # fielddrop = [“wait”,”idle”,”unknown”] [[inputs.redis]] ## specify servers via a url matching: ## [protocol://][:password]@address[:port] ## e.g. servers = [‘tcp://192.168.1.45:6379‘] [[inputs.postgresql]] #address = "host=127.0.0.1" address = "postgres://postgres@127.0.0.1:5432/postgres" #ignored_databases = ["template0", "template1"] [root@agent-pg135 log]#
日志:logfile = "/tmp/telegraf.log"
2.grafana的名字
3. 参考:https://github.com/influxdata/telegraf/tree/master/plugins/inputs/postgresql