Nginx监控安装:Filebeat+ES+Grafana,阿里创新发布《新高并发宝典》

这篇具有很好参考价值的文章主要介绍了Nginx监控安装:Filebeat+ES+Grafana,阿里创新发布《新高并发宝典》。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

server_names_hash_bucket_size 128;

large_client_header_buffers 4 32k;

fastcgi_intercept_errors on;

proxy_intercept_errors on;

underscores_in_headers on;

client_header_timeout 15s;

client_body_timeout 15s;

client_max_body_size 100m;

client_body_buffer_size 2m;

client_header_buffer_size 256k;

#keepalive_timeout 0;

keepalive_timeout 90s;

keepalive_requests 2000;

MIME

include mime.types;

default_type application/octet-stream;

#log_format main '$remote_addr - r e m o t e u s e r [ remote_user [ remoteuser[time_local] “$request” ’

'$status b o d y b y t e s s e n t " body_bytes_sent " bodyb​ytess​ent"http_referer" ’

‘“ h t t p u s e r a g e n t " " http_user_agent" " httpu​sera​gent""http_x_forwarded_for”’;

#access_log logs/access.log main;

#tcp_nopush on;

#keepalive_timeout 0;

gzip

gzip on;

gzip_min_length 1k;

gzip_buffers 4 16k;

gzip_http_version 1.1;

gzip_comp_level 6;

gzip_types text/plain text/css application/javascript application/x-javascript application/xml application/json;

gzip_vary on;

proxy_connect_timeout 5s;

proxy_read_timeout 1800s;

proxy_send_timeout 1800s;

proxy_buffer_size 128k;

proxy_buffers 100 128k;

#proxy_busy_buffers_size 1m;

#proxy_temp_file_write_size 512k;

#this line shoud be include in every http block

include /app/openresty/nginx/waf/verynginx/verynginx/nginx_conf/in_http_block.conf;

log_format main ‘$remote_addr -’

’ $remote_user’

’ [$time_local]’

’ “$request”’

’ $status’

’ $body_bytes_sent’

’ “$http_referer”’

’ “$http_user_agent”’

’ “$http_x_forwarded_for”’

’ $upstream_response_time’

’ $upstream_addr’;

access_log logs/access.log main;

upstream gateway_pool {

网关的地址

server 106.12.129.14:9200;

}

server {

listen 80;

#this line shoud be include in every server block

include /app/openresty/nginx/waf/verynginx/verynginx/nginx_conf/in_server_block.conf;

#include /app/openresty/nginx/waf/verynginx/nginx_conf/in_http_block.conf;

location / {

proxy_http_version 1.1;

proxy_set_header Connection “”;

proxy_redirect off;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Host $host;

proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;

proxy_set_header Host $host;

proxy_pass http://gateway_pool;

}

}

}

#---------------VeryNginx config code end-----------------

如果不使用 VeryNginx 提供的配置模版,你也可以手动把这部分加入到自己的 Nginx 配置文件中. (如果安装路径不是/app/openresty ,需要对 lua_package_cpath 和 lua_package_path 的值进行修改)

1.4 启/停服务

启动服务: /app/openresty/nginx/sbin/nginx

停止服务:/app/openresty/nginx/sbin/nginx -s stop

1.5 配置VeryNginx

打开浏览器访问 http://127.0.0.1/VeryNginx/dashboard/index.html

默认用户名和密码:verynginx / verynginx 。

登录之后就可以查看状态,并对配置进行修改了。修改配置后,记得到 「配置 > 系统 > 全部配置」去保存.

提示

  • 通过 VeryNginx 控制面板保存新配置之后,会立刻生效,并不需要 restart/reload Nginx。

  • VeryNginx 把配置保存在 /app/openresty/nginx/waf/verynginx/configs/config.json 里面。

  • 如果因为配错了什么选项,导致无法登录,可以手动删除 config.json 来清空配置。

已安装成功openresty

