sudo vim /etc/prometheus/prometheus.yml
注意YML配置文件的缩进
sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml
启动prometheussudo -u prometheus /usr/local/bin/prometheus --config.file /etc/prometheus/prometheus.yml --storage.tsdb.path /var/lib/prometheus/ --web.console.templates=http://www.likecs.com/etc/prometheus/consoles --web.console.libraries=http://www.likecs.com/etc/prometheus/console_libraries
检测服务器ip:9090
 配置自启动sudo vim /etc/systemd/system/prometheus.service
[Unit] Description=Prometheus Monitoring Wants=network-online.target After=network-online.target [Service] User=prometheus Group=prometheus Type=simple ExecStart=http://www.likecs.com/usr/local/bin/prometheus \ --config.file /etc/prometheus/prometheus.yml \ --storage.tsdb.path /var/lib/prometheus/ \ --web.console.templates=http://www.likecs.com/etc/prometheus/consoles \ --web.console.libraries=http://www.likecs.com/etc/prometheus/console_libraries ExecReload=http://www.likecs.com/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable prometheus
sudo systemctl start prometheus
sudo systemctl status prometheus
cd /tmp
wget https://dl.grafana.com/oss/release/grafana-6.0.1-1.x86_64.rpm
sudo yum localinstall grafana-6.0.1-1.x86_64.rpm
sudo systemctl daemon-reload && sudo systemctl enable grafana-server && sudo systemctl start grafana-server
登录启动grafana后可以通过 :3000登录
初始用户名和密码都是 admin
初次登录后会要求修改密码
选择Prometheus数据源
  配置仪表盘安装饼图插件
grafana-cli plugins install grafana-piechart-panel
导入仪表样本样本来源,打开浏览器打开如下地址并记录id
https://grafana.com/dashboards/8919
 选择Import
然后输入之前记录的id
选择prometheus的数据源,之后打开dashboard就可以看到漂亮的仪表盘了
 AspNet Core App Metrics的监控配置 nuget安装包