Giter Site home page Giter Site logo

asgeirbjarnason / check_mssql_health Goto Github PK

View Code? Open in Web Editor NEW

This project forked from opinkerfi/check_mssql_health

0.0 2.0 0.0 373 KB

A Plugin for the Shinken (Nagios) monitoring software which checks various parameters of Microsoft SQL database servers

Home Page: http://labs.consol.de/nagios/check_mssql_health

License: GNU General Public License v2.0

PHP 11.56% Perl 80.01% Shell 8.42%

check_mssql_health's Introduction

check_mssql_health Nagios Plugin README
---------------------

This plugin is used to monitor a variety of MS SQL Server database metrics. 

* For instructions on installing this plugin for use with Nagios,
  see below. In addition, generic instructions for the GNU toolchain
  can be found in the INSTALL file.

* For major changes between releases, read the CHANGES file.

* For information on detailed changes that have been made,
  read the Changelog file.

* This plugin is self documenting.  All plugins that comply with
  the basic guidelines for development will provide detailed help when
  invoked with the '-h' or '--help' options.

You can check for the latest plugin at:
  http://www.consol.com/opensource/nagios/check-mssql-health

The documentation in this README covers only the most common features.
To view the full documentation and examples, go to 
  http://www.consol.com/opensource/nagios/check-mssql-health or
  http://www.consol.de/opensource/nagios/check-mssql-health

Send mail to [email protected] for assistance.
Please include the OS type/version and the Perl DBI/DBD version
that you are using.
Also, run the plugin with the '-vvv' option and provide the resulting 
version information.  Of course, there may be additional diagnostic information
required as well.  Use good judgment.

For patch submissions and bug reports, please send me a mail. You can also find
me at http://www.nagios-portal.de

Requirements
--------------------------------------------------------
You need to install the Perl module DBD::Sybase first.
It is very important to set the protocol version in /etc/freetds.conf to 8.0
Otherwise your database password will be visible on the network.

[global]
        # TDS protocol version
        tds version = 8.0



How to "compile" the check_mssql_health script.
--------------------------------------------------------

1) Run the configure script to initialize variables and create a Makefile, etc.

	./configure --prefix=BASEDIRECTORY --with-nagios-user=SOMEUSER --with-nagios-group=SOMEGROUP --with-perl=PATH_TO_PERL --with-statefiles-dir=STATE_PATH

   a) Replace BASEDIRECTORY with the path of the directory under which Nagios
      is installed (default is '/usr/local/nagios')
   b) Replace SOMEUSER with the name of a user on your system that will be
      assigned permissions to the installed plugins (default is 'nagios')
   c) Replace SOMEGRP with the name of a group on your system that will be
      assigned permissions to the installed plugins (default is 'nagios')
   d) Replace PATH_TO_PERL with the path where a perl binary can be found.
      Besides the system wide perl you might have installed a private perl
      just for the nagios plugins (default is the perl in your path).
   e) Replace STATE_PATH with the directory where you want the script to
      write state files which transport information from one run to the next.
      (default is /tmp)

   Simply running ./configure will be sufficient to create a check_mssql_health
   script which you can customize later.
      

2) "Compile" the plugin with the following command:

	make

    This will produce a "check_mssql_health" script. You will also find
    a "check_mssql_health.pl" which you better ignore. It is the base for
    the compilation filled with placeholders. These will be replaced during
    the make process.


3) Install the compiled plugin script with the following command:

	make install

   The installation procedure will attempt to place the plugin in a 
   'libexec/' subdirectory in the base directory you specified with
   the --prefix argument to the configure script.


4) Verify that your configuration files for Nagios contains
   the correct paths to the new plugin.


Command line parameters
-----------------------

--hostname=<the database server>
   This is the hostname or the ip-address.

--port=<the instance port>
   This is the port where an instance listens. Default: 1433

--server=<the database server>
   This can be used instead of a hostname/port combination.
   The servername given here is used for a lookup in /etc/freetds.conf

--user=<username>
   This is the user which reads the system tables.

--password=<secret>
   This is the user's password.

--mode=<operation mode>
   This parameter tells the plugin what it should check.
   The list of known modes may grow frequently. Please look at 
   http://www.consol.com/opensource/nagios/check-mssql-health for a list
   of features.

--database=<database name>
  Database-related modes check all databases in one run by default.
  If only a single database should be checked, use this parameter.

--warning=<warning threshold>
  If the metric is out of this range, the plugin returns a warning.

--critical=<critical threshold>
  If the metric is out of this range, the plugin returns a critical.

   
Connecting 
----------


You can call the plugin with "--hostname <ip or dns-name> [--port <port number>]"
This bypasses the freetds.conf file and directly connects you to 
whatever is listening on port 1433 or <port number>
This will surely be the default instance. If you have different (named) instances
listening on the same port, you need to edit /etc/freetds.conf

[dbsrv1instance01] 
        host = 192.168.1.1 
        port = 1433 
        instance = instance01 
        
[dbsrv1instance02] 
        host = 192.168.1.1 
        port = 1433 
        instance = instance02 

....

Then you call the plugin with "--server dbsrv1instance02" for example.

Testing the connection
----------------------

use DBI;
use strict;

my $username = "xxxxx";
my $password = "xxxxx";
my $dsn = "DBI:Sybase:;host=127.0.1.1;port=1433";
#my $dsn = "DBI:Sybase:;server=dbsrv_in_freetds_conf";
if (my $dbh = DBI->connect(
    $dsn, $username, $password,
    { RaiseError => 1, AutoCommit => 0, PrintError => 1 })) {
  printf "connection succeeded\n";
} else {
  printf "connection failed\n";
}

In Sybase, login as sa and switch on auditing:
sp_configure "log audit logon success", 1
sp_configure "log audit logon failure", 1
go
shutdown
go

Then startup again
startserver -f /opt/sybase/ASE-15_0/install/RUN_backup_server  -f /opt/sybase/ASE-15_0/install/RUN_ase_server -f /opt/sybase/ASE-15_0/install/RUN_monitor_server



--------------------------------------
That's it.  If you have any problems or questions, feel free to send mail
to [email protected]

check_mssql_health's People

Contributors

lausser avatar

Watchers

James Cloos avatar Ásgeir Bjarnason avatar

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.