4.1. General
---------------------------------------
This configurations are shared among and affect all the hosts.
-- limit-to-notify: range from 0 to the number of hosts available. This value
- represents minimum number of hosts that have to fail (i.e. do not reply the
- ping) in order to alert any external system.
+- limit-hosts-down: ranges from 0 to the number of hosts available. This value
+ represents the minimum number of hosts that have to fail (i.e. do not reply
+ the ping) in order to alert any external system.
4.2. Host
-limit-to-notify=5
+limit-hosts-down=5
[host]
name=www.intra2net.com
Configuration::Configuration() :
ConfigFileName( "" ),
- LimitToNotify( 0 ),
+ LimitHostsDown( 0 ),
Hosts(),
- MinLimitToNotify( 0 ),
- MaxLimitToNotify( 50 )
+ MinLimitHostsDown( 0 ),
+ MaxLimitHostsDown( 50 )
{
}
this->ConfigFileName = config_file_name;
}
-int Configuration::get_limit_to_notify() const
+int Configuration::get_limit_hosts_down() const
{
- return LimitToNotify;
+ return LimitHostsDown;
}
-void Configuration::set_limit_to_notify( const int limit_to_notify )
+void Configuration::set_limit_hosts_down( const int limit_hosts_down )
{
- BOOST_ASSERT( ( MinLimitToNotify <= limit_to_notify ) && ( limit_to_notify <= MaxLimitToNotify) );
+ BOOST_ASSERT( ( MinLimitHostsDown <= limit_hosts_down ) && ( limit_hosts_down <= MaxLimitHostsDown) );
- this->LimitToNotify = limit_to_notify;
+ this->LimitHostsDown = limit_hosts_down;
}
vector< HostItem > Configuration::get_hosts() const
std::string get_config_file_name() const;
void set_config_file_name( const std::string &config_file_name );
- int get_limit_to_notify() const;
- void set_limit_to_notify( const int limit_to_notify );
+ int get_limit_hosts_down() const;
+ void set_limit_hosts_down( const int limit_hosts_down );
std::vector<HostItem> get_hosts() const;
void set_hosts( const std::vector<HostItem> &hosts_list );
private:
std::string ConfigFileName;
- int LimitToNotify;
+ int LimitHostsDown;
std::vector<HostItem> Hosts;
- const int MinLimitToNotify;
- const int MaxLimitToNotify;
+ const int MinLimitHostsDown;
+ const int MaxLimitHostsDown;
};
DefaultConfigFileName( "pingcheck.conf" ),
ConfigFileCmdStr( "config-file" ),
ConfigFileCmdDesc( "Name of the configuration file." ),
- DefaultLimitToNotify( 4 ),
- LimitToNotifyCmdStr( "limit-to-notify" ),
- LimitToNotifyCmdDesc( "Limit of host that have to be down in order to notify." ),
+ DefaultLimitHostsDown( 1 ),
+ LimitHostsDownCmdStr( "limit-hosts-down" ),
+ LimitHostsDownCmdDesc( "Limit of host that have to be down in order to notify." ),
HostNameCmdStr( "host.name" ),
HostNameCmdDesc( "Host address" ),
DefaultHostInterval( 1 ),
{
options_description options( "Configuration" );
options.add_options()
- ( LimitToNotifyCmdStr.c_str(), value<int>()->default_value( DefaultLimitToNotify ), LimitToNotifyCmdDesc.c_str() )
+ ( LimitHostsDownCmdStr.c_str(), value<int>()->default_value( DefaultLimitHostsDown ), LimitHostsDownCmdDesc.c_str() )
( HostNameCmdStr.c_str(), value< vector<string> >(), HostNameCmdDesc.c_str() )
( HostIntervalCmdStr.c_str(), value< vector<int> >(), HostIntervalCmdDesc.c_str() )
;
cout << ConfigFileCmdStr << "=" << config_file_name << endl;
}
- if ( vm.count( LimitToNotifyCmdStr ) )
+ if ( vm.count( LimitHostsDownCmdStr ) )
{
- int limit_to_notify = vm[ LimitToNotifyCmdStr ].as<int> ();
- Config.set_limit_to_notify( limit_to_notify );
+ int limit_host_down = vm[ LimitHostsDownCmdStr ].as<int> ();
+ Config.set_limit_hosts_down( limit_host_down );
- cout << LimitToNotifyCmdStr << "=" << limit_to_notify << endl;
+ cout << LimitHostsDownCmdStr << "=" << limit_host_down << endl;
}
int hosts_names_total = 0;
const std::string DefaultConfigFileName;
const std::string ConfigFileCmdStr;
const std::string ConfigFileCmdDesc;
- const int DefaultLimitToNotify;
- const std::string LimitToNotifyCmdStr;
- const std::string LimitToNotifyCmdDesc;
+ const int DefaultLimitHostsDown;
+ const std::string LimitHostsDownCmdStr;
+ const std::string LimitHostsDownCmdDesc;
const std::string HostNameCmdStr;
const std::string HostNameCmdDesc;
const int DefaultHostInterval;