Install deployment and write independent log files
Download
1 2
| wget "https://github.com/prometheus/pushgateway/releases/download/v1.11.1/pushgateway-1.11.1.linux-amd64.tar.gz" tar zxvf pushgateway-1.11.1.linux-amd64.tar.gz -C /opt/soft/
|
Configuration file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| [Unit] Description=pushgateway Documentation=https://prometheus.io/docs/introduction/overview/ After=network.target
[Service] User=prometheus Group=prometheus ExecStart=/opt/soft/pushgateway-1.11.1.linux-amd64/pushgateway StandardOutput=syslog StardardError=syslog SyslogIdentifier=pushgateway Restart=always
[Install] WantedBy=multi-user.target
|
1 2 3 4 5
| /etc/rsyslog.d/node-exporter.conf if ($programname == "node-exporter")then{ action(type="omfile" file="/var/log/node-exporter.log") stop }
|
1 2 3 4 5 6 7
| cat pushgateway.yml scrape_configs: - job_name: "pushgateway" honor_labels: true static_configs: - targets: ['127.0.0.1:9091']
|
Write metrics
1 2 3
| echo "testcadqueue 111" | curl --data-binary @- http://127.0.0.1:9091/metrics/job/pushgateway/cad/joyplan Multiple label write: echo "testcadqueue 111" | curl --data-binary @- http://127.0.0.1:9091/metrics/job/pushgateway/env/joyplan/type/cad/name/Test
|