@Component
@Order(value=5)
public class DbTableSpaceMonitorJob
extends org.springframework.scheduling.quartz.QuartzJobBean
在项目启动后,定时扫描数据库“MONITOR_DB”表中所有数据库连接对应的数据库表空间信息,发送告警。
Modifier and Type | Field and Description |
---|---|
private IAlarmService |
alarmService
告警服务接口
|
private IDbService |
dbService
数据库表服务接口
|
Constructor and Description |
---|
DbTableSpaceMonitorJob() |
Modifier and Type | Method and Description |
---|---|
private void |
calculateTableSpace(MonitorDb monitorDb)
计算表空间,如果表空间不足,则发送告警
|
protected void |
executeInternal(org.quartz.JobExecutionContext jobExecutionContext)
扫描数据库“MONITOR_DB”表中所有数据库连接对应的数据库表空间信息,发送告警。
|
private void |
sendAlarmInfo(String title,
MonitorDb monitorDb,
DbTableSpace dbTableSpace,
AlarmLevelEnums alarmLevelEnum,
AlarmReasonEnums alarmReasonEnum)
发送告警信息
|
@Autowired private IAlarmService alarmService
@Autowired private IDbService dbService
protected void executeInternal(org.quartz.JobExecutionContext jobExecutionContext)
扫描数据库“MONITOR_DB”表中所有数据库连接对应的数据库表空间信息,发送告警。
executeInternal
in class org.springframework.scheduling.quartz.QuartzJobBean
jobExecutionContext
- 作业执行上下文private void calculateTableSpace(MonitorDb monitorDb) throws SQLException, NetException, org.hyperic.sigar.SigarException
计算表空间,如果表空间不足,则发送告警
monitorDb
- 数据库表SQLException
- SQL异常NetException
- 获取数据库信息异常org.hyperic.sigar.SigarException
- Sigar异常private void sendAlarmInfo(String title, MonitorDb monitorDb, DbTableSpace dbTableSpace, AlarmLevelEnums alarmLevelEnum, AlarmReasonEnums alarmReasonEnum) throws NetException, org.hyperic.sigar.SigarException
发送告警信息
title
- 告警标题monitorDb
- 数据库信息dbTableSpace
- 数据库表空间alarmLevelEnum
- 告警级别alarmReasonEnum
- 告警原因NetException
- 获取数据库信息异常org.hyperic.sigar.SigarException
- Sigar异常Copyright © 2021. All rights reserved.