From b2614d3c75fab9ae185f46afd657fd3c119d4812 Mon Sep 17 00:00:00 2001 From: Guilherme Maciel Ferreira Date: Mon, 21 Mar 2011 10:51:09 +0100 Subject: [PATCH] Renamed the limit-to-notify configuration option to limit-hosts-down, because it is a better description of the intention. --- Readme | 6 +++--- conf/pingcheck.conf | 2 +- src/config/configuration.cpp | 16 ++++++++-------- src/config/configuration.h | 10 +++++----- src/config/configurationreader.cpp | 16 ++++++++-------- src/config/configurationreader.h | 6 +++--- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Readme b/Readme index 909dd46..70a0101 100644 --- a/Readme +++ b/Readme @@ -157,9 +157,9 @@ configuration block. 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 diff --git a/conf/pingcheck.conf b/conf/pingcheck.conf index 55f0e07..5e5548b 100644 --- a/conf/pingcheck.conf +++ b/conf/pingcheck.conf @@ -1,4 +1,4 @@ -limit-to-notify=5 +limit-hosts-down=5 [host] name=www.intra2net.com diff --git a/src/config/configuration.cpp b/src/config/configuration.cpp index b20681f..ea6bce0 100644 --- a/src/config/configuration.cpp +++ b/src/config/configuration.cpp @@ -10,10 +10,10 @@ using namespace std; Configuration::Configuration() : ConfigFileName( "" ), - LimitToNotify( 0 ), + LimitHostsDown( 0 ), Hosts(), - MinLimitToNotify( 0 ), - MaxLimitToNotify( 50 ) + MinLimitHostsDown( 0 ), + MaxLimitHostsDown( 50 ) { } @@ -33,16 +33,16 @@ void Configuration::set_config_file_name( const std::string &config_file_name ) 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 diff --git a/src/config/configuration.h b/src/config/configuration.h index d4f30ee..b86335e 100644 --- a/src/config/configuration.h +++ b/src/config/configuration.h @@ -21,19 +21,19 @@ public: 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 get_hosts() const; void set_hosts( const std::vector &hosts_list ); private: std::string ConfigFileName; - int LimitToNotify; + int LimitHostsDown; std::vector Hosts; - const int MinLimitToNotify; - const int MaxLimitToNotify; + const int MinLimitHostsDown; + const int MaxLimitHostsDown; }; diff --git a/src/config/configurationreader.cpp b/src/config/configurationreader.cpp index 07e1e53..2df1a63 100644 --- a/src/config/configurationreader.cpp +++ b/src/config/configurationreader.cpp @@ -23,9 +23,9 @@ ConfigurationReader::ConfigurationReader() : 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 ), @@ -109,7 +109,7 @@ options_description ConfigurationReader::get_configuration_options() const { options_description options( "Configuration" ); options.add_options() - ( LimitToNotifyCmdStr.c_str(), value()->default_value( DefaultLimitToNotify ), LimitToNotifyCmdDesc.c_str() ) + ( LimitHostsDownCmdStr.c_str(), value()->default_value( DefaultLimitHostsDown ), LimitHostsDownCmdDesc.c_str() ) ( HostNameCmdStr.c_str(), value< vector >(), HostNameCmdDesc.c_str() ) ( HostIntervalCmdStr.c_str(), value< vector >(), HostIntervalCmdDesc.c_str() ) ; @@ -127,12 +127,12 @@ bool ConfigurationReader::parse_configuration_options( const variables_map &vm ) cout << ConfigFileCmdStr << "=" << config_file_name << endl; } - if ( vm.count( LimitToNotifyCmdStr ) ) + if ( vm.count( LimitHostsDownCmdStr ) ) { - int limit_to_notify = vm[ LimitToNotifyCmdStr ].as (); - Config.set_limit_to_notify( limit_to_notify ); + int limit_host_down = vm[ LimitHostsDownCmdStr ].as (); + 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; diff --git a/src/config/configurationreader.h b/src/config/configurationreader.h index 2c5bd3e..a6dded0 100644 --- a/src/config/configurationreader.h +++ b/src/config/configurationreader.h @@ -61,9 +61,9 @@ private: 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; -- 1.7.1