Skip to content

Commit

Permalink
agents: add options to use cached host data
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed May 2, 2024
1 parent 1b2c719 commit bc82968
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Available commands are:
--ip set ip address (available in add mode)
--section set section (available in add mode)
-k | --insecure skip tls verification (available in add mode)
--cached use cached host inventory
=back
Expand Down Expand Up @@ -92,6 +93,7 @@ sub cmd {
'clear_manual' => undef,
'section' => undef,
'insecure' => undef,
'cached' => undef,
};
$opt->{'fresh'} = 1 if Thruk::Base::array_contains('-II', $commandoptions);
$opt->{'clear_manual'} = 1 if Thruk::Base::array_contains('-III', $commandoptions);
Expand All @@ -116,6 +118,7 @@ sub cmd {
"ip=s" => \$opt->{'address'},
"section=s" => \$opt->{'section'},
"k|insecure" => \$opt->{'insecure'},
"cached" => \$opt->{'cached'},
) or do {
return(Thruk::Utils::CLI::get_submodule_help(__PACKAGE__));
};
Expand Down Expand Up @@ -672,6 +675,8 @@ sub _get_checks {
$port = $1;
}

$update = 0 if $opt->{'cached'};

my $hosts = $c->db->get_hosts(filter => [ Thruk::Utils::Auth::get_auth_filter( $c, 'hosts' ),
'custom_variables' => { '~' => 'AGENT .+' },
'name' => $hostname,
Expand Down

0 comments on commit bc82968

Please sign in to comment.