ではなくTIG stackな何かを構築
- Telegraf
- InfluxDB
- Grafana
centos7 検証なのでホストは分けず
cf. https://github.com/influxdata/telegraf
yum -y install https://dl.influxdata.com/telegraf/releases/telegraf-1.0.0.x86_64.rpm
systemctl start telegraf
systemctl enable telegraf
/etc/telegraf/telegraf.d/nginx_access_log.conf
# Stream and parse log file(s).
[[inputs.logparser]]
## Log files to parse.
## These accept standard unix glob matching rules, but with the addition of
## ** as a "super asterisk". ie:
## /var/log/**.log -> recursively find all .log files in /var/log
## /var/log/*/*.log -> find all .log files with a parent dir in /var/log
## /var/log/apache.log -> only tail the apache log file
files = ["/var/log/nginx/access.log"]
## Read file from beginning.
from_beginning = false
## Parse logstash-style "grok" patterns:
## Telegraf built-in parsing patterns: https://goo.gl/dkay10
[inputs.logparser.grok]
## This is a list of patterns to check the given log file(s) for.
## Note that adding patterns here increases processing time. The most
## efficient configuration is to have one pattern per logparser.
## Other common built-in patterns are:
## %{COMMON_LOG_FORMAT} (plain apache & nginx access logs)
## %{COMBINED_LOG_FORMAT} (access logs + referrer & agent)
patterns = ["%{COMBINED_LOG_FORMAT}"]
## Name of the outputted measurement name.
measurement = "nginx_access_log"
## Full path(s) to custom pattern files.
custom_pattern_files = []
## Custom patterns can also be defined here. Put one pattern per line.
custom_patterns = '''
'''
cf. introduction
cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF
yum -y install influxdb
systemctl start influxdb
systemctl enable influxdb
8083
8086
cf. authentication
Create admin user
influx
Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring.
Connected to http://localhost:8086 version 1.0.0
InfluxDB shell version: 1.0.0
> CREATE USER admin WITH PASSWORD '********' WITH ALL PRIVILEGES
> SHOW USERS
user admin
admin true
> EXIT
Edit /etc/influxdb/influxdb.conf
auth-enabled = true
Restart influxdb
systemctl restart influxdb
cf. http://grafana.org/download/
yum -y install https://grafanarel.s3.amazonaws.com/builds/grafana-3.1.1-1470047149.x86_64.rpm
systemctl start grafana-server
systemctl enable grafana-server
port: 3000
番にアクセス
user: admin
password: admin
grafana.ini
[auth.proxy]
enabled = true
header_name = X-WEBAUTH-USER
header_property = username
auto_sign_up = false
nginx.conf
location / {
proxy_pass http://localhost:3000;
}
location /dashboard-solo/db {
proxy_pass http://localhost:3000;
proxy_set_header X-WEBAUTH-USER webauth;
}