Postgresql database monitoring experiment 05-Grafana installation configuration

Postgresql database monitoring experiment 05-Grafana installation configuration

surroundings

Machine: 10.176.140.72 plat-ecloud01-mgmt-monitor04 monitor04 of
mobile cloud

Operating system:
CentOS Linux release 7.3.1611 (Core)

InfluxDB version:
influxdb-1.7.9

telegraf version:
telegraf-1.12.6

grafana 版本 :
grafana-4.3.1

Introduction to grafana

grafana is an open source platform for user monitoring and observation.
Grafana allows you to query, visualize, alert and understand metrics no matter where they are stored. Create, explore and share dashboards with your team, and cultivate a data-driven culture:

  • Visualization: fast and flexible client map with multiple options. The panel plugin visualizes indicators and logs in various ways.
  • Dynamic Dashboard: Use template variables to create dynamic and reusable dashboards, which are displayed at the top of the dashboard.
  • Browsing indicators: Browse data through ad hoc queries and dynamic details. Split views to compare different time frames, queries and data sources side by side.
  • Browsing logs: Experience the magic of switching from metrics to logs using retained tag filters. Quickly search all logs or live streaming.
  • Alarm: intuitively define the alarm rules for the most important indicators. Grafana will continue to evaluate and send notifications to Slack, PagerDuty, VictorOps, OpsGenie and other systems.
  • Mixed data sources: Mix different data sources in the same diagram! You can specify the data source based on each query. This even applies to custom data sources.

installation

See also: grafana official guide
download interface

You can freely choose the required version
Binary file address: https://dl.grafana.com/oss/release/
rpm file address: https://dl.grafana.com/oss/release/

If you want to download the latest stable version directly, you can also create a repo package directly:

[root@localhost ~]# vim /etc/yum.repos.d/grafana.repo

[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt

Then use yum to install, you need to install the image rendering package first:

yum install fontconfig
yum install freetype*
yum install urw-fonts

Then install grafana:

[root@localhost ~]# yum install grafana -y

File directory description:

  • Binary file: / usr / sbin / grafana-server
  • init.d script: /etc/init.d/grafana-server
  • Default environment variable file: / etc / sysconfig / grafana-server
  • Configuration file: /etc/grafana/grafana.ini
  • Name of systemd service (if systemd is available): grafana-server.service
  • Log file: /var/log/grafana/grafana.log
  • sqlite3 database: /var/lib/grafana/grafana.db

Start grafana:

[root@localhost ~]# systemctl start grafana-server
[root@localhost ~]# ps -ef|grep grafana*
grafana   9870     1  2 18:24 ?        00:00:00 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=rpm cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/var/lib/grafana cfg:default.paths.plugins=/var/lib/grafana/plugins cfg:default.paths.provisioning=/etc/grafana/provisioning
root      9880  9455  0 18:24 pts/1    00:00:00 grep --color=auto grafana*

Configuration

grafana comes with influxDB related plug-ins, just add the data source in the configuration file:

After starting the service, you can directly visit http://10.176.140.72:3000 to enter the login interface, the default account password is admin

http://10.176.140.72:3000After entering, you can click Create your first data source to configure the data source:
Insert picture description heregrafana comes with an influxdb plug-in, you can directly click the influxdb icon to configure:
Insert picture description herefill in the information:

  • Name: the name of this configuration, you can define it yourself
  • HTTP.URL: the URL of the data source, I use the local influxdb here
  • InfluxDB Details: data source connection method, fill in the database name telegraf, user name telegraf, password metrics metrics

https://grafana.com/grafana/dashboards Insert picture description here
Save the test and return to Data source is working

Then create a new dashboard: it is
recommended to use the template provided by grafana: the official template address

Choose my data source as InfluxDB and the collector as Telegraf:
Insert picture description hereI choose the Apache Overview with the most downloads here. You can download its json file, or you can directly copy his clipboard ip:
Insert picture description here

In the grafana interface, select import:
Insert picture description here
directly enter the id:
Insert picture description herethen you will directly import the dashboard, select the data source, and import:
Insert picture description herewhen you just imported, you can not get the record, the host can not get the value, only none:
Insert picture description herethis is because the import the template is for apache, you need to modify the host parameters into the dashboard setting:
switch to the variables, you can see the statement template obtain the host, the host is taken from the apache table ,, but I do not have this table
Insert picture description herewill be changed to apache cpu:
Insert picture description hereExit after saving, you can find that the dashboard has data:
Insert picture description here

Published 136 original articles · Like 58 · Visits 360,000+

Guess you like

Origin blog.csdn.net/sunbocong/article/details/103489990