Ad Widget

Collapse

Zabbix MSSQL by ODBC - query to monitor failed logins

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • anslu
    Member
    • Aug 2023
    • 30

    #1

    Zabbix MSSQL by ODBC - query to monitor failed logins


    Hello,
    we are using Zabbix to monitor MS SQL instances. I wanted to make an additional trigger to get notified about failed SQL user logins. However, we are monitoring multiple SQL instances at single servers, therefore alerts based on MS Event Viewer won't point to right instance (Zabbix host/client).


    I was thinking about adding such query to MSSQL by ODBC template to query DB e.g. each 5 minutes for failed logins, however I'm not entirely sure how to add it to Zabbix template? Or maybe there's better way e.g. to get notification on event?



    DECLARE @StartDate DATETIME, @EndDate DATETIME;
    SET @EndDate = GETDATE();
    SET @StartDate = DATEADD(MINUTE, -5, @EndDate);

    EXEC xp_readerrorlog 0, 1, N'Login failed for user', NULL, @StartDate, @EndDate, N'asc';
    (can't upload image with sample output)
  • Answer selected by anslu at 04-10-2024, 14:44.
    lptarik
    Member
    • Oct 2021
    • 33

    You can't use declare in zabbix

    Comment

    • lptarik
      Member
      • Oct 2021
      • 33

      #2
      You can't use declare in zabbix

      Comment

      Working...