Prometheus system monitoring - deployment notes
Prometheus
Prometheus can implement server monitoring
download
https://prometheus.io/download/
unzip
tar xvfz prometheus-*.tar.gz
Download Exporter
Exporter plug-in equivalent, for example, to monitor the java-related service needs Exporter JMX
JMX-Exporter
https://github.com/prometheus/jmx_exporter
the need for monitoring of services, increase startup command
to specify a javaagent, corresponding to the start port configuration file
-javaagent: /root/jmx_prometheus_javaagent-0.3.1.jar=9001: /root/java.yml
example
nohup java -javaagent:/root/jmx_prometheus_javaagent-0.3.1.jar=9001:/root/java.yml -jar hrss-cz-nk-monitor-app.jar --server.port=8090 >app.log 2>&1 &
nohup ./startWebLogic.sh -javaagent:/tar/jmx_prometheus_javaagent-0.3.1.jar=9903:/tar/weblogic_config.yml >>log.out 2>&1 &
weblogic_config.yml
username: weblogic
password: weblogic123
lowercaseOutputName: false
lowercaseOutputLabelNames: false
whitelistObjectNames:
- "com.bea:ServerRuntime=*,Type=ApplicationRuntime,*"
- "com.bea:Type=WebAppComponentRuntime,*"
- "com.bea:Type=ServletRuntime,*"
rules:
- pattern: "^com.bea<ServerRuntime=.+, Name=(.+), ApplicationRuntime=(.+), Type=ServletRuntime, WebAppComponentRuntime=(.+)><>(.+): (.+)"
attrNameSnakeCase: true
name: weblogic_servlet_
value:
labels:
name:
app:
servletName:
- pattern: "^com.bea<ServerRuntime=(.+), Name=(.+), ApplicationRuntime=(.+), Type=WebAppComponentRuntime><>(.+): (.+)$"
attrNameSnakeCase: true
name: webapp_config_
value:
labels:
app:
name:
Configuration tasks in the job in prometheus
- job_name: 'jmx-expoter'
static_configs:
- targets: ['localhost:9001']
Start Service
nohup ./prometheus --config.file=prometheus.yml > prometheus.log 2>&1 &
Access 9090 port
http://www.jsong.wiki:9090
View prometheus the target, contains all the tasks
http://www.jsong.wiki:9090/targets
Monitoring graphical interface can be combined grafana use, more attractive
grafana is an open source visualization tool that can develop their own plug-ins, documentation is full, you can choose a lot of data sources, including Prometheus
grafana download
installation
sudo yum localinstall grafana-5.4.0-1.x86_64.rpm
sudo rpm -Uvh grafana-5.4.0-1.x86_64.rpm
Kai Services
sudo /bin/systemctl start grafana-server.service
Stop Service
sudo /bin/systemctl stop grafana-server.service