Fix #1451 : add server option for mssql
This commit is contained in:
parent
7334f5cfb7
commit
8073d8de4b
|
@ -32,21 +32,21 @@ sub new {
|
|||
|
||||
$self->{version} = '0.1';
|
||||
%{$self->{modes}} = (
|
||||
'backup-age' => 'database::mssql::mode::backupage',
|
||||
'blocked-processes' => 'database::mssql::mode::blockedprocesses',
|
||||
'cache-hitratio' => 'database::mssql::mode::cachehitratio',
|
||||
'connected-users' => 'database::mssql::mode::connectedusers',
|
||||
'connection-time' => 'centreon::common::protocols::sql::mode::connectiontime',
|
||||
'dead-locks' => 'database::mssql::mode::deadlocks',
|
||||
'databases-size' => 'database::mssql::mode::databasessize',
|
||||
'failed-jobs' => 'database::mssql::mode::failedjobs',
|
||||
'list-databases' => 'database::mssql::mode::listdatabases',
|
||||
'locks-waits' => 'database::mssql::mode::lockswaits',
|
||||
'logs-size' => 'database::mssql::mode::logssize',
|
||||
'sql' => 'centreon::common::protocols::sql::mode::sql',
|
||||
'sql-string' => 'centreon::common::protocols::sql::mode::sqlstring',
|
||||
'transactions' => 'database::mssql::mode::transactions',
|
||||
);
|
||||
'backup-age' => 'database::mssql::mode::backupage',
|
||||
'blocked-processes' => 'database::mssql::mode::blockedprocesses',
|
||||
'cache-hitratio' => 'database::mssql::mode::cachehitratio',
|
||||
'connected-users' => 'database::mssql::mode::connectedusers',
|
||||
'connection-time' => 'centreon::common::protocols::sql::mode::connectiontime',
|
||||
'dead-locks' => 'database::mssql::mode::deadlocks',
|
||||
'databases-size' => 'database::mssql::mode::databasessize',
|
||||
'failed-jobs' => 'database::mssql::mode::failedjobs',
|
||||
'list-databases' => 'database::mssql::mode::listdatabases',
|
||||
'locks-waits' => 'database::mssql::mode::lockswaits',
|
||||
'logs-size' => 'database::mssql::mode::logssize',
|
||||
'sql' => 'centreon::common::protocols::sql::mode::sql',
|
||||
'sql-string' => 'centreon::common::protocols::sql::mode::sqlstring',
|
||||
'transactions' => 'database::mssql::mode::transactions',
|
||||
);
|
||||
|
||||
$self->{sql_modes}{dbi} = 'database::mssql::dbi';
|
||||
return $self;
|
||||
|
@ -56,18 +56,30 @@ sub init {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
$self->{options}->add_options(
|
||||
arguments => {
|
||||
'hostname:s@' => { name => 'hostname' },
|
||||
'port:s@' => { name => 'port' },
|
||||
'database:s' => { name => 'database' },
|
||||
}
|
||||
);
|
||||
arguments => {
|
||||
'hostname:s@' => { name => 'hostname' },
|
||||
'port:s@' => { name => 'port' },
|
||||
'server:s@' => { name => 'server' },
|
||||
'database:s' => { name => 'database' },
|
||||
}
|
||||
);
|
||||
$self->{options}->parse_options();
|
||||
my $options_result = $self->{options}->get_options();
|
||||
$self->{options}->clean();
|
||||
|
||||
if (defined($options_result->{server})) {
|
||||
@{$self->{sqldefault}->{dbi}} = ();
|
||||
for (my $i = 0; $i < scalar(@{$options_result->{server}}); $i++) {
|
||||
$self->{sqldefault}->{dbi}[$i] = { data_source => 'Sybase:server=' . $options_result->{server}[$i] };
|
||||
if ((defined($options_result->{database})) && ($options_result->{database} ne '')) {
|
||||
$self->{sqldefault}->{dbi}[$i]->{data_source} .= ';database=' . $options_result->{database};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (defined($options_result->{hostname})) {
|
||||
@{$self->{sqldefault}->{dbi}} = ();
|
||||
|
||||
for (my $i = 0; $i < scalar(@{$options_result->{hostname}}); $i++) {
|
||||
$self->{sqldefault}->{dbi}[$i] = { data_source => 'Sybase:host=' . $options_result->{hostname}[$i] };
|
||||
if (defined($options_result->{port}[$i])) {
|
||||
|
@ -78,6 +90,7 @@ sub init {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
$self->SUPER::init(%options);
|
||||
}
|
||||
|
||||
|
@ -99,6 +112,10 @@ Hostname to query.
|
|||
|
||||
Database Server Port.
|
||||
|
||||
=item B<--server>
|
||||
|
||||
An alternative to hostname+port. <server> will be looked up in the file freetds.conf.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
|
Loading…
Reference in New Issue