页面“Process-exporter”与“Filebeat nginx log”之间的差异

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
 
 
第1行: 第1行:
 +
[[category:ops]]
  
=down and inst=
+
=ins and config=
 +
==Download and install Filebeat==
 
<pre>
 
<pre>
wget  -c https://github.com/ncabatoff/process-exporter/releases/download/v0.7.5/process-exporter-0.7.5.linux-amd64.tar.gz
 
# wget  -c https://github.com/ncabatoff/process-exporter/releases/download/v0.5.0/process-exporter-0.5.0.linux-amd64.tar.gz
 
  
  
process-exporter]# pwd
+
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.12.0-amd64.deb
/data/apps/process-exporter
+
sudo dpkg -i filebeat-7.12.0-amd64.deb
[root@prod-sns-mq01 process-exporter]# cat process-name.yaml
+
</pre>
process_names:
+
==Edit the configuration ==
  - name: "{{.Matches}}"
+
<pre>
    cmdline:
+
Modify /etc/filebeat/filebeat.yml to set the connection information:
    - 'redis'
 
  
   - name: "{{.Matches}}"
+
output.elasticsearch:
    cmdline:
+
  hosts: ["<es_url>"]
    - 'nuxt'
+
   username: "elastic"
 +
  password: "<password>"
 +
setup.kibana:
 +
  host: "<kibana_url>"
  
 +
Where <password> is the password of the elastic user, <es_url> is the URL of Elasticsearch, and <kibana_url> is the URL of Kibana.
  
./process-exporter -config.path process-name.yaml &
+
</pre>
  
 +
==Enable and configure the nginx module ==
  
#!/bin/bash
+
<pre>
./process-exporter -config.path process-name.yaml & > process-exporter.log
+
sudo filebeat modules enable nginx
  
 +
Modify the settings in the /etc/filebeat/modules.d/nginx.yml file.
  
curl http://localhost:9256/metrics
+
</pre>
  
 +
== Start Filebeat==
  
启动脚本
+
<pre>
 
+
The setup command loads the Kibana dashboards. If the dashboards are already set up, omit this command.
cat  /etc/systemd/system/process-exporter.service
 
[Unit]
 
Description=process-exporterr
 
After=network.target
 
Wants=network-online.target
 
 
 
[Service]
 
Type=simple
 
User=root
 
ExecStart=/data/apps/process-exporter/process-exporter  -config.path /data/apps/process-exporter/process-name.yaml
 
 
 
Restart=on-failure
 
LimitNOFILE=65536
 
 
 
[Install]
 
WantedBy=multi-user.target
 
 
 
systemctl  enable  process-exporter
 
systemctl  start  process-exporter  && systemctl  status    process-exporter
 
 
 
  
 +
sudo filebeat setup
 +
sudo service filebeat start
 
</pre>
 
</pre>
  
=配置 =
+
== Module status==
 
<pre>
 
<pre>
 
+
Module status  右边的 check data 按键  -- > Nginx logs dashboard
这个是在 安装了 process-exporter的机器上
 
Process-Exporter的做法是配置需要监控的进程的名称,他会去搜索该进程从而得到其需要的监控信息, 其实也就是我们常做的“ps -efl | grep xxx”命令来查看对应的进程。配置文件一开始是不存在的,需要我们创建,名字可以自定义:
 
 
 
 
 
这个配置是在 prometheus机器上
 
现在,我们需要去配置Prometheus来采集这份数据了,和其他配置一样,就是给Prometheus添加一份数据源:
 
  - job_name: 'snsweb2-process'
 
    static_configs:
 
    - targets: ['12.41.11.20:9256']
 
 
 
 
 
  
 
</pre>
 
</pre>
 +
systemctl daemon-reload
  
 
=see also=
 
=see also=
  
[https://www.jianshu.com/p/6a7511004766 Prometheus监控进程状态(Process-Exporter)]
+
https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-nginx.html
 
 
[https://blog.csdn.net/u012599988/article/details/102929269 Grafana+Prometheus+Process-exporter/node_exporter监控服务进程(三)]
 
 
 
[https://www.cnblogs.com/huandada/p/10431667.html Prometheus — Process-exporter进程监控 ]
 
  
[https://www.cnblogs.com/bigberg/p/10174222.html Prometheus 监控进程]
 
  
[[category:ops]] [[category:container]]
+
[https://www.cnblogs.com/kuku0223/p/8317965.html ELK--filebeat nginx模块]

2021年4月27日 (二) 09:25的版本


ins and config

Download and install Filebeat



curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.12.0-amd64.deb
sudo dpkg -i filebeat-7.12.0-amd64.deb

Edit the configuration

Modify /etc/filebeat/filebeat.yml to set the connection information:

output.elasticsearch:
  hosts: ["<es_url>"]
  username: "elastic"
  password: "<password>"
setup.kibana:
  host: "<kibana_url>"

Where <password> is the password of the elastic user, <es_url> is the URL of Elasticsearch, and <kibana_url> is the URL of Kibana.

Enable and configure the nginx module

sudo filebeat modules enable nginx

Modify the settings in the /etc/filebeat/modules.d/nginx.yml file.

Start Filebeat

The setup command loads the Kibana dashboards. If the dashboards are already set up, omit this command.

sudo filebeat setup
sudo service filebeat start

Module status

Module status  右边的 check data 按键  -- > Nginx logs dashboard

systemctl daemon-reload

see also

https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-nginx.html


ELK--filebeat nginx模块