可以用网盘的覆盖/app/openresty/nginx/waf目录

链接:https://pan.baidu.com/s/1nt2SfrDtk83Q4gvwIlpBfQ 提取码:g5hs

2. 安装elasticsearch


wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.4.tar.gz

tar -zxvf elasticsearch-6.5.4.tar.gz -C /usr/local/

useradd es

chown -R es:es /usr/local/elasticsearch-6.5.4/

cd /usr/local/elasticsearch-6.5.4

修改config/jvm.options为内存的一半大小

vi config/jvm.options

-Xms512m

-Xmx512m

修改 max file 和 max virtual memory 参数

用root 或 sudo 用户

vi /etc/sysctl.conf

添加下面配置:

vm.max_map_count=655360

并执行命令:

sysctl -p

配置端口 跨域

vi /usr/local/elasticsearch-6.5.4/config/elasticsearch.yml

cluster.name: elasticsearch

node.name: node-1

network.host: 0.0.0.0

http.port: 9200

node.max_local_storage_nodes: 2

http.cors.enabled: true

http.cors.allow-origin: “*”

切换es用户

su - es

在Elasticsearch主目录下运行下列命令来安装这些插件:

bin/elasticsearch-plugin install ingest-geoip

bin/elasticsearch-plugin install ingest-user-agent

es用户启动

/usr/local/elasticsearch-6.5.4/bin/elasticsearch -d

root用户启动

su - es -c ‘/usr/local/elasticsearch-6.5.4/bin/elasticsearch -d’

2.1 windows 安装elasticseach-head

  • 访问 https://github.com/mobz/elasticsearch-head 下载 head 插件(选择 zip 压缩包下载方式)。

filebeat +grafana组合,2024年程序员学习,nginx,elasticsearch,grafana

  • 修改 ~\elasticsearch-6.6.2\elasticsearch-head-master\Gruntfile.js,在对应的位置加上 hostname:’*’ 配置项。

filebeat +grafana组合,2024年程序员学习,nginx,elasticsearch,grafana

  • 在 ~\elasticsearch-6.6.2\elasticsearch-head-master 下执行 npm install 开始安装,完成后可执行 grunt server 或者 npm run start 运行 head 插件。

filebeat +grafana组合,2024年程序员学习,nginx,elasticsearch,grafana

  • 安装成功,访问 http://localhost:9100/。

filebeat +grafana组合,2024年程序员学习,nginx,elasticsearch,grafana

2.2 注意事项

  • 在 head 中连接 ES 失败。

filebeat +grafana组合,2024年程序员学习,nginx,elasticsearch,grafana

对于 Access-Control-Allow-Origin 的问题,可以在 ElasticSearch 6.x 的 ~\config\elasticsearch.yml 文件的末尾加入以下代码:

http.cors.enabled: true

http.cors.allow-origin: “*”

node.master: true node.data: true

配置更新后,重启 ES 即可连接成功。

3. 安装Filebeat


推荐博客:https://www.cnblogs.com/cjsblog/p/9495024.html

wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.5.4-linux-x86_64.tar.gz

tar -zxvf filebeat-6.5.4-linux-x86_64.tar.gz -C /usr/local/

cd /usr/local/

mv filebeat-6.5.4-linux-x86_64 filebeat-6.5.4

cd /usr/local/filebeat-6.5.4

vi filebeat.yml

filebeat.inputs:

  • type: log

enabled: false

paths:

  • /app/openresty/nginx/logs/access.log

#============================= Filebeat modules ===============================

filebeat.config.modules:

