SourceNetworkInterfaceCmdDesc( "The network interface from where the packets will be received and originated" ),
NameServerCmdStr( "nameserver" ),
NameServerCmdDesc( "The local address from where the DNS query will be made." ),
- DefaultHostsDownLimit( 1 ), // 1 host down at most
+ DefaultHostsDownLimit( 0 ), // no host down
HostsDownLimitCmdStr( "hosts-down-limit" ),
HostsDownLimitCmdDesc( "Limit of host that have to be down in order to notify." ),
DefaultPingFailLimit( 50 ), // 50 pings can fail at most
}
// [host] name
- size_t hosts_names_count = 0;
- if ( vm.count( HostNameCmdStr ) > 0 )
+ size_t hosts_names_count = vm.count( HostNameCmdStr );
+ if ( hosts_names_count > 0 )
{
HostList hosts_list;
Config.set_hosts( hosts_list );
- hosts_names_count = hosts_names.size();
-
+ BOOST_ASSERT( hosts_names_count == hosts_names.size() );
BOOST_ASSERT( hosts_names_count >= static_cast<size_t>( host_down_limit ) );
}
// [host] interval
- size_t hosts_interval_count = 0;
- if ( vm.count( HostIntervalCmdStr ) > 0 )
+ size_t hosts_interval_count = vm.count( HostIntervalCmdStr );
+ if ( hosts_interval_count > 0 )
{
HostList hosts_list = Config.get_hosts();
HostList::iterator hosts_it = hosts_list.begin();
<< host_interval_in_sec << endl;
}
- hosts_interval_count = hosts_intervals.size();
+ BOOST_ASSERT( hosts_interval_count == hosts_intervals.size() );
}
// TODO deal when interval for a given host was not set. use DefaultHostIntervalInSec
(void) p.add( HostNameCmdStr.c_str(), -1 );
parsed_options parsed_opt = command_line_parser( argc, argv ).
- options( cmdline_options ).positional( p ).run();
+ options( cmdline_options ).
+ positional( p ).
+ allow_unregistered().
+ run();
store( parsed_opt, vm );
notify( vm );
bool ConfigurationReader::process_configuration_file( variables_map &vm )
{
string config_file_name = "";
- // parse the command line options to retrieve the config file name
+ // parse the command line options to retrieve the config file name, if the
+ // config-file option was not specified in the command line, it will return
+ // the default file
if ( parse_configuration_options( vm ) )
+ {
config_file_name = Config.get_config_file_name();
+ }
return process_configuration_file( config_file_name, vm );
}