prometheus 监控 jar应用服务 + 修改监听IP和端口

1.修改服务的启动脚本

[root@do1cloud01 init.d]# vim learn-school
nohup ${JAVA_HOME}/bin/java -javaagent:/usr/local/prometheus_jmx_export_0.3.1/jmx_prometheus_javaagent-0.3..jar=:/usr/local/prometheus_jmx_export_0.3.1/simple-config.yml $JAVA_OPTS -jar $DEPLOY_JAR --spring.cloud.consul.discovery.hostname=${HOST_NAME} --spring.cloud.consul.host=$consul_host --server.port=${ACTIVE_PORT} --logging.file=$LOG_FILE > /dev/null >& &

2.cat  /usr/local/prometheus_jmx_export_0.3.1/simple-config.yml

---
rules:
- pattern: '.*'

3.修改Prometheus的监听ip和端口

[root@do1cloud03 system]# vim prometheus.service
--config.file=/usr/local/prometheus/prometheus.yml --web.listen-address=192.168.1.144:9090
./node_exporter --web.listen-address=":50001"

4.Prometheus的监控配置

  - job_name: 'jarauth44'
static_configs:
- targets: ['192.168.1.44:40015']
labels:
instance: auth
- targets: ['192.168.1.44:40016']
labels:
instance: learn

参考:https://www.jianshu.com/p/8a5e681b18ce

上一篇:linux下启动多个php,分别监听不同的端口。


下一篇:Java面试题集(四)