path: ${path.config}/modules.d/*.yml

reload.enabled: false

setup.template.settings:

index.number_of_shards: 3

setup.template.name: “nginx-log-”

setup.template.pattern: “nginx-log-*”

setup.template.overwrite: true

output.elasticsearch:

enabled: true

hosts: [“106.13.3.200:9200”]

index: “nginx-log-%{+yyyy-MM-dd}”

#================================ Processors =====================================

Configure processors to enhance or manipulate events generated by the beat.

processors:

#- add_host_metadata: ~

#- add_cloud_metadata: ~

  • drop_fields:

fields: [“beat.name”, “beat.version”, “host.architecture”,“host.architecture”,“host.name”,“beat.hostname”,“log.file.path”]

3.1 启用模块nginx

cd /usr/local/filebeat-6.5.4/modules.d

vi nginx.yml

执行以下配置

  • module: nginx

Access logs

access:

enabled: true

Set custom paths for the log files. If left empty,

Filebeat will choose the paths depending on your OS.

var.paths: [“/app/openresty/nginx/logs/access.log”]

Error logs

error:

enabled: true

Set custom paths for the log files. If left empty,

Filebeat will choose the paths depending on your OS.

var.paths: [“/app/openresty/nginx/logs/error.log”]

3.2 配置 default.json

cd /usr/local/filebeat-6.5.4/module/nginx/access/ingest

vi default.json

{

“description”: “Pipeline for parsing Nginx access logs. Requires the geoip and user_agent plugins.”,

“processors”: [{

“grok”: {

“field”: “message”,

“patterns”:[

“”?%{IP_LIST:nginx.access.remote_ip_list} - %{DATA:nginx.access.user_name} \[%{HTTPDATE:nginx.access.time}\] “%{GREEDYDATA:nginx.access.info}” %{NUMBER:nginx.access.response_code} %{NUMBER:nginx.access.body_sent.bytes} “%{DATA:nginx.access.referrer}” “%{DATA:nginx.access.agent}” “%{GREEDYDATA:nginx.access.xforwardedfor}” %{GREEDYDATA:nginx.access.upstream_response_time} %{GREEDYDATA:nginx.access.upstream_addr}"

],

“pattern_definitions”: {

“IP_LIST”: “%{IP}(”?,?\s*%{IP})*"

},

“ignore_missing”: true

}

}, {

“grok”: {

“field”: “nginx.access.info”,

“patterns”: [

“%{WORD:nginx.access.method} %{DATA:nginx.access.url} HTTP/%{NUMBER:nginx.access.http_version}”,

“”

],

“ignore_missing”: true

}

}, {

“remove”: {

“field”: “nginx.access.info”

}

}, {

“split”: {

“field”: “nginx.access.remote_ip_list”,

“separator”: “”?,?\s+"

}

}, {

“script”: {

“lang”: “painless”,

“inline”: “boolean isPrivate(def ip) { try { StringTokenizer tok = new StringTokenizer(ip, ‘.’); int firstByte = Integer.parseInt(tok.nextToken()); int secondByte = Integer.parseInt(tok.nextToken()); if (firstByte == 10) { return true; } if (firstByte == 192 && secondByte == 168) { return true; } if (firstByte == 172 && secondByte >= 16 && secondByte <= 31) { return true; } if (firstByte == 127) { return true; } return false; } catch (Exception e) { return false; } } def found = false; for (def item : ctx.nginx.access.remote_ip_list) { if (!isPrivate(item)) { ctx.nginx.access.remote_ip = item; found = true; break; } } if (!found) { ctx.nginx.access.remote_ip = ctx.nginx.access.remote_ip_list[0]; }”

}

}, {

“remove”:{

“field”: “message”

}

}, {

“rename”: {

“field”: “@timestamp”,

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Java工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
filebeat +grafana组合,2024年程序员学习,nginx,elasticsearch,grafana
filebeat +grafana组合,2024年程序员学习,nginx,elasticsearch,grafana
filebeat +grafana组合,2024年程序员学习,nginx,elasticsearch,grafana
filebeat +grafana组合,2024年程序员学习,nginx,elasticsearch,grafana
filebeat +grafana组合,2024年程序员学习,nginx,elasticsearch,grafana
filebeat +grafana组合,2024年程序员学习,nginx,elasticsearch,grafana

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新

如果你觉得这些内容对你有帮助,可以添加V获取:vip1024b (备注Java)
filebeat +grafana组合,2024年程序员学习,nginx,elasticsearch,grafana

最后

文章中涉及到的知识点我都已经整理成了资料,录制了视频供大家下载学习,诚意满满,希望可以帮助在这个行业发展的朋友,在论坛博客等地方少花些时间找资料,把有限的时间,真正花在学习上,所以我把这些资料,分享出来。相信对于已经工作和遇到技术瓶颈的朋友们,在这份资料中一定都有你需要的内容。

一个人可以走的很快,但一群人才能走的更远。如果你从事以下工作或对以下感兴趣,欢迎戳这里加入程序员的圈子,让我们一起学习成长!

AI人工智能、Android移动开发、AIGC大模型、C C#、Go语言、Java、Linux运维、云计算、MySQL、PMP、网络安全、Python爬虫、UE5、UI设计、Unity3D、Web前端开发、产品经理、车载开发、大数据、鸿蒙、计算机网络、嵌入式物联网、软件测试、数据结构与算法、音视频开发、Flutter、IOS开发、PHP开发、.NET、安卓逆向、云计算文章来源地址https://www.toymoban.com/news/detail-860750.html

有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,真正体系化!**

由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新

如果你觉得这些内容对你有帮助,可以添加V获取:vip1024b (备注Java)
[外链图片转存中…(img-iyXvwiET-1712177290951)]

最后

文章中涉及到的知识点我都已经整理成了资料,录制了视频供大家下载学习,诚意满满,希望可以帮助在这个行业发展的朋友,在论坛博客等地方少花些时间找资料,把有限的时间,真正花在学习上,所以我把这些资料,分享出来。相信对于已经工作和遇到技术瓶颈的朋友们,在这份资料中一定都有你需要的内容。

一个人可以走的很快,但一群人才能走的更远。如果你从事以下工作或对以下感兴趣,欢迎戳这里加入程序员的圈子,让我们一起学习成长!

AI人工智能、Android移动开发、AIGC大模型、C C#、Go语言、Java、Linux运维、云计算、MySQL、PMP、网络安全、Python爬虫、UE5、UI设计、Unity3D、Web前端开发、产品经理、车载开发、大数据、鸿蒙、计算机网络、嵌入式物联网、软件测试、数据结构与算法、音视频开发、Flutter、IOS开发、PHP开发、.NET、安卓逆向、云计算

到了这里,关于Nginx监控安装:Filebeat+ES+Grafana,阿里创新发布《新高并发宝典》的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • prometheus+grafana监控nginx的简单实现

    1.编译安装NGINX 加入编译安装nginx-module-vts模块,目的是为了获取更多的监控数据(虚拟主机,upstream等) nginx下载 http://nginx.org/download/nginx-1.20.2.tar.gz nginx-module-vts下载 https://github.com/vozlt/nginx-module-vts/archive/refs/tags/v0.2.1.tar.gz 解压缩,并将v0.2.1.tar.gz解压后的文件夹nginx-module-vts-0.2.1拷

    2024年03月21日
    浏览(34)
  • nginx+rsyslog+kafka+clickhouse+grafana 实现nginx 网关监控

    我想做一个类似腾讯云网关日志最终以仪表方式呈现,比如说qps、p99、p95的请求响应时间等等 数据流转就像标题 nginx ---- rsyslog ---- kafka — clickhouse — grafana kafka 相关部署这里不做赘述,只要创建一个topic 就可以 这里 kafka 地址是 192.168.1.180 ,topic是`` rsyslog 具体是啥东西这个我

    2024年02月03日
    浏览(36)
  • Filebeat入门及使用-5 读取nginx日志,写入ES,并用kibana展示

    1 安装nginx, 并找到nginx的日志目录,步骤3要使用 2 配置Filebeat的module,在Filebeat中,有大量的module,如mysql,kafka,redis,nginx等,可以简化我们的配置,方便使用。 查看Filebeat支持模块 命令:./filebeat modules list 启动Nginx模块 启动命令:./filebeat modules enable nginx 禁用命令:./fi

    2023年04月12日
    浏览(36)
  • ELK之使用Grafana读取ES集群的Nginx日志进行分析展示

    直通车 ------------↓↓↓↓↓↓ 需要ES集群 https://blog.csdn.net/wdy_2099/article/details/125441436 需要filebeat https://blog.csdn.net/wdy_2099/article/details/125445893 需要logstash https://blog.csdn.net/wdy_2099/article/details/125464226 需要grafana https://blog.csdn.net/wdy_2099/article/details/124211397 需要nginx 需要对grafana添加

    2024年01月21日
    浏览(27)
  • Grafana图形web监控的安装与配置

    目录 一、安装并配置 二、Web访问  三、Grafana启用zabbix插件  四、Grafana添加zabbix数据源  五、创建仪表盘  创建监控项完成保存仪表盘  六、查看创建的仪表盘  七、在现有的dashboard(仪表盘)中添加图形  八、查看最终dashborad(仪表盘)结果 grafana源码包提取链接 :https

    2024年02月15日
    浏览(40)
  • Docker安装Prometheus和Grafana监控Redis

    使用 Docker 安装 Grafana 和 Prometheus 无疑是最简单的,我们接下来将采用此种方式。 查看Prometheus镜像 拉取镜像 在 /home/zhangshixing/prometheus/ 目录下创建Prometheus的配置文件 prometheus.yml : 运行Prometheus,把宿主机中的配置文件 prometheus.yml 挂载到容器中去: 浏览器访问: 如果遇到:

    2024年02月12日
    浏览(37)
  • docker容器监控:Cadvisor +Prometheus+Grafana的安装部署

    目录 Cadvisor +Prometheus+Grafana的安装部署 一、安装docker: 1、安装docker-ce 2、阿里云镜像加速器 3、下载组件镜像 4、创建自定义网络 二、部署Cadvisor 1、被监控主机上部署Cadvisor容器 2、访问cAdvisor页面 三、安装prometheus 1、部署Prometheus  2、先准备配置 3、访问prometheus页面 四、部

    2024年02月14日
    浏览(36)
  • docker容器监控:Cadvisor+InfluxDB+Grafana的安装部署

    目录 Cadvisor+InfluxDB+Grafan安装部署 1、安装docker-ce 2、阿里云镜像加速器 3、下载组件镜像 4、创建自定义网络 5、创建influxdb容器 6、创建Cadvisor 容器 7、查看Cadvisor 容器: (1)准备测试镜像 (2)通过http://192.168.100.132:8080端口访问测试 8、创建granafa容器 [root@huyang2 ~]# iptables -F

    2024年02月14日
    浏览(34)
  • 【大数据监控】Grafana、Spark、HDFS、YARN、Hbase指标性能监控安装部署详细文档

    Grafana 是一款开源的数据可视化工具,使用 Grafana 可以非常轻松的将数据转成图表(如下图)的展现形式来做到数据监控以及数据统计。 解压 配置 mapping 文件 修改spark的metrics.properties配置文件,让其推送metrics到Graphite_exporter namenode.yaml datanode.yaml 配置 hadoop-env.sh yarn.yaml 配置 ya

    2023年04月21日
    浏览(46)
  • 二进制部署Prometheus + Grafana监控集群,及各exporter安装

    Prometheus三大组件: Server 主要负责数据采集和存储,提供PromQL查询语言的支持。 Alertmanager 警告管理器,用来进行报警。 Push Gateway 支持临时性Job主动推送指标的中间网关。 Prometheus是由SoundCloud开发的开源监控报警系统和时序列数据库(TSDB)。Prometheus使用Go语言开发,是Google B

    2024年02月13日
    浏览(38)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包