Ad Widget

Collapse

MSSQL job status in table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PiotrJ
    Junior Member
    • May 2023
    • 26

    #1

    MSSQL job status in table

    Hi
    I using zabbix compose version 6.4.6
    I have jobs with backup of database on SMSS and i want make on dashboard something like table with name of database and status ("backup done" or "problem") and i don't know how to do it. Someone do something like this please help.

    EDIT.1
    I wrote this but in zabbix in output get "SQL query returned empty result." but in SMSS I get 1 or 0​


    DECLARE @job_result INT

    -- Pobierz wynik ostatniego uruchomienia jobu
    SELECT TOP 1 @job_result = run_status
    FROM msdb.dbo.sysjobs j
    INNER JOIN msdb.dbo.sysjobhistory h ON j.job_id = h.job_id
    WHERE j.name = 'backup_test.Subplan_1'
    ORDER BY h.run_date DESC, h.run_duration DESC;

    -- Wypisz wynik (1 oznacza sukces, 0 oznacza niepowodzenie)
    IF @job_result = 1
    PRINT '1'
    ELSE
    PRINT '0';
    Last edited by PiotrJ; 22-09-2023, 21:06.
  • PeterZielony
    Senior Member
    • Nov 2022
    • 146

    #2
    if you are doing regular backups, including full and incr use the default template. no need for custom scripts
    Microsoft SQL monitoring and integration with Zabbix
    ​then if you know you are doing in intervals (backups) you can just use one of the macro to check if it hasn't been done more than xyz time.

    I'm checking full every few days and diff every day across nearly 300 DBs. if something is older than {#SOMEMACRO} per db backup type : then trigger an alert
    Last edited by PeterZielony; 23-09-2023, 01:39.

    Hiring in the UK? Drop a message

    Comment

    • PiotrJ
      Junior Member
      • May 2023
      • 26

      #3
      Originally posted by PeterZielony
      if you are doing regular backups, including full and incr use the default template. no need for custom scripts
      Microsoft SQL monitoring and integration with Zabbix
      ​then if you know you are doing in intervals (backups) you can just use one of the macro to check if it hasn't been done more than xyz time.

      I'm checking full every few days and diff every day across nearly 300 DBs. if something is older than {#SOMEMACRO} per db backup type : then trigger an alert
      Okey thats works fine for me next what i have to is table look like:
      trigger | red if problem and green if ok
      I trying do this by trigger overview but there i can show only problems. Have somebody other solutions?

      Comment

      • PeterZielony
        Senior Member
        • Nov 2022
        • 146

        #4
        Originally posted by PiotrJ

        Okey thats works fine for me next what i have to is table look like:
        trigger | red if problem and green if ok
        I trying do this by trigger overview but there i can show only problems. Have somebody other solutions?
        You need to setup dashboard widget. I find zabbix dashbpard quite limited and i use grafana dashboards (we have tv setup for this in office)

        You will have to see docs about dashboards


        i dont have dashboards for sql backups - just notifications (email and teams)

        getting started with grafana (didn't read it tho)

        https://vpsie.com/knowledge-base/how...and%20password.

        I have grafana on same box where zabbix web service is (using also docker)

        Hiring in the UK? Drop a message

        Comment

        Working...