jenkins构建记录收集&日志收集了解
系统配置
version: "3"
services:
influxdb:
image: influxdb:1.8 #时序数据库
container_name: influxdb
restart: always
ports:
- "8086:8086"
volumes:
- ./influxdb:/var/lib/influxdb
- /etc/localtime:/etc/localtime
hostname: influxdb
environment:
- ADMIN_USER=root
- INFLUXDB_INIT_PWD=123456
- PRE_CREATE_DB=jenkins
chronograf:
image: chronograf:1.8 #influxdb的仪表盘
container_name: chronograf
restart: always
ports:
- 8888:8888
volumes:
- ./chronograf:/var/lib/chronograf
grafana:
image: grafana/grafana:7.3.0
container_name: grafana
restart: always
links:
- influxdb:influxdb
ports:
- "3000:3000"
user: root
volumes:
- /etc/localtime:/etc/localtime
- ./grafana-data:/var/lib/grafana
- ./grafana-logs:/var/log/grafana
environment:
- INFLUXDB_HOST=influxdb
- INFLUXDB_PORT=8086
- GF_SECURITY_ADMIN_PASSWORD=123456
- GF_INSTALL_PLUGINS=grafana-piechart-panel # 设置要安装的插件
[root@vm config]# docker exec -it influxdb bash
root@influxdb:/# influx
Connected to http://localhost:8086 version 1.8.10
> CREATE DATABASE jenkins
> show databases
name: databases
name
----
_internal
jenkins
安装influxdb插件
系统配置–系统配置–InfluxDB Targets填写influx打包信息
jenkins添加构建够操作
完成构建配置后
[root@vm config]# docker exec -it influxdb bash
root@influxdb:/# influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> use jenkins
> select * from jenkins_data
name: jenkins_data
time build_agent_name build_branch_name build_cause build_causer build_exec_time build_measured_time build_number build_result build_result_1 build_result_ordinal build_scheduled_time build_status_message build_successful build_time build_user instance last_stable_build last_successful_build project_build_health project_name project_name_1 project_namespace project_path project_path_1
---- ---------------- ----------------- ----------- ------------ --------------- ------------------- ------------ ------------ -------------- -------------------- -------------------- -------------------- ---------------- ---------- ---------- -------- ----------------- --------------------- -------------------- ------------ -------------- ----------------- ------------ --------------
1677726793498000000 built-in UserIdCause Started by user admin 1677726793466 1677726793498 2 SUCCESS SUCCESS 0 1677726793461 stable true 25 admin http://localhost:30080/ 2 2 100 testdb testdb testdb testdb testdb
配置grafana
仪表盘上创建图表
influxdb 查询语句配置到到仪表盘
参考 https://www.jianshu.com/p/06b0da4737fd
构建日志收集
#构建shelle里增加
curl -Ssu "admin":"123456" "http://localhost:8080/job/项目名/$BUILD_TAG/logText/progressiveText?start=0" >> /data/logs/项目名-$BUILD_TAG.log
TICK技术栈
Telegraf收集和报告指标, InfluxDB时序数据库, Chronograf仪表板 和 Kapacitor告警,热度不是很高
prometheus技术栈
exporter prometheus grafana altermanager,对比上面,热度较高。
时序数据库InfluxDB、Prometheus、IotDB了解
etheus grafana altermanager,对比上面,热度较高。
时序数据库InfluxDB、Prometheus、IotDB了解