lausser / check_mssql_health

Wenn du dich für Plugins (oder OMD oder allgemein Monitoring) interessierst oder von deiner Installation erzählen willst...die Tradition der deutschsprachigen Monitoring-Workshops wird wiederbelebt: https://discord.gg/jDfPZ63FcJ A plugin, which checks various parameters of Microsoft SQL database servers.
http://labs.consol.de/nagios/check_mssql_health
GNU General Public License v2.0
38 stars 27 forks source link

Transaction Error when running check_mssql_health #7

Open rajav2 opened 9 years ago

rajav2 commented 9 years ago

I am getting the following transaction error for all modes. It is the same with other DB servers. Please advice

[nagios@nagiosprodxi1 libexec]$ ./check_mssql_health -V check_mssql_health (1.5.20.5) This nagios plugin comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of this plugin under the terms of the GNU General Public License.

[nagios@nagiosprodxi1 libexec]$ ./check_mssql_health --server CRDE_SG_UAT --username appsmonitor --password abc1* --mode connection-time --warning 5 --critical 10 OK - 0.17 seconds to connect as appsmonitor | connection_time=0.17;5;10 DBD::Sybase::db DESTROY failed: Server message number=3903 severity=16 state=1 line=2 server=BHQKPK200020 text=The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. Server message number=3903 severity=16 state=1 line=2 server=BHQKPK200020 text=The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. during global destruction. (in cleanup) DBD::Sybase::db DESTROY failed: Server message number=3903 severity=16 state=1 line=2 server=BHQKPK200020 text=The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. Server message number=3903 severity=16 state=1 line=2 server=BHQKPK200020 text=The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. during global destruction.

rajav2 commented 9 years ago

BTW it had the same problem with Version 1.5.19.3

nE0sIghT commented 9 years ago

Same with 1.5.20.6

kylexlau commented 5 years ago

I have the same problem with the latest version.

I searched a solution from here, it works for me.

The behavior of either dbd::sybase or freetds changed (this error message appeared suddenly at the beginning of this year and only with certain linux distributions)

You have to add "--commit"。

Gerhard

kylexlau commented 5 years ago

There's another solution. When you install DBD-Sybase module, choose 'N' when asked to use 'CHAINED' mode by default.

By default DBD::Sybase 1.05 and later use the 'CHAINED' mode (where available) when 'AutoCommit' is turned off. Versions 1.04 and older instead managed the transactions explicitly with a 'BEGIN TRAN' before the first DML statement. Using the 'CHAINED' mode is preferable as it is the way that Sybase implements AutoCommit handling for both its ODBC and JDBC drivers.

Use 'CHAINED' mode by default (Y/N) [Y]: N

Rerhinson commented 3 years ago

I have the same problem with the latest version.

I searched a solution from here, it works for me.

The behavior of either dbd::sybase or freetds changed (this error message appeared suddenly at the beginning of this year and only with certain linux distributions) You have to add "--commit"。 Gerhard

I'm not authorised to read this forum. I created an account and I still can't. Can u help me?

lausser commented 3 years ago

I have no access to this forum, it is for customers of Nagios Inc.

Adding --commit by default is the way to go.

Gerhard

