Skip to main content

Hi

 

I’m having trouble connecting to my MSSQL instance. My server is version 2014, ie SQL Server 12.

 

I enter all the details correctly in Configuration/hosts/hosts

configuration

 

When Centreon tries to poll the server, it fails with this error:

 

 

I’ve tried setting up the freetds.conf in /etc with the following:

/etc/freetds.conf
​​​​​

I get the following error from the polls:

UNKNOWN: Cannot connect: OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER = (44)

Server , database

Message String: Server name not found in configuration files.

OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER = (34)

Server , database

Message String: Adaptive Server connection failed

 

The command is shown as:

/usr/lib/centreon/plugins//centreon_mssql.pl --plugin database::mssql::plugin --hostname='192.168.100.101' --port='1433' --username='username' --password='password' --mode='databases-size' --filter-database='^(?!(tempdb))' --filter-database-state='' --datafiles-maxsize='' --logfiles-maxsize='' --datafiles-maxsize-unlimited='' --logfiles-maxsize-unlimited='' --warning-logfiles-space-usage='' --critical-logfiles-space-usage='' --warning-logfiles-space-usage-free='' --critical-logfiles-space-usage-free='' --warning-logfiles-space-usage-prct='' --critical-logfiles-space-usage-prct='' --warning-datafiles-space-usage='' --critical-datafiles-space-usage='' --warning-datafiles-space-usage-free='' --critical-datafiles-space-usage-free='' --warning-datafiles-space-usage-prct='' --critical-datafiles-space-usage-prct='' --verbose

however, if I change the command to include the --server option and remove the --hostname, like this:

/usr/lib/centreon/plugins//centreon_mssql.pl --plugin database::mssql::plugin --username='username' --password='password' --server=Sql --mode='databases-size' --filter-database='^(?!(tempdb))' --filter-database-state='' --datafiles-maxsize='' --logfiles-maxsize='' --datafiles-maxsize-unlimited='' --logfiles-maxsize-unlimited='' --warning-logfiles-space-usage='' --critical-logfiles-space-usage='' --warning-logfiles-space-usage-free='' --critical-logfiles-space-usage-free='' --warning-logfiles-space-usage-prct='' --critical-logfiles-space-usage-prct='' --warning-datafiles-space-usage='' --critical-datafiles-space-usage='' --warning-datafiles-space-usage-free='' --critical-datafiles-space-usage-free='' --warning-datafiles-space-usage-prct='' --critical-datafiles-space-usage-prct='' --verbose

...it works! (* when I say it works, I get a reply that says “OK: 0.00 dead lock/s | ‘mssql.deadlocks.count’=0.00;;;0; - don’t know if this is what the poller is looking for!)

 

Is there a way to remove the hostname/port when the --server parameter is specified? The docs seem to suggest that if you specify the --server parameter, one does not need hostname/port. If not, is there a workaround please?

 

Thanks

Dan

Can anyone help please?


Hello,

With the actuals commands for MSSQL, i don't think you will be able to skip de the hostname parameters
And from what i see in the plugin code, the --hostname parameters will not be ignored, even if empty or if --server is present

What you can do is to create copies of the Centreon MSSQL commands (you will need to copy paste manually) and edit your copies to remove --hostname and --port option

Don’t forget to check this case if you want to see mssql commands

I don't know if it will works so first, clone only one command and remove the unwanted options
Then clone one of your DB services and link your newly created Command
Next, export and check if it works


If it's ok, you will need to create the other command and new templates for deploying easily on your other databases

Next, create a new Host Template for MSSQL (you can clone the actual one, prefixed by custom), rename it and remove all linked services Templates (in Relations Tab)

Then create a new MSSQL Services Templates (you can clone the actual one, prefixed by custom), link them to your newly created Host Template and make them use your newly created command


I hope it helps


@vcoum Thank you so much.

Your description enabled me to make the commands i needed and implement them - I’ve got a row of green OK icons now :-)

 

Thanks again

 

dan

 


Reply