• 1.     Install ODBC MS SQL Connector On Zabbix Server   

https://support.zabbix.com/browse/ZBX-6839   comment1 --> mysql   comment2 --> PostgreSQL  comment3 -->  MSSQL

Install necessary packages FreeTDS:

  1. yum -y install freetds unixODBC unixODBC-devel
  2. Check if the installation is successful or not:

     

 tsql -S 10.1.9.59 –P 1433 -U loginname –P password

1> select top 1 id from jobsdb_hk.dbo.jobad;

2> go

 

  1. Update ODBC driver configuration file:

$ vi /etc/odbcinst.ini

 

  1. Update ODBC configuration file:
$ vi /etc/odbc.ini

 

2.     Create Host


 

 

 

 

 

 

 

 

 

 

 

 

 

 

  1. 3.     Create Item

 

 

User name: [Adloader Database Login ID]

Password: [Adloader Database Login Password]

SQL Query:

Select (Select L.CreatedTime, ErrorLogXml 
    From [Dev_DM_DB01]..SCM_Gateway_Log L With(NoLock) 
    Where Convert(Nvarchar(max), ErrorLogXml) <> '' 
    And DATEDIFF(D, CreatedTime, GETUTCDATE()) = 0 
    For XML RAW,TYPE) As ErrorLogFromAdloader, 
    (Select B.BatchID, B.CreateDate, BRJ.PostToJobsDB_ErrorInfo, BRJ.JobTitle
        From [Dev_DM_DB01]..SCM_ImportJob_Batch B With(NoLock) 
        Inner Join [Dev_DM_DB01]..SCM_ImportJob_BatchRecord_JobsDB BRJ With(NoLock) 
    On B.AccountID=BRJ.AccountID And B.EntityID=BRJ.EntityID And     B.BatchID=BRJ.BatchID 
        Where BRJ.PostToJobsDB_ErrorInfo Is Not Null 
        And DATEDIFF(MI, B.LastProcessTime, GETUTCDATE()) < 60
        For XML RAW, Type) As ErrorLogFromJobsDB
For XML RAW

 

  1. 4.     Create Trigger

  

 

  1. 5.     Create Action

     

Set action Condition: Matching by trigger name

 


Set action Operations: Send email to indicated user

posted on 2016-09-02 15:47  dfg727  阅读(427)  评论(0编辑  收藏  举报