enh influxdb and elasticsearch

This commit is contained in:
Colin Gagnaire 2019-06-18 13:23:11 +02:00
parent 525a925ada
commit 00e279aa4a
3 changed files with 19 additions and 26 deletions

View File

@ -107,13 +107,16 @@ sub build_options_for_httplib {
my ($self, %options) = @_;
$self->{option_results}->{hostname} = $self->{hostname};
$self->{option_results}->{timeout} = $self->{timeout};
$self->{option_results}->{port} = $self->{port};
$self->{option_results}->{proto} = $self->{proto};
$self->{option_results}->{credentials} = 1;
$self->{option_results}->{basic} = 1;
$self->{option_results}->{username} = $self->{username};
$self->{option_results}->{password} = $self->{password};
$self->{option_results}->{timeout} = $self->{timeout};
if (defined($self->{username}) && $self->{username} ne '') {
$self->{option_results}->{credentials} = 1;
$self->{option_results}->{basic} = 1;
$self->{option_results}->{username} = $self->{username};
$self->{option_results}->{password} = $self->{password};
}
}
sub settings {

View File

@ -47,8 +47,6 @@ sub new {
"hostname:s" => { name => 'hostname' },
"port:s" => { name => 'port' },
"proto:s" => { name => 'proto' },
"credentials" => { name => 'credentials' },
"basic" => { name => 'basic' },
"username:s" => { name => 'username' },
"password:s" => { name => 'password' },
"timeout:s" => { name => 'timeout' },
@ -94,8 +92,6 @@ sub check_options {
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 10;
$self->{username} = (defined($self->{option_results}->{username})) ? $self->{option_results}->{username} : undef;
$self->{password} = (defined($self->{option_results}->{password})) ? $self->{option_results}->{password} : undef;
$self->{credentials} = (defined($self->{option_results}->{credentials})) ? 1 : undef;
$self->{basic} = (defined($self->{option_results}->{basic})) ? 1 : undef;
if (!defined($self->{hostname}) || $self->{hostname} eq '') {
$self->{output}->add_option_msg(short_msg => "Need to specify --hostname option.");
@ -120,13 +116,19 @@ sub build_options_for_httplib {
my ($self, %options) = @_;
$self->{option_results}->{hostname} = $self->{hostname};
$self->{option_results}->{timeout} = $self->{timeout};
$self->{option_results}->{port} = $self->{port};
$self->{option_results}->{proto} = $self->{proto};
$self->{option_results}->{timeout} = $self->{timeout};
$self->{option_results}->{warning_status} = '';
$self->{option_results}->{critical_status} = '';
$self->{option_results}->{unknown_status} = '%{http_code} < 200 or %{http_code} >= 300';
if (defined($self->{username}) && $self->{username} ne '') {
$self->{option_results}->{credentials} = 1;
$self->{option_results}->{basic} = 1;
$self->{option_results}->{username} = $self->{username};
$self->{option_results}->{password} = $self->{password};
}
}
sub settings {
@ -242,25 +244,13 @@ Port used (Default: 8086)
Specify https if needed (Default: 'http')
=item B<--credentials>
Specify this option if you access webpage with authentication
=item B<--username>
Specify username for authentication (Mandatory if --credentials is specified)
Specify username for authentication.
=item B<--password>
Specify password for authentication (Mandatory if --credentials is specified)
=item B<--basic>
Specify this option if you access webpage over basic authentication and don't want a '401 UNAUTHORIZED' error to be logged on your webserver.
Specify this option if you access webpage over hidden basic authentication or you'll get a '404 NOT FOUND' error.
(Use with --credentials)
Specify password for authentication.
=item B<--timeout>

View File

@ -84,11 +84,11 @@ Check database connection time.
=over 8
=item B<--warning-connection-time-milliseconds>
=item B<--warning-connection-time>
Threshold warning in milliseconds.
=item B<--critical-connection-time-milliseconds>>
=item B<--critical-connection-time>
Threshold critical in milliseconds.