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.1.jar=40016:/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>&1 &
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