Code Monkey home page Code Monkey logo

Comments (5)

akadaedalus avatar akadaedalus commented on July 18, 2024

this little patch works for me (internal_name doesn't exist). Version 2.6.4.15, I ignored a different section that never prints internal_name.

--- check_mssql_health  2019-09-25 11:17:46.608776257 -0700
+++ check_mssql_health.new      2020-10-15 10:19:58.710809895 -0700
@@ -2045,7 +2045,7 @@
   # FAN_459,FAN_203,TEMP_102229,ENVSUBSYSTEM
   if ($self->opts->blacklist =~ /_/) {
     foreach my $bl_item (split(/,/, $self->opts->blacklist)) {
-      if ($bl_item eq $self->internal_name()) {
+      if (exists $self->{name} && $bl_item eq $self->{name}) {
         $self->{blacklisted} = 1;
       }
     }
@@ -2055,12 +2055,12 @@
         my $bl_type = $1;
         my $bl_names = $2;
         foreach my $bl_name (split(/,/, $bl_names)) {
-          if ($bl_type."_".$bl_name eq $self->internal_name()) {
+          if ($bl_type."_".$bl_name eq $self->{name}) {
             $self->{blacklisted} = 1;
           }
         }
       } elsif ($bl_items =~ /^(\w+)$/) {
-        if ($bl_items eq $self->internal_name()) {
+        if ($bl_items eq $self->{name}) {
           $self->{blacklisted} = 1;
         }
       }

from check_mssql_health.

lausser avatar lausser commented on July 18, 2024

from check_mssql_health.

akadaedalus avatar akadaedalus commented on July 18, 2024

I need to sanitize it a little bit, so fake database names and I got tired of editing so the number of errors may not line up with the number of "online" databases.

I had to do if (exists $self->{name} && because for some reason it started the loop on an empty database name.

before:

-bash-4.2$ ./check_mssql_health.20201015 --server myserver --username nagiosro --password password --mode database-online --commit --multiline --blacklist 'BAD_DATABASE'
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
Use of uninitialized value in string eq at ./check_mssql_health.20201015 line 2048.
CRITICAL - BAD_DATABASE is offline, tempdb is online and accepting connections
db1 is online and accepting connections
db2 is online and accepting connections
db3 is online and accepting connections
db4 is online and accepting connections
db5 is online and accepting connections
db6 is online and accepting connections
db7 is online and accepting connections
db8 is online and accepting connections
db9 is online and accepting connections
db10 is online and accepting connections
db11 is online and accepting connections
db12 is online and accepting connections
db13 is online and accepting connections
db14 is online and accepting connections
db15 is online and accepting connections

After the patch:

-bash-4.2$ ./check_mssql_health --server myserver --username nagiosro --password password --mode database-online --commit --multiline --blacklist 'BAD_DATABASE'
OK - tempdb is online and accepting connections
db1 is online and accepting connections
db2 is online and accepting connections
db3 is online and accepting connections
db4 is online and accepting connections
db5 is online and accepting connections
db6 is online and accepting connections
db7 is online and accepting connections
db8 is online and accepting connections
db9 is online and accepting connections
db10 is online and accepting connections
db11 is online and accepting connections
db12 is online and accepting connections
db13 is online and accepting connections
db14 is online and accepting connections
db15 is online and accepting connections

from check_mssql_health.

lausser avatar lausser commented on July 18, 2024

from check_mssql_health.

akadaedalus avatar akadaedalus commented on July 18, 2024

good to know about the regex option. If you want to keep it like that, possibly improve your documentation, and remove the broken functionality ("internal_name" is still nonexistent in the script). note that --blacklist was the intuitive option for me and probably the same for this issue's reporter.

I just wanted a quick fix when a database was intentionally turned off and I didn't want to create individual checks for every single database that was still running. :)

from check_mssql_health.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.