Skip to content

Commit bc82968

Browse files
committed
agents: add options to use cached host data
1 parent 1b2c719 commit bc82968

File tree

1 file changed

+5
-0
lines changed
  • plugins/plugins-available/agents/lib/Thruk/Utils/CLI

1 file changed

+5
-0
lines changed

plugins/plugins-available/agents/lib/Thruk/Utils/CLI/Agents.pm

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Available commands are:
3535
--ip set ip address (available in add mode)
3636
--section set section (available in add mode)
3737
-k | --insecure skip tls verification (available in add mode)
38+
--cached use cached host inventory
3839
3940
4041
=back
@@ -92,6 +93,7 @@ sub cmd {
9293
'clear_manual' => undef,
9394
'section' => undef,
9495
'insecure' => undef,
96+
'cached' => undef,
9597
};
9698
$opt->{'fresh'} = 1 if Thruk::Base::array_contains('-II', $commandoptions);
9799
$opt->{'clear_manual'} = 1 if Thruk::Base::array_contains('-III', $commandoptions);
@@ -116,6 +118,7 @@ sub cmd {
116118
"ip=s" => \$opt->{'address'},
117119
"section=s" => \$opt->{'section'},
118120
"k|insecure" => \$opt->{'insecure'},
121+
"cached" => \$opt->{'cached'},
119122
) or do {
120123
return(Thruk::Utils::CLI::get_submodule_help(__PACKAGE__));
121124
};
@@ -672,6 +675,8 @@ sub _get_checks {
672675
$port = $1;
673676
}
674677

678+
$update = 0 if $opt->{'cached'};
679+
675680
my $hosts = $c->db->get_hosts(filter => [ Thruk::Utils::Auth::get_auth_filter( $c, 'hosts' ),
676681
'custom_variables' => { '~' => 'AGENT .+' },
677682
'name' => $hostname,

0 commit comments

Comments
 (0)