监控组件前准备
Nginx组件
-
Nginx需要开启
ngx_http_stub_status_module模块。 -
在每个NGINX服务器上,在包含其他NGINX配置文件的目录中(如
/usr/local/nginx/conf/)创建一个status.conf文件:
status.conf
server {
listen 81;
server_name localhost;
access_log off;
# allow 127.0.0.1;
# deny all;
location /nginx_status {
# Choose your status module
# freely available with open source NGINX
stub_status;
# for open source NGINX < version 1.7.5
# stub_status on;
# available only with NGINX Plus
# status;
}
}
- 配置
nginx.conf文件,在http部分中添加以下配置块:
nginx.conf
...
http {
include /usr/local/nginx/conf/status.conf;
}
Tomcat组件
需要war包集成到tomcat中,请您参考tomcat_exporter。
-
下载以下jar包放到Tomcat的lib目录下:
- simpleclient
- simpleclient_common
- simpleclient_hotspot
- simpleclient_servlet
- simpleclient_servlet_common
- tomcat_exporter_client
-
下载
tomcat_exporter_servletwar包,点击tomcat_exporter_servlet下载war包,重命名为metrics.war,放到Tomcat的webapps目录下。 -
重启tomcat。