Zabbix监控键值SQL语句(WinServer)

SQL Server语法:

库名

LMInterface(中间库)
  • 1/6个小时没有进数据
SELECT COUNT(*) AS cont FROM Image where datediff(hh,CheckDateTime,GETDATE())<=1
SELECT COUNT(*) AS cont FROM Image where datediff(hh,CheckDateTime,GETDATE())<=6
  • QR回写失败
SELECT count(*) AS cont FROM StudyInfo where ArchiveFlag=-1
  • QR连接异常
Select count(*) AS cont FROM dbo.StudyInfo where ArchiveFlag=0
LM_StudyMonitor(监控库)
  • 前天图像是否漏传
SELECT count(*) AS cont FROM StudyCount WHERE LogDatetime>=getdate()-1 AND RISNumber > FTDocNumber(只查找有没有漏传的)
SELECT isnull(RISNumber,0)-isnull(FTDocNumber,0) AS cont FROM StudyCount WHERE LogDatetime>=getdate()-1(可以计算漏传多少)
SELECT (case when  isnull(PACSNumber,0)-isnull(RISNumber,0) <0 then 0 else  isnull(PACSNumber,0)-isnull(RISNumber,0) end)AS cont FROM StudyCount WHERE LogDatetime>=getdate()-1(相减得负的值值为零)
DocRouter(正式库)
  • 数据未上传
Select count(*) FROM Docimage where [30011041]=3 and datediff(dd,[00080020],getdate())<1
  • 1/6个小时没有进数据
SELECT COUNT(*) AS cont FROM StudyInfo where datediff(hh,CreateTime,GETDATE())<=6
SELECT COUNT(*) AS cont FROM StudyInfo where datediff(hh,CreateTime,GETDATE())<=1

Oracle语法:

  • 查询15分钟内的数据
select COUNT(*) AS cont from V_DocReport  
where ReportDatetime >= SYSDATE-numtodsinterval(15,'minute')

Mysql语法:

  • 查询15分钟内的数据
SELECT COUNT(*) AS cont from V_DocReport where now() < SUBDATE(ReportDatetime,interval -15 minute)

你可能感兴趣的:(Zabbix监控键值SQL语句(WinServer))