共计 2753 个字符,预计需要花费 7 分钟才能阅读完成。
在企业的零碎平台上运行 artifactory 可能每天有上百万个制品在一直流转,随着研发团队不断扩大,用户缓缓增多,并发量也相应的逐步增大,在保障高可用的同时,咱们对 artifactory 所在零碎及应用服务进行监控会显得尤其重要。那么如何实现零碎及利用的监控呢?
这篇文章形容如何通过 prometheus、grafana 实现对 Artifactory 的根底零碎及利用 JVM 监控。
一、Prometheus Server 端部署
下载安装包并解压(以版本 2.11.1 为例)
下载地址:https://prometheus.io/download/
mkdir /opt/monitor/prometheus;cd /opt/monitor/prometheus
unzip prometheus.zip ./
tar zxf prometheus-2.11.1.linux-amd64.tar.gz
mv prometheus-2.11.1.linux-amd64 prometheus-2.11.1
增加为零碎服务
vim /usr/lib/systemd/system/prometheus-server.service
[Unit]
Description=prometheus-server
After=network.target
[Service]
Type=simple
User=root
ExecStart=/opt/monitor/prometheus/prometheus-2.11.1/prometheus –config.file=/opt/monitor/prometheus/prometheus-2.11.1/prometheus.yml
Restart=on-failure
[Install]
WantedBy=multi-user.target
启动并退出开机自启
systemctl start prometheus-server
systemctl enable prometheus-server
拜访
http://ip:9090
二、Prometheus Node 端部署
下载安装包并解压(以版本 0.18.1 为例)
cd /opt/monitor/prometheus
unzip prometheus.zip ./
tar zxf node_exporter-0.18.1.linux-amd64.tar.gz
mv node_exporter-0.18.1.linux-amd64 node_exporter-0.18.1
增加为零碎服务
vim /usr/lib/systemd/system/prometheus-node.service
[Unit]
Description=prometheus-node
After=network.target
[Service]
Type=simple
User=root
ExecStart=/opt/monitor/prometheus/node_exporter-0.18.1/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
启动并退出开机自启
systemctl start prometheus-node
systemctl enable prometheus-node
三、Grafana 部署
下载安装包并装置(以 6.2.5.1 为例)
wget https://dl.grafana.com/oss/re…
yum localinstall grafana-6.2.5-1.x86_64.rpm -y
启动
systemctl start/stop/restart/enable grafana-server
拜访
http://IP:3000
默认用户名 / 明码:admin/admin
四、配置 Artifactory 节点系统监控
配置 prometheus
在 Artifactory 各个节点装置好 Prometheus Node 后,批改 /opt/monitor/prometheus-2.11.1/prometheus.yml,增加:
- job_name: ‘artifactory’
static_configs:
– targets: [‘IP1:9100′,’IP2:9100’]
重启 prometheus-server
systemctl restart prometheus-server
查看监控状态及数据查问示例
应用 grafana 展现,模板可参考
https://grafana.com/dashboard…
监控状态如下图
五、配置 Artifactory 节点 JVM 监控
下载 jmx_prometheus_javaagent-0.12.0.jar
下载地址参考:https://repo1.maven.org/maven…
Jar 包门路:/opt/monitor/prometueus/jmx_prometheus_javaagent-0.12.0.jar
增加配置文件
vim /opt/monitor/prometheus/jmx_config.yaml
lowercaseOutputLabelNames: true
lowercaseOutputName: true
rules:
- pattern: “.*”
批改 Artifactory tomcat 配置文件
vim $ARTIFACTORY_HOME/tomcat/bin/catalina.sh, 增加:
JAVA_OPTS=”$JAVA_OPTS -javaagent:/opt/monitor/prometheus/jmx_prometheus_javaagent-0.12.0.jar=30013:/opt/monitor/prometheus/jmx_config.yaml”
重启 Artifactory
systemctl restart artifactory
批改 prometheus 配置
批改 /opt/monitor/prometheus/prometheus-2.11.1/prometheus.yml,增加:
- job_name: ‘Artifactory-jmx’
static_configs:
– targets: [‘IP1:30013′,’IP2:30013’]
重启 Prometheus Server
在 Grafana 上展现监控信息
可参考模板:https://grafana.com/dashboard…
依据理论状况自定义批改模板配置
如:点击 dashbord 设置,批改 $job 的 value 为 Artifactory-jmx
Artifactory-JMX 监控展现