LimitToNotifyCmdStr( "limit-to-notify" ),
LimitToNotifyCmdDesc( "Limit of host that have to be down in order to notify." ),
HostNameCmdStr( "host.name" ),
- HostNameCmdDesc( "Host address" )
+ HostNameCmdDesc( "Host address" ),
+ DefaultHostInterval( 1 ),
+ HostIntervalCmdStr( "host.interval" ),
+ HostIntervalCmdDesc( "Interval between each ping to the host" )
{
}
options.add_options()
( VersionCmdStr.c_str(), VersionCmdDesc.c_str() )
( HelpCmdStr.c_str(), HelpCmdDesc.c_str() )
- ( ConfigFileCmdStr.c_str(), value<string>()->default_value( DefaultConfigFileName ), ConfigFileCmdDesc.c_str() );
+ ( ConfigFileCmdStr.c_str(), value<string>()->default_value( DefaultConfigFileName ), ConfigFileCmdDesc.c_str() )
+ ;
return options;
}
options_description options( "Configuration" );
options.add_options()
( LimitToNotifyCmdStr.c_str(), value<int>()->default_value( DefaultLimitToNotify ), LimitToNotifyCmdDesc.c_str() )
- ( HostNameCmdStr.c_str(), value< string >(), HostNameCmdDesc.c_str() );
+ ( HostNameCmdStr.c_str(), value< string >(), HostNameCmdDesc.c_str() )
+ ( HostIntervalCmdStr.c_str(), value< int >()->default_value( DefaultHostInterval ), HostIntervalCmdDesc.c_str() )
+ ;
return options;
}
cout << HostNameCmdStr << "=" << host_name << endl;
}
+ if ( vm.count( HostIntervalCmdStr ) )
+ {
+ int host_interval = vm[ HostIntervalCmdStr ].as<int> ();
+ Host host = Config.get_host();
+ host.set_interval( host_interval );
+ Config.set_host( host );
+
+ cout << HostIntervalCmdStr << "=" << host_interval << endl;
+ }
+
return true;
}
positional_options_description p;
p.add( HostNameCmdStr.c_str(), -1 );
+ //p.add( HostIntervalCmdStr.c_str(), -1 );
store( command_line_parser( argc, argv ).
options( cmdline_options ).
if ( is_generic_options( vm ) )
{
- return parse_generic_options( vm, visible );
+ parse_generic_options( vm, visible );
+
+ return false;
}
}