Ad Widget

Collapse

MS SQL query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RedHappy
    Junior Member
    • Mar 2017
    • 7

    #1

    MS SQL query

    Hi. I make connection to ms sql. Then have created a new odbc sql query that makes a select on the Sql. If there is no lock, the table is empty and everything is fine. If the table is not empty, something in the database made a lock and should be triggered by zabbix.
    I run query in console
    SQL> select *MYSELECT*
    +-----------------+
    | CriticalityLevel|
    +-----------------+
    +-----------------+
    SQLRowCount returns 0


    But in trigger i see: SQL query returned empty result. Zabbix ver. 3.2
    Please, help me
  • batchenr
    Senior Member
    • Sep 2016
    • 440

    #2
    Originally posted by RedHappy
    Hi. I make connection to ms sql. Then have created a new odbc sql query that makes a select on the Sql. If there is no lock, the table is empty and everything is fine. If the table is not empty, something in the database made a lock and should be triggered by zabbix.
    I run query in console
    SQL> select *MYSELECT*
    +-----------------+
    | CriticalityLevel|
    +-----------------+
    +-----------------+
    SQLRowCount returns 0


    But in trigger i see: SQL query returned empty result. Zabbix ver. 3.2
    Please, help me
    please post your trigger here.
    and i think you can use zabbix_get for this - like run a remote command

    system.run[the command that you run]
    and in the trigger u should set if no data then...

    Comment

    • RedHappy
      Junior Member
      • Mar 2017
      • 7

      #3
      Here.

      Thank you

      Comment

      • batchenr
        Senior Member
        • Sep 2016
        • 440

        #4
        Originally posted by RedHappy
        Here.

        Thank you
        can u try to change type of information to char
        and make a trigger with the exprestion nodata()<5m or close

        Comment

        • RedHappy
          Junior Member
          • Mar 2017
          • 7

          #5
          After i changed type


          Comment

          • Atsushi
            Senior Member
            • Aug 2013
            • 2028

            #6
            How about getting SQL results with count (*)?
            If there is no corresponding record, I think that you can get a value of 0.

            Comment

            • RedHappy
              Junior Member
              • Mar 2017
              • 7

              #7
              from MS SQL management studio
              select CriticalityLevel from dbo.[*********] where ClassNum = 52154
              No data
              select * from dbo.[*******]

              ClassNum CriticalityLevel
              52184 0
              Because all fine.

              Comment

              Working...