DefaultNameServer( "127.0.0.1" ),
NameServerCmdStr( "nameserver" ),
NameServerCmdDesc( "The local address from where the DNS query will be made." ),
- PingProtocolCmdStr( "ping-protocol" ),
- PingProtocolCmdDesc( "Defines which protocol will be used to ping the destination." ),
DefaultHostsDownLimit( 0 ), // no host down
HostsDownLimitCmdStr( "hosts-down-limit" ),
HostsDownLimitCmdDesc( "Limit of host that have to be down in order to notify." ),
DefaultHostPort( 80 ), // HTTP port
HostPortCmdStr( "host.port" ),
HostPortCmdDesc( "Host port number" ),
+ HostPingProtocolCmdStr( "host.ping-protocol" ),
+ HostPingProtocolCmdDesc( "Defines which protocol will be used to ping the destination." ),
DefaultHostIntervalInSec( 60 ), // 60 seconds
HostIntervalCmdStr( "host.interval" ),
HostIntervalCmdDesc( "Interval between each ping to the host" )
options.add_options()
( SourceNetworkInterfaceCmdStr.c_str(), value<string>(), SourceNetworkInterfaceCmdDesc.c_str() )
( NameServerCmdStr.c_str(), value<string>()->default_value( DefaultNameServer ), NameServerCmdDesc.c_str() )
- ( PingProtocolCmdStr.c_str(), value<string>(), PingProtocolCmdDesc.c_str() )
( HostsDownLimitCmdStr.c_str(), value<int>()->default_value( DefaultHostsDownLimit ), HostsDownLimitCmdDesc.c_str() )
( PingFailLimitCmdStr.c_str(), value<int>()->default_value( DefaultPingFailLimit ), PingFailLimitCmdDesc.c_str() )
( StatusNotifierCmdCmdStr.c_str(), value<string>(), StatusNotifierCmdCmdDesc.c_str() )
( LinkDownIntervalCmdStr.c_str(), value<int>()->default_value( DefaultLinkDownIntervalInMin ), LinkDownIntervalCmdDesc.c_str() )
( HostNameCmdStr.c_str(), value< vector<string> >(), HostNameCmdDesc.c_str() )
( HostPortCmdStr.c_str(), value< vector<int> >(), HostPortCmdDesc.c_str() )
+ ( HostPingProtocolCmdStr.c_str(), value< vector<string> >(), HostPingProtocolCmdDesc.c_str() )
( HostIntervalCmdStr.c_str(), value< vector<int> >(), HostIntervalCmdDesc.c_str() )
;
<< nameserver << endl;
}
- // ping-protocol
- if ( vm.count( PingProtocolCmdStr ) > 0 )
- {
- string protocol_string = vm[ PingProtocolCmdStr ].as<string> ();
- PingProtocol protocol = get_ping_protocol_from_string( protocol_string );
- configuration->set_ping_protocol( protocol );
-
- GlobalLogger.info() << PingProtocolCmdStr << "="
- << protocol_string << endl;
- }
-
// hosts-down-limit
int host_down_limit = 0;
if ( vm.count( HostsDownLimitCmdStr ) > 0 )
host_port_count = hosts_ports.size();
}
+ // [host] ping-protocol
+ size_t host_ping_protocol_count = 0;
+ if ( vm.count( HostPingProtocolCmdStr ) > 0 )
+ {
+ HostList hosts_list = configuration->get_hosts();
+ HostList::iterator hosts_it = hosts_list.begin();
+
+ vector<string> hosts_protocols = vm[ HostPingProtocolCmdStr ].as< vector<string> >();
+ BOOST_FOREACH( string protocol_string, hosts_protocols )
+ {
+ BOOST_ASSERT( !protocol_string.empty() );
+
+ HostItem host_item = *hosts_it;
+ PingProtocol host_protocol = get_ping_protocol_from_string( protocol_string );
+ host_item->set_ping_protocol( host_protocol );
+ ++hosts_it;
+
+ GlobalLogger.info() << HostPingProtocolCmdStr << "="
+ << protocol_string << endl;
+ }
+
+ host_ping_protocol_count = hosts_protocols.size();
+ }
+
// [host] interval
size_t hosts_interval_count = 0;
if ( vm.count( HostIntervalCmdStr ) > 0 )
}
BOOST_ASSERT( hosts_names_count == host_port_count );
+ BOOST_ASSERT( hosts_names_count == host_ping_protocol_count );
BOOST_ASSERT( hosts_names_count == hosts_interval_count );
return true;
const std::string DefaultNameServer;
const std::string NameServerCmdStr;
const std::string NameServerCmdDesc;
- const std::string PingProtocolCmdStr;
- const std::string PingProtocolCmdDesc;
const int DefaultHostsDownLimit;
const std::string HostsDownLimitCmdStr;
const std::string HostsDownLimitCmdDesc;
const int DefaultHostPort;
const std::string HostPortCmdStr;
const std::string HostPortCmdDesc;
+ const std::string HostPingProtocolCmdStr;
+ const std::string HostPingProtocolCmdDesc;
const int DefaultHostIntervalInSec;
const std::string HostIntervalCmdStr;
const std::string HostIntervalCmdDesc;