Von: Rerhinson [mailto:notifications@github.com] Gesendet: Dienstag, 10. November 2020 19:15 An: lausser/check_mssql_health check_mssql_health@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Betreff: Re: [lausser/check_mssql_health] Transaction Error when running check_mssql_health (#7)

I have the same problem with the latest version.

I searched a solution from here https://support.nagios.com/forum/viewtopic.php?f=6&t=28718 , it works for me.

The behavior of either dbd::sybase or freetds changed (this error message appeared suddenly at the beginning of this year and only with certain linux distributions) You have to add "--commit"。 Gerhard

I'm not authorised to read this forum. I created an account and I still can't. Can u help me?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lausser/check_mssql_health/issues/7#issuecomment-724876739 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AABQSODR2IS2H22DMSIQVQLSPF7JNANCNFSM4ARYAVSA .

Rerhinson commented 3 years ago

I have no access to this forum, it is for customers of Nagios Inc. Adding --commit by default is the way to go. Gerhard Von: Rerhinson [mailto:notifications@github.com] Gesendet: Dienstag, 10. November 2020 19:15 An: lausser/check_mssql_health check_mssql_health@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Betreff: Re: [lausser/check_mssql_health] Transaction Error when running check_mssql_health (#7) I have the same problem with the latest version. I searched a solution from here https://support.nagios.com/forum/viewtopic.php?f=6&t=28718 , it works for me. The behavior of either dbd::sybase or freetds changed (this error message appeared suddenly at the beginning of this year and only with certain linux distributions) You have to add "--commit"。 Gerhard I'm not authorised to read this forum. I created an account and I still can't. Can u help me? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#7 (comment)> , or unsubscribe https://github.com/notifications/unsubscribe-auth/AABQSODR2IS2H22DMSIQVQLSPF7JNANCNFSM4ARYAVSA .

The check passes, but does not collect the correct information it should. It returns OK status, but it is a false positive.

lausser commented 3 years ago

"The check passes," Which check?

Rerhinson commented 3 years ago

It is a backup check, it should return to the status information with the time of the last backup but it only comes with "ok".

Like this => image

lausser commented 3 years ago

How do you think i can help you with nothing more than a screenshot and "Shows OK, but is false positive" at hand?

Rerhinson commented 3 years ago

Sorry, I just wanted to show you how it was being shown.

image

DBD::Sybase::db DESTROY failed: Server message number=3903 severity=16 state=1 line=2 server=CLIG525 text=The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. Server message number=3903 severity=16 state=1 line=2 server=CLIG525 text=The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. during global destruction. (in cleanup) DBD::Sybase::db DESTROY failed: Server message number=3903 severity=16 state=1 line=2 server=CLIG525 text=The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. Server message number=3903 severity=16 state=1 line=2 server=CLIG525 text=The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. during global destruction.

lausser commented 3 years ago

You see the sql communication when you add "-vvv" to the command line.

Rerhinson commented 3 years ago

[nagios@nagios ~]$ /usr/local/nagios/libexec/check_mssql_health --server 10.0.0. --username nagios_secrel --password "S1" --mode database-backup-age --warning 24 --critical 48 --name msdb --commit -vvv Wed Nov 11 10:34:43 2020: SQL: SELECT @@VERSION ARGS: $VAR1 = [];

Wed Nov 11 10:34:43 2020: RESULT: $VAR1 = [ 'Microsoft SQL Server 2014 - 12.0.4100.1 (X64) Apr 20 2015 17:29:27 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.3 (Build 9600: ) (Hypervisor) ' ];

Wed Nov 11 10:34:43 2020: AUTOLOAD Classes::MSSQL::DBI::override_opt

Wed Nov 11 10:34:43 2020: AUTOLOAD Classes::MSSQL::DBI::check_messages

Wed Nov 11 10:34:43 2020: SQL: SELECT SYSTEM_USER ARGS: $VAR1 = [];

Wed Nov 11 10:34:43 2020: RESULT: $VAR1 = [ 'nagios_secrel' ];

Wed Nov 11 10:34:43 2020: SQL: SELECT @@SERVICENAME ARGS: $VAR1 = [];

Wed Nov 11 10:34:43 2020: RESULT: $VAR1 = [ 'MSSQLSERVER' ];

Wed Nov 11 10:34:43 2020: SQL: SELECT CAST(COALESCE(SERVERPROPERTY('IsHadrEnabled'), 0) as int) ARGS: $VAR1 = [];

Wed Nov 11 10:34:43 2020: RESULT: $VAR1 = [ 0 ];

Wed Nov 11 10:34:43 2020: AUTOLOAD Classes::MSSQL::DBI::analyze_and_check_database_subsystem

Wed Nov 11 10:34:43 2020: SQL:

      SELECT
          d.name AS database_name, d.recovery_model, bs1.last_backup, bs1.last_duration, d.state, d.state_desc
      FROM
          sys.databases d
      LEFT JOIN (
        SELECT
            bs.database_name,
            DATEDIFF(HH, MAX(bs.backup_finish_date), GETDATE()) AS last_backup,
            DATEDIFF(MI, MAX(bs.backup_start_date), MAX(bs.backup_finish_date)) AS last_duration
        FROM
            msdb.dbo.backupset bs WITH (NOLOCK)
        WHERE
            bs.type IN ('D', 'I')
        GROUP BY
            bs.database_name
      ) bs1 ON
          d.name = bs1.database_name WHERE d.source_database_id IS NULL
      ORDER BY
          d.name

ARGS: $VAR1 = [];

Wed Nov 11 10:34:43 2020: RESULT: $VAR1 = [ [ 'master', 3, 400, 0, 0, 'ONLINE' ], [ 'tempdb', 3, undef, undef, 0, 'ONLINE' ] ];

Wed Nov 11 10:34:43 2020: AUTOLOAD Classes::MSSQL::Component::DatabaseSubsystem::DatabaseStub::override_opt

Wed Nov 11 10:34:43 2020: $self->{components}->{database_subsystem} = Classes::MSSQL::Component::DatabaseSubsystem->new() Wed Nov 11 10:34:43 2020: AUTOLOAD Classes::MSSQL::DBI::check_database_subsystem

[DATABASESUBSYSTEM] info: checking databases

Wed Nov 11 10:34:43 2020: AUTOLOAD Classes::MSSQL::DBI::reduce_messages_short

Wed Nov 11 10:34:43 2020: AUTOLOAD Classes::MSSQL::DBI::check_messages

Wed Nov 11 10:34:43 2020: AUTOLOAD Classes::MSSQL::DBI::check_messages

Wed Nov 11 10:34:43 2020: AUTOLOAD Classes::MSSQL::DBI::nagios_exit

OK - checking databases

lausser commented 3 years ago

msdb is not among the sql response, probably not listed in msdb.dbo.backupset. So there is no backup configured for msdb?

Rerhinson commented 3 years ago

There is a maintenance plan and I checked the bakcup. I check a table msdb.dbo.backupset. So my doubt, I thought it would be some parameter.