influxdb
TRANSCRIPT
INFLUXDB + COLLECTD + GRAFANA ON CENTOS 7
Install/Configure InfluxDB and Grifana on CentOS 7Shell# install and configure collectdroot@watcher ~ $ yum install epel-releaseroot@watcher ~ $ yum install collectd
# add this fileroot@watcher ~ $ vim /etc/collectd.d/influxdb.confLoadPlugin network<Plugin network>
Server "127.0.0.1" "25826"</Plugin>
# enable and start collectdroot@watcher ~ $ systemctl start collectdroot@watcher ~ $ systemctl enable collectd
# follow these instructions from: https://influxdb.comroot@watcher ~ $ wget https://s3.amazonaws.com/influxdb/influxdb-0.9.3-1.x86_64.rpmroot@watcher ~ $ yum localinstall influxdb-0.9.3-1.x86_64.rpm
# clean up a bitroot@watcher ~ $ mkdir /etc/influxdb/root@watcher ~ $ mv /etc/opt/influxdb/influxdb.conf /etc/influxdb/influxdb.conf.orig root@watcher ~ $ rm -rf /etc/opt/influxdbroot@watcher ~ $ /opt/influxdb/influxd config > /etc/influxdb/influxdb.confroot@watcher ~ $ chown -R influxdb:influxdb /etc/influxdb/
# modify, change configroot@watcher ~ $ vim /etc/init.d/influxdbCONFIG=/etc/influxdb/influxdb.conf
# modify, enable collectdvim /etc/influxdb/influxdb.conf[collectd] enabled = true bind-address = ":25826" database = "collectd" retention-policy = "" batch-size = 5000 batch-timeout = "10s" typesdb = "/usr/share/collectd/types.db"
# enable and start influxdbroot@watcher ~ $ chkconfig influxdb onroot@watcher ~ $ service influxdb start
# create database for collectdroot@watcher ~ $ curl -G 'http://localhost:8086/query' --data-urlencode "q=CREATE DATABASE collectd"root@watcher ~ $ curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "q=SHOW DATABASES"
# install, enable, start grafanaroot@watcher ~ $ yum install https://grafanarel.s3.amazonaws.com/builds/grafana-2.1.3-1.x86_64.rpm
root@watcher ~ $ systemctl start grafana-serverroot@watcher ~ $ systemctl enable grafana-server
# install and configure collectdroot@watcher ~ $ yum install epel-releaseroot@watcher ~ $ yum install collectd # add this fileroot@watcher ~ $ vim /etc/collectd.d/influxdb.confLoadPlugin network<Plugin network>
Server "127.0.0.1" "25826"</Plugin> # enable and start collectdroot@watcher ~ $ systemctl start collectdroot@watcher ~ $ systemctl enable collectd # follow these instructions from: https://influxdb.comroot@watcher ~ $ wget https://s3.amazonaws.com/influxdb/influxdb-0.9.3-1.x86_64.rpmroot@watcher ~ $ yum localinstall influxdb-0.9.3-1.x86_64.rpm # clean up a bitroot@watcher ~ $ mkdir /etc/influxdb/root@watcher ~ $ mv /etc/opt/influxdb/influxdb.conf /etc/influxdb/influxdb.conf.orig root@watcher ~ $ rm -rf /etc/opt/influxdbroot@watcher ~ $ /opt/influxdb/influxd config > /etc/influxdb/influxdb.confroot@watcher ~ $ chown -R influxdb:influxdb /etc/influxdb/ # modify, change configroot@watcher ~ $ vim /etc/init.d/influxdb
CONFIG=/etc/influxdb/influxdb.conf # modify, enable collectdvim /etc/influxdb/influxdb.conf[collectd] enabled = true bind-address = ":25826" database = "collectd" retention-policy = "" batch-size = 5000 batch-timeout = "10s" typesdb = "/usr/share/collectd/types.db" # enable and start influxdbroot@watcher ~ $ chkconfig influxdb onroot@watcher ~ $ service influxdb start # create database for collectdroot@watcher ~ $ curl -G 'http://localhost:8086/query' --data-urlencode "q=CREATE DATABASE collectd"root@watcher ~ $ curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "q=SHOW DATABASES" # install, enable, start grafanaroot@watcher ~ $ yum install https://grafanarel.s3.amazonaws.com/builds/grafana-2.1.3-1.x86_64.rpm root@watcher ~ $ systemctl start grafana-serverroot@watcher ~ $ systemctl enable grafana-server
HowTo Install influxdb on CentOs 7
First of all, we will need a basic CentOs 7 installation. There are no special requirements on what to select. Next, we will need to add the influxdb yum repository to this freshly installed CentOs 7. Use the following commands to add it to your system:
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
Now we can start the installation with the following command:
sudo yum install influxdb
Please answere “y” to all questions. You should see the following output then:
Now let’s start the influxdb service for the first time and also make it autostart when the system starts:
sudo /bin/systemctl start influxdb.service
sudo /bin/systemctl enable influxdb.service
On a standard CentOs 7 installation, the firewall needs to be opened for the influx db port ( TCP/8086 and TCP/8083 ), so let’s do it now:
firewall-cmd --permanent --zone=public --add-port=8086/tcp
firewall-cmd --permanent --zone=public --add-port=8083/tcp
firewall-cmd --reload
You should now be able to go to the web interface of your influxdb installation using the following url:
http://<serverip>:8083/
II. Config collectd.service
Để cấu hình monitor nginxI. Cai dat va cấu hinh nginx
II.Cấu hình trên collectd
$ yum install collectd-nginx
Nếu muốn monitor mysql thì cài
$ yum install collectd-mysql