基于区块链的毕业设计eth2-grafana – eth2格拉法纳
本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计eth2-grafana – eth2格拉法纳 是一篇很好的国外资料
eth2-grafana
Grafana dashboards for Prysmatic Labs Prysm Eth2 client.
Host stats require node_exporter, ping stats require blackbox_exporter, and ETH price requires blackbox_exporter. Panels requiring these modules can be manually removed from the dashboard after installation if you choose not to install these additional components.
High Level Installation
This installation assumes that you are running Prysm, Grafana, Prometheus, node_exporter, blackbox_exporter, and json_exporter on the same system, and that only default ports are used.
- Install node_exporter if you would like to see system information, such as CPU utilization, memory use, CPU temperature, disk usage, and network traffic.
- If you would like to see ping (network latency) information, install blackbox_exporter using the following configuration file.
modules: icmp: prober: icmp timeout: 10s icmp: preferred_ip_protocol: ipv4
- Install go
- Install json_exporter if you would like to see ETH price information. Use the following configuration file.
metrics: - name: ethusd path: $.ethereum.usd help: Ethereum (ETH) price in USD
- Install Prometheus using the following configuration file.
global: scrape_interval: 15s scrape_configs: - job_name: 'prometheus' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:9090'] - job_name: 'beacon node' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:8080'] - job_name: 'node_exporter' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:9100'] - job_name: 'validator' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:8081'] - job_name: 'ping_google' metrics_path: /probe params: module: [icmp] static_configs: - targets: - 8.8.8.8 relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port. - job_name: 'ping_cloudflare' metrics_path: /probe params: module: [icmp] static_configs: - targets: - 1.1.1.1 relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port. - job_name: json_exporter static_configs: - targets: - 127.0.0.1:7979 - job_name: json metrics_path: /probe static_configs: - targets: - https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:7979
- Install Grafana.
- Login to Grafana and add
http://XXX.XXX.XXX.XXX:9090/
as a Prometheus data source. - Add the Prysm dashboard to Grafana.
Detailed Ubuntu 20.04 Installation
Adapted from my instructions for setting up a Prysm staking system on Ubuntu 20.04.
Prometheus
Create User Account
sudo adduser --system prometheus --group --no-create-home
Install Prometheus
Find the URL to the latest amd64 version of Prometheus at https://prometheus.io/download/. In the commands below, replace any references to the version 2.22.1 to the latest version available.
cd wget https://github.com/prometheus/prometheus/releases/download/v2.22.1/prometheus-2.22.1.linux-amd64.tar.gz tar xzvf prometheus-2.22.1.linux-amd64.tar.gz cd prometheus-2.22.1.linux-amd64 sudo cp promtool /usr/local/bin/ sudo cp prometheus /usr/local/bin/ sudo chown root:root /usr/local/bin/promtool /usr/local/bin/prometheus sudo chmod 755 /usr/local/bin/promtool /usr/local/bin/prometheus cd rm prometheus-2.22.1.linux-amd64.tar.gz
Configure Prometheus
Create directories that prometheus will be expecting to find.
sudo mkdir -p /etc/prometheus/console_libraries /etc/prometheus/consoles /etc/prometheus/files_sd /etc/prometheus/rules /etc/prometheus/rules.d
Create the prometheus configuration files. Open a new configuration file.
sudo nano /etc/prometheus/prometheus.yml
Copy and paste the following text into the prometheus.yml configuration file:
global: scrape_interval: 15s scrape_configs: - job_name: 'prometheus' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:9090'] - job_name: 'beacon node' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:8080'] - job_name: 'node_exporter' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:9100'] - job_name: 'validator' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:8081'] - job_name: 'ping_google' metrics_path: /probe params: module: [icmp] static_configs: - targets: - 8.8.8.8 relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port. - job_name: 'ping_cloudflare' metrics_path: /probe params: module: [icmp] static_configs: - targets: - 1.1.1.1 relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port. - job_name: json_exporter static_configs: - targets: - 127.0.0.1:7979 - job_name: json metrics_path: /probe static_configs: - targets: - https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:7979
Note: Users of earlier versions of these instructions may have the beacon node job name set to “beacon” instead of “beacon node”. When choosing a Grafana dashboard from this repository, please select this dashboard if you are using “beacon” as the job name, and this dashboard if you are using “beacon node” as the job name.
Change the ownership of the prometheus configuration directory to the prometheus user.
sudo chown -R prometheus:prometheus /etc/prometheus
Data Directory
Make a directory for prometheus files, owned by the prometheus user account, and with appropriate privileges.
sudo mkdir /var/lib/prometheus sudo chown prometheus:prometheus /var/lib/prometheus sudo chmod 755 /var/lib/prometheus
Set Up systemd Service
Set up systemd to automatically start Prometheus. It will also restart the software if it stops.
sudo nano /etc/systemd/system/prometheus.service
Copy and paste the following text into the prometheus.service file.
[Unit] Description=Prometheus Wants=network-online.target After=network-online.target [Service] User=prometheus Group=prometheus Type=simple Restart=always RestartSec=5 ExecStart=/usr/local/bin/prometheus --config.file /etc/prometheus/prometheus.yml --storage.tsdb.path /var/lib/prometheus/ --web.console.templates=/etc/prometheus/consoles --web.console.libraries=/etc/prometheus/console_libraries [Install] WantedBy=multi-user.target
Reload the systemd service file configurations, start prometheus, then enable the prometheus service to have it start automatically on reboot.
sudo systemctl daemon-reload sudo systemctl start prometheus.service sudo systemctl enable prometheus.service
Grafana
Setup and install Grafana using apt-get
.
cd sudo apt-get install -y apt-transport-https sudo apt-get install -y software-properties-common wget wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" sudo apt-get update sudo apt-get install grafana-enterprise
Setup systemd
Reload the systemd service file configurations, start Grafana, then enable the Grafana service to have it start automatically on reboot.
sudo systemctl daemon-reload sudo systemctl start grafana-server sudo systemctl enable grafana-server
Login to Grafana at http://XXX.XXX.XXX.XXX:3000/, replacing XXX.XXX.XXX.XXX
with the IP address of your server. If you do not know the IP address, run ifconfig
.
Default username admin
. Default password admin
. Grafana will ask you to set a new password.
Setup Prometheus Data Source
- On the left-hand menu, hover over the gear menu and click on Data Sources.
- Then click on the Add Data Source button.
- Hover over the Prometheus card on screen, then click on the Select button.
- Enter
http://127.0.0.1:9090/
into the URL field, then click Save & Test.
Install Grafana Dashboard
- Hover over the plus symbol icon in the left-hand menu, then click on Import.
- Copy and paste the dashboard at https://raw.githubusercontent.com/metanull-operator/eth2-grafana/master/eth2-grafana-dashboard-single-source-beacon_node.json into the “Import via panel json” text box on the screen. If you used an older version of these instructions, where the Prometheus configuration file uses the beacon node job name of “beacon” instead of “beacon node”, please use this dashboard instead for backwards compatibility.
- Then click the Load button.
- Then click the Import button.
Note: Some panels will not display data until all required software is running. Various portions of this dashboard are directly or indirectly dependent on Prometheus, Prysm beacon chain, Prysm validator, node_exporter, and blackbox exporter.
Final Grafana Dashboard Configuration
A few of the queries driving the Grafana dashboard may need different settings, depending on your hardware.
Network Traffic Configuration
To ensure that network traffic is correctly reflected on your Grafana dashboard, update the network interface in the Network Traffic widget. Run the following command to find your Linux network device.
ifconfig
Output of the command should look like the following:
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::1e69:7aff:fe63:14b0 prefixlen 64 scopeid 0x20<link> ether 1c:69:7a:63:14:b0 txqueuelen 1000 (Ethernet) RX packets 238936 bytes 78487335 (78.4 MB) RX errors 0 dropped 1819 overruns 0 frame 0 TX packets 257824 bytes 112513038 (112.5 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 16 memory 0x96300000-96320000 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 39805 bytes 29126770 (29.1 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 39805 bytes 29126770 (29.1 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Of the two entries shows above, the first lists my IP address on the second line, network interface eno1
. Find the entry that represents the network connection you want to monitor and copy the device name, which is the part before the colon on the first line of each entry. In my case the value is eno1
.
- Go to the Grafana dashboard previously installed
- Find the Network Traffic widget, and open the drop down that can be found by the Network Traffic title.
- Click Edit.
- There will be four references to
eno1
in the queries that appear. Replace all four with the name of the network interface you found in theifconfig
command.
node_exporter
Node exporter allows Prometheus to record system data, such as CPU utilization, memory use, CPU temperature, and disk usage.
Setup and install node_exporter using apt-get
.
Create User Account
sudo adduser --system node_exporter --group --no-create-home
Install node_exporter
cd wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz tar xzvf node_exporter-1.0.1.linux-amd64.tar.gz sudo cp node_exporter-1.0.1.linux-amd64/node_exporter /usr/local/bin/ sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter rm node_exporter-1.0.1.linux-amd64.tar.gz
Set Up System Service
Set up systemd to automatically start node_exporter. It will also restart the software if it stops.
sudo nano /etc/systemd/system/node_exporter.service
Copy and paste the following text into the node_exporter.service file.
[Unit] Description=Node Exporter [Service] Type=simple Restart=always RestartSec=5 User=node_exporter ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=multi-user.target
Reload the systemd service file configurations, start node_exporter, then enable the node_exporter service to have it start automatically on reboot.
sudo systemctl daemon-reload sudo systemctl start node_exporter.service sudo systemctl enable node_exporter.service
json_exporter
Install go
sudo apt-get install golang-1.14-go # Create a symlink from /usr/bin/go to the new go installation sudo ln -s /usr/lib/go-1.14/bin/go /usr/bin/go
Install git
sudo apt-get install git
Create User Account
sudo adduser --system json_exporter --group --no-create-home
Install json_exporter
cd git clone https://github.com/prometheus-community/json_exporter.git cd json_exporter make build sudo cp json_exporter /usr/local/bin/ sudo chown json_exporter:json_exporter /usr/local/bin/json_exporter
Configure json_exporter
Create a directory for the json_exporter configuration file, and make it owned by the json_exporter account.
sudo mkdir /etc/json_exporter sudo chown json_exporter:json_exporter /etc/json_exporter
Edit the json_exporter configuration file.
sudo nano /etc/json_exporter/json_exporter.yml
Copy and paste the following text into the json_exporter.yml file.
metrics: - name: ethusd path: $.ethereum.usd help: Ethereum (ETH) price in USD
Change ownership of the configuration file to the json_exporter account.
sudo chown json_exporter:json_exporter /etc/json_exporter/json_exporter.yml
Set Up System Service
Set up systemd to automatically start json_exporter. It will also restart the software if it stops.
sudo nano /etc/systemd/system/json_exporter.service
Copy and paste the following text into the json_exporter.service file.
[Unit] Description=JSON Exporter [Service] Type=simple Restart=always RestartSec=5 User=json_exporter ExecStart=/usr/local/bin/json_exporter --config.file /etc/json_exporter/json_exporter.yml [Install] WantedBy=multi-user.target
Reload the systemd service file configurations, start node_exporter, then enable the json_exporter service to have it start automatically on reboot.
sudo systemctl daemon-reload sudo systemctl start json_exporter.service sudo systemctl enable json_exporter.service
Optional
blackbox_exporter
I use blackbox_exporter to provide ping (network latency) data between my staking system and two DNS providers. This can also be used to see network downtime.
The Grafana dashboard in these instructions includes a panel with a ping time graph. If you choose not to install blackbox_exporter, simply remove that panel from your Grafana dashboard. It will not show data.
Create User Account
sudo adduser --system blackbox_exporter --group --no-create-home
Install blackbox_exporter
cd wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.18.0/blackbox_exporter-0.18.0.linux-amd64.tar.gz tar xvzf blackbox_exporter-0.18.0.linux-amd64.tar.gz sudo cp blackbox_exporter-0.18.0.linux-amd64/blackbox_exporter /usr/local/bin/ sudo chown blackbox_exporter:blackbox_exporter /usr/local/bin/blackbox_exporter sudo chmod 755 /usr/local/bin/blackbox_exporter
Gives blackbox_exporter special network packet creation abilities to allow for pinging servers.
sudo setcap cap_net_raw+ep /usr/local/bin/blackbox_exporter
Remove the original blackbox_exporter package.
rm blackbox_exporter-0.18.0.linux-amd64.tar.gz
Configure blackbox_exporter
sudo mkdir /etc/blackbox_exporter sudo chown blackbox_exporter:blackbox_exporter /etc/blackbox_exporter
Edit the blackbox_exporter configuration file.
sudo nano /etc/blackbox_exporter/blackbox.yml
Copy and paste the following text into the blackbox.yml file.
modules: icmp: prober: icmp timeout: 10s icmp: preferred_ip_protocol: ipv4
Change ownership of the configuration file to the blackbox_exporter account.
sudo chown blackbox_exporter:blackbox_exporter /etc/blackbox_exporter/blackbox.yml
Set Up System Service
Set up systemd to automatically start blackbox_exporter. It will also restart the software if it stops.
sudo nano /etc/systemd/system/blackbox_exporter.service
Copy and paste the following text into the blackbox_exporter.service file.
[Unit] Description=Blackbox Exporter [Service] Type=simple Restart=always RestartSec=5 User=blackbox_exporter ExecStart=/usr/local/bin/blackbox_exporter --config.file /etc/blackbox_exporter/blackbox.yml [Install] WantedBy=multi-user.target
Reload the systemd service file configurations, start blackbox_exporter, then enable the blackbox_exporter service to have it start automatically on reboot.
sudo systemctl daemon-reload sudo systemctl start blackbox_exporter.service sudo systemctl enable blackbox_exporter.service
eth2-grafana
Prysmatic Labs Prysm Eth2客户端的Grafana仪表板。主机统计需要nodeu exporter,ping统计需要blackboxu exporter,ETH price需要blackboxu exporter。如果您选择不安装这些附加组件,则可以在安装后手动从仪表板上卸下需要这些模块的面板。
此安装假定您在同一系统上运行Prysm、Grafana、Prometheus、nodeu exporter、blackboxu exporter和jsonu exporter,并且只使用默认端口。
改编自我在Ubuntu 20.04上设置Prysm锁定系统的说明。
高级安装
找到最新版本的amd64 Prometheus的网址https://prometheus.io/download/。在下面的命令中,将对版本2.22.1的所有引用替换为可用的最新版本。
- 如果您想查看系统信息,如CPU使用率、内存使用率、CPU温度、磁盘使用率和网络流量,请安装nodeu exporter。
- 如果您想查看ping(网络延迟)信息,请使用以下配置文件安装blackboxu exporter。如果您想查看ETH价格信息,请安装go。使用以下配置文件。
modules: icmp: prober: icmp timeout: 10s icmp: preferred_ip_protocol: ipv4
- 使用以下配置文件安装Prometheus。
- 安装Grafana。
metrics: - name: ethusd path: $.ethereum.usd help: Ethereum (ETH) price in USD
- 登录到Grafana并添加http://XXX.XXX.XXX.XXX:9090/作为普罗米修斯数据源。
global: scrape_interval: 15s scrape_configs: - job_name: 'prometheus' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:9090'] - job_name: 'beacon node' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:8080'] - job_name: 'node_exporter' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:9100'] - job_name: 'validator' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:8081'] - job_name: 'ping_google' metrics_path: /probe params: module: [icmp] static_configs: - targets: - 8.8.8.8 relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port. - job_name: 'ping_cloudflare' metrics_path: /probe params: module: [icmp] static_configs: - targets: - 1.1.1.1 relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port. - job_name: json_exporter static_configs: - targets: - 127.0.0.1:7979 - job_name: json metrics_path: /probe static_configs: - targets: - https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:7979
- 将Prysm仪表板添加到Grafana。
- 在左侧菜单上,将鼠标悬停在“齿轮”菜单上,然后单击“数据源”。
- 然后单击“添加数据源”按钮。
详细的Ubuntu 20.04安装
创建普罗米修斯希望找到的目录。
Prometheus
创建用户帐户
sudo adduser --system prometheus --group --no-create-home
安装Prometheus
创建prometheus配置文件。打开新的配置文件。
cd wget https://github.com/prometheus/prometheus/releases/download/v2.22.1/prometheus-2.22.1.linux-amd64.tar.gz tar xzvf prometheus-2.22.1.linux-amd64.tar.gz cd prometheus-2.22.1.linux-amd64 sudo cp promtool /usr/local/bin/ sudo cp prometheus /usr/local/bin/ sudo chown root:root /usr/local/bin/promtool /usr/local/bin/prometheus sudo chmod 755 /usr/local/bin/promtool /usr/local/bin/prometheus cd rm prometheus-2.22.1.linux-amd64.tar.gz
配置Prometheus
将以下文本复制并粘贴到普罗米修斯配置文件:
sudo mkdir -p /etc/prometheus/console_libraries /etc/prometheus/consoles /etc/prometheus/files_sd /etc/prometheus/rules /etc/prometheus/rules.d
注意:这些说明的早期版本的用户可能将信标节点作业名称设置为“beacon”而不是“beacon node”。从该存储库选择Grafana仪表板时,如果使用“beacon”作为作业名称,请选择该仪表板;如果使用“beacon node”作为作业名称,请选择该仪表板。
sudo nano /etc/prometheus/prometheus.yml
将prometheus配置目录的所有权更改为prometheus用户。
global: scrape_interval: 15s scrape_configs: - job_name: 'prometheus' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:9090'] - job_name: 'beacon node' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:8080'] - job_name: 'node_exporter' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:9100'] - job_name: 'validator' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:8081'] - job_name: 'ping_google' metrics_path: /probe params: module: [icmp] static_configs: - targets: - 8.8.8.8 relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port. - job_name: 'ping_cloudflare' metrics_path: /probe params: module: [icmp] static_configs: - targets: - 1.1.1.1 relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port. - job_name: json_exporter static_configs: - targets: - 127.0.0.1:7979 - job_name: json metrics_path: /probe static_configs: - targets: - https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:7979
为prometheus文件创建一个目录,由prometheus用户帐户拥有,并具有适当的权限。
设置systemd自动启动普罗米修斯。如果停止,它还会重新启动软件。
sudo chown -R prometheus:prometheus /etc/prometheus
安装systemd
安装Prometheus数据源
安装Grafana仪表板
最终Grafana仪表板配置
网络流量配置
节点导出器
创建用户帐户
安装节点导出器
设置系统服务
jsonu导出器
安装go
安装git
创建用户帐户
安装json导出器
配置json导出器
设置系统服务
可选
黑盒导出器
创建用户帐户
安装黑盒导出器
配置黑盒导出器
设置系统服务
将以下文本复制并粘贴到普罗米修斯服务公司文件。
sudo mkdir /var/lib/prometheus sudo chown prometheus:prometheus /var/lib/prometheus sudo chmod 755 /var/lib/prometheus
安装systemd
重新加载systemd服务文件配置,启动prometheus,然后启用prometheus服务,使其在重新启动时自动启动。
sudo nano /etc/systemd/system/prometheus.service
使用apt get设置并安装Grafana。
[Unit] Description=Prometheus Wants=network-online.target After=network-online.target [Service] User=prometheus Group=prometheus Type=simple Restart=always RestartSec=5 ExecStart=/usr/local/bin/prometheus --config.file /etc/prometheus/prometheus.yml --storage.tsdb.path /var/lib/prometheus/ --web.console.templates=/etc/prometheus/consoles --web.console.libraries=/etc/prometheus/console_libraries [Install] WantedBy=multi-user.target
重新加载systemd服务文件配置,启动Grafana,然后启用Grafana服务,使其在重新启动时自动启动。
sudo systemctl daemon-reload sudo systemctl start prometheus.service sudo systemctl enable prometheus.service
安装Prometheus数据源
登录Grafanahttp://XXX.XXX.XXX.XXX:3000/,替换三十、 XXX.XXX.XXX与服务器的IP地址。如果不知道IP地址,请运行ifconfig。
cd sudo apt-get install -y apt-transport-https sudo apt-get install -y software-properties-common wget wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" sudo apt-get update sudo apt-get install grafana-enterprise
安装Grafana仪表板
默认用户名admin。默认密码管理员。Grafana会要求你设置一个新密码。
sudo systemctl daemon-reload sudo systemctl start grafana-server sudo systemctl enable grafana-server
注意:在运行所有必需的软件之前,某些面板不会显示数据。这个仪表板的各个部分直接或间接地依赖于Prometheus、Prysm beacon chain、Prysm validator、nodeu exporter和blackbox exporter。
驱动Grafana仪表板的一些查询可能需要不同的设置,具体取决于您的硬件。
最终Grafana仪表板配置
- 将鼠标悬停在屏幕上的普罗米修斯卡上,然后单击“选择”按钮。
- 输入http://127.0.0.1:9090/输入URL字段,然后单击“保存和测试”。
- 将鼠标悬停在左侧菜单中的加号图标上,然后单击导入。
- 复制并粘贴仪表板https://raw.githubusercontent.com/metanull-operator/eth2-grafana/master/eth2-grafana-dashboard-single-source-beacon_node.json进入屏幕上的“Import via panel json”文本框。如果您使用的是这些说明的旧版本,其中Prometheus配置文件使用的信标节点作业名称为“beacon”而不是“beacon node”,请使用此仪表板以实现向后兼容性。
网络流量配置
- 然后单击“加载”按钮。
- 然后单击导入按钮。
- 转到以前安装的Grafana仪表板
- 查找网络流量小部件,然后打开可通过网络流量标题找到的下拉列表。
要确保网络流量正确反映在Grafana仪表板上,请更新网络流量小部件中的网络接口。运行以下命令查找您的Linux网络设备。
节点导出器
命令的输出应该如下所示:
创建用户帐户
在上面显示的两个条目中,第一个在第二行网络接口eno1上列出了我的IP地址。找到表示要监视的网络连接的条目并复制设备名,即每个条目第一行冒号之前的部分。在我的例子中,值是eno1。
ifconfig
节点导出器允许Prometheus记录系统数据,如CPU使用率、内存使用率、CPU温度和磁盘使用率。
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::1e69:7aff:fe63:14b0 prefixlen 64 scopeid 0x20<link> ether 1c:69:7a:63:14:b0 txqueuelen 1000 (Ethernet) RX packets 238936 bytes 78487335 (78.4 MB) RX errors 0 dropped 1819 overruns 0 frame 0 TX packets 257824 bytes 112513038 (112.5 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 16 memory 0x96300000-96320000 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 39805 bytes 29126770 (29.1 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 39805 bytes 29126770 (29.1 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
使用apt get设置并安装nodeu exporter。
- 单击“编辑”。
- 在出现的查询中将有四个对eno1的引用。用在ifconfig命令中找到的网络接口的名称替换所有四个接口。你知道吗
- Click Edit.
- There will be four references to
eno1
in the queries that appear. Replace all four with the name of the network interface you found in theifconfig
command.
安装节点导出器
将systemd设置为自动启动nodeu exporter。如果停止,它还会重新启动软件。
将以下文本复制并粘贴到节点中_出口商服务文件。
jsonu导出器
sudo adduser --system node_exporter --group --no-create-home
安装go
cd wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz tar xzvf node_exporter-1.0.1.linux-amd64.tar.gz sudo cp node_exporter-1.0.1.linux-amd64/node_exporter /usr/local/bin/ sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter rm node_exporter-1.0.1.linux-amd64.tar.gz
安装git
重新加载systemd服务文件配置,启动nodeu exporter,然后启用nodeu exporter服务,使其在重新启动时自动启动。
sudo nano /etc/systemd/system/node_exporter.service
为jsonu exporter配置文件创建一个目录,并使其归jsonu exporter帐户所有。
[Unit] Description=Node Exporter [Service] Type=simple Restart=always RestartSec=5 User=node_exporter ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=multi-user.target
编辑json导出器配置文件。
sudo systemctl daemon-reload sudo systemctl start node_exporter.service sudo systemctl enable node_exporter.service
创建用户帐户
安装json导出器
sudo apt-get install golang-1.14-go # Create a symlink from /usr/bin/go to the new go installation sudo ln -s /usr/lib/go-1.14/bin/go /usr/bin/go
配置json导出器
sudo apt-get install git
设置系统服务
sudo adduser --system json_exporter --group --no-create-home
可选
cd git clone https://github.com/prometheus-community/json_exporter.git cd json_exporter make build sudo cp json_exporter /usr/local/bin/ sudo chown json_exporter:json_exporter /usr/local/bin/json_exporter
黑盒导出器
将以下文本复制并粘贴到json中_出口商.yml文件。
sudo mkdir /etc/json_exporter sudo chown json_exporter:json_exporter /etc/json_exporter
将配置文件的所有权更改为jsonu导出器帐户。
sudo nano /etc/json_exporter/json_exporter.yml
将systemd设置为自动启动jsonu导出器。如果停止,它还会重新启动软件。
metrics: - name: ethusd path: $.ethereum.usd help: Ethereum (ETH) price in USD
将以下文本复制并粘贴到json中_出口商服务文件。
sudo chown json_exporter:json_exporter /etc/json_exporter/json_exporter.yml
创建用户帐户
重新加载systemd服务文件配置,启动nodeu exporter,然后启用jsonu exporter服务,使其在重新启动时自动启动。
sudo nano /etc/systemd/system/json_exporter.service
我使用blackboxu exporter在我的锁定系统和两个DNS提供商之间提供ping(网络延迟)数据。这也可以用来查看网络停机时间。
[Unit] Description=JSON Exporter [Service] Type=simple Restart=always RestartSec=5 User=json_exporter ExecStart=/usr/local/bin/json_exporter --config.file /etc/json_exporter/json_exporter.yml [Install] WantedBy=multi-user.target
这些说明中的Grafana仪表板包括一个带有ping时间图的面板。如果您选择不安装blackboxu exporter,只需从Grafana仪表板中删除该面板。它不会显示数据。
sudo systemctl daemon-reload sudo systemctl start json_exporter.service sudo systemctl enable json_exporter.service
安装黑盒导出器
blackbox_exporter
为blackboxu exporter提供了特殊的网络数据包创建功能,允许ping服务器。
删除原始blackboxu导出程序包。
Create User Account
sudo adduser --system blackbox_exporter --group --no-create-home
Install blackbox_exporter
cd wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.18.0/blackbox_exporter-0.18.0.linux-amd64.tar.gz tar xvzf blackbox_exporter-0.18.0.linux-amd64.tar.gz sudo cp blackbox_exporter-0.18.0.linux-amd64/blackbox_exporter /usr/local/bin/ sudo chown blackbox_exporter:blackbox_exporter /usr/local/bin/blackbox_exporter sudo chmod 755 /usr/local/bin/blackbox_exporter
编辑黑盒导出器配置文件。
sudo setcap cap_net_raw+ep /usr/local/bin/blackbox_exporter
将以下文本复制并粘贴到黑盒.yml文件。
rm blackbox_exporter-0.18.0.linux-amd64.tar.gz
Configure blackbox_exporter
sudo mkdir /etc/blackbox_exporter sudo chown blackbox_exporter:blackbox_exporter /etc/blackbox_exporter
将配置文件的所有权更改为blackboxu exporter帐户。
sudo nano /etc/blackbox_exporter/blackbox.yml
将systemd设置为自动启动blackboxu exporter。如果停止,它还会重新启动软件。
modules: icmp: prober: icmp timeout: 10s icmp: preferred_ip_protocol: ipv4
sudo nano/etc/systemd/system/blackbox_出口商服务
sudo chown blackbox_exporter:blackbox_exporter /etc/blackbox_exporter/blackbox.yml
Set Up System Service
将下列文本复制并粘贴到黑框中_出口商服务文件。
重新加载systemd服务文件配置,启动blackboxu exporter,然后启用blackboxu exporter服务,使其在重新启动时自动启动。
Copy and paste the following text into the blackbox_exporter.service file.
[Unit] Description=Blackbox Exporter [Service] Type=simple Restart=always RestartSec=5 User=blackbox_exporter ExecStart=/usr/local/bin/blackbox_exporter --config.file /etc/blackbox_exporter/blackbox.yml [Install] WantedBy=multi-user.target
Reload the systemd service file configurations, start blackbox_exporter, then enable the blackbox_exporter service to have it start automatically on reboot.
sudo systemctl daemon-reload sudo systemctl start blackbox_exporter.service sudo systemctl enable blackbox_exporter.service
部分转自网络,侵权联系删除区块链源码网
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计eth2-grafana – eth2格拉法纳