MSSQL using NSClient++

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: MSSQL using NSClient++

Post by ofadl »

i do not want to have a check for "check_mssql_health" i want to set it up for "check_mssql_sproc" for stored procedures
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: MSSQL using NSClient++

Post by sreinhardt »

Well based on the sites documentation, you would need a command similar to:

$USER1$/check_mssql_sproc.pl -H $HOSTADDRESS$ -p $ARG1$ -u $ARG2$ -P $ARG3$ -w $ARG4$ -c $ARG5$

$USER1$ and $HOSTADDRESS$ are provided by default with any check.
$ARG1$ is your stored procedure
$ARG2$ Username
$ARG3$ Password
$ARG4$ warning threshold
$ARG5$ critical threshold

You can also check those values on the command line by replacing their appropriate values and executing it.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: MSSQL using NSClient++

Post by ofadl »

ok so i modified it to look like what you posted to this:

define service{
use generic-service
host_name vnadat121
service_description Check for Content Received from High Volume Sources
check_command $USER1$/check_mssql_sproc.pl -H $HOSTADDRESS$ -p "sp_CheckCoreLastDeliveredBusHours" -u sa -P "dusT#Controle" -w $ARG4$ -c $ARG5$
}

but now im getting an error "Error: Service check command '$USER1$/check_mssql_sproc.pl -H $HOSTADDRESS$ -p "sp_CheckCoreLastDeliveredBusHours" -u sa -P "dusT#Controle" -w $ARG4$ -c $ARG5$' specified in service 'Check for Content Received from High Volume Sources' for host 'vnadat121' not defined anywhere!
Checked 304 services."
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: MSSQL using NSClient++

Post by slansing »

Thats not a check_command....You placed the entire command in the field where you place the shorthand version. You need to place your command, in your commands.cfg file, and then create/edit the service definition like you had before.
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: MSSQL using NSClient++

Post by ofadl »

ok so i made command look like this:

define command{
command_name Check for processes
command_line $USER1$/check_mssql_sproc.pl -H $HOSTADDRESS$ -p "sp_CheckCoreLastDeliveredBusHours" -u sa -P "password" -w $ARG4$ -c $ARG5$

}

and service definition to:

define service{
use generic-service ; Name of service template to use
host_name vnadat121
service_description Check MSSQL
check_command check_mssql
check_period 24x7
}


is that correct? sorry for the hassle, im trying to get used to this stuff
Last edited by ofadl on Thu Jul 11, 2013 9:41 am, edited 1 time in total.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: MSSQL using NSClient++

Post by slansing »

You are going to need to supply the arguments for your command otherwise they will just sit there, and the command will likely not work, you will also need to make the command name valid, and use it in the service. To do this, edit the commands.cfg definition and service's configuration file to look more like this:

Code: Select all

define command{
command_name check_mssql
command_line $USER1$/check_mssql_sproc.pl -H $HOSTADDRESS$ -p "sp_CheckCoreLastDeliveredBusHours" -u sa -P "dusT#Controle" -w $ARG1$ -c $ARG2$

}

Code: Select all

define service{
use generic-service ; Name of service template to use
host_name vnadat121
service_description Check_L
check_command check_mssql!20!30!!
check_period 24x7
}
The "!" denotes a new argument being used, since you have two, I added two, one for the first arg, and one for the second and set their values to a nondescript warning and critical value, feel free to change it.
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: MSSQL using NSClient++

Post by ofadl »

ok i put those two files into my nagios machine, but im getting an error called "service check did not exit properly"
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: MSSQL using NSClient++

Post by slansing »

You mean you saved them right? Or are you creating new service and command definitions each time we change something?? What does the command output if you run it from the command line instead of waiting for checks in the Web UI?
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: MSSQL using NSClient++

Post by ofadl »

i copy and pasted what u supplied with before, into into the commands.cfg file and other into my windows.cfg file and restarted nagios.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: MSSQL using NSClient++

Post by slansing »

What does the command output if you run it from the command line instead of waiting for checks in the Web UI?
Locked