nginx_exporter下载地址
Nginx_module-vts下载地址
nginx-release下载地址
注意:我这边是使用rpm安装的Nginx。所以要进行编译一下,可以根据自己的实际情况进行操作
如果有这两个目录将其删除掉
rm -rf Makefile objs
./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-compat --with-debug --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' --add-module=/opt/nginx/nginx-module-vts-0.1.18
注意: 不要执行make install
make
location /status {
vhost_traffic_status_display;
vhost_traffic_status_display_format html;
}
启动nginx-vts-exporter(默认端口为9913)
nohup ./nginx-vts-exporter -nginx.scrape_uri=http://127.0.0.1:80/status/format/json &
vim promethues.yml
- job_name: "nginx_exporter"
static_configs:
- targets: ["localhost:9913"]
jmx_prometheus_javaagent
grafana模块
vim /usr/hbase/conf/ hbase_jmx_config.yaml
---
lowercaseOutputName: true
lowercaseOutputLabelNames: true
rules:
- pattern: Hadoop<service=HBase, name=RegionServer, sub=Regions><>Namespace_([^\W_]+)_table_([^\W_]+)_region_([^\W_]+)_metric_(\w+)
name: HBase_metric_$4
labels:
namespace: "$1"
table: "$2"
region: "$3"
- pattern: Hadoop<service=(\w+), name=(\w+), sub=(\w+)><>([\w._]+)
name: hadoop_$1_$4
labels:
"name": "$2"
"sub": "$3"
- pattern: .+
注意:分别在master和regionserver 都要添加,但是要注意端口不可以相同。(每台服务都做以上操作)
-javaagent:$HBASE_HOME/lib/jmx_prometheus_javaagent-0.16.1.jar=17000:$HBASE_HOME/conf/hbase_jmx_config.yaml
-javaagent:$HBASE_HOME/lib/jmx_prometheus_javaagent-0.16.1.jar=18000:$HBASE_HOME/conf/hbase_jmx_config.yaml
http://127.0.0.1:17000/metrics
IP地址根据实际情况改写
vim prometheus.yml
- job_name: "hbase_exporter"
static_configs:
- targets: ["127.0.0.1:17000"]
- targets: ["127.0.0.1:18000"]
- targets: ["127.0.0.1:18000"]
- targets: ["127.0.0.1:18000"]
- targets: ["127.0.0.1:18000"]