AUTOMAKE_OPTIONS = foreign
-SUBDIRS = conf sslfiles heartbeat-ra
+SUBDIRS = conf sslfiles heartbeat-ra mibs
AUTOMAKE_OPTIONS = foreign
-L7VS_SNMP_MIBSDIR = /usr/share/snmp/mibs
+UML7_VERSION = @ultramonkeyl7_version@
+L7VS_SNMP_MIBSDIR= /usr/share/doc/$(UML7_VERSION)/mibs
install:
$(INSTALL) -b -m 644 -D ./ULTRAMONKEY-L7-MIB.txt $(L7VS_SNMP_MIBSDIR)/ULTRAMONKEY-L7-MIB.txt
#include "atomic.h"
#include "wrlock.h"
-#if !defined(LOGGER_PROCESS_VSD) && !defined(LOGGER_PROCESS_ADM) && !defined(LOGGER_PROCESS_SNM)
+#if !defined(LOGGER_PROCESS_VSD) && !defined(LOGGER_PROCESS_ADM)
#define LOGGER_PROCESS_VSD
#endif
#define LOGGER_PROCESS_ID "VSD"
#elif defined(LOGGER_PROCESS_ADM)
#define LOGGER_PROCESS_ID "ADM"
-#else
-#define LOGGER_PROCESS_ID "SNM"
#endif
#define LOGGER_PROCESS_PROTOCOL_MODULE_ID "PRM"
#define LOGGER_ROTATION_TIMING_KEY "l7vsadm_rotation_timing"
#define LOGGER_ROTATION_TIMING_VALUE_KEY "l7vsadm_rotation_timing_value"
-#elif(LOGGER_PROCESS_SNM)
-#define LOGGER_LOG_FILENAME_KEY "snmp_log_filename"
-#define LOGGER_ROTATION_KEY "snmp_rotation"
-#define LOGGER_MAX_BACKUP_INDEX_KEY "snmp_max_backup_index"
-#define LOGGER_MAX_FILE_SIZE_KEY "snmp_max_filesize"
-#define LOGGER_ROTATION_TIMING_KEY "snmp_rotation_timing"
-#define LOGGER_ROTATION_TIMING_VALUE_KEY "snmp_rotation_timing_value"
-
-#define LOGGER_CONN_LOG_FILENAME_KEY "snmp_conn_log_filename"
-#define LOGGER_CONN_ROTATION_KEY "snmp_conn_rotation"
-#define LOGGER_CONN_MAX_BACKUP_INDEX_KEY "snmp_conn_max_backup_index"
-#define LOGGER_CONN_MAX_FILE_SIZE_KEY "snmp_conn_max_filesize"
-#define LOGGER_CONN_ROTATION_TIMING_KEY "snmp_conn_rotation_timing"
-#define LOGGER_CONN_ROTATION_TIMING_VALUE_KEY "snmp_conn_rotation_timing_value"
-
#endif
/*!
putLogError(l7vs::LOG_CAT_L7VSD_LOGGER, logno, str, file, line);
#elif defined(LOGGER_PROCESS_ADM)
putLogError(l7vs::LOG_CAT_L7VSADM_LOGGER, logno, str, file, line);
-#elif defined(LOGGER_PROCESS_SNM)
- putLogError(l7vs::LOG_CAT_SNMPAGENT_LOGGER, logno, str, file, line);
#endif
throw std::logic_error(str);
log_category = LOG_CAT_L7VSD_LOGGER;
#elif defined(LOGGER_PROCESS_ADM)
log_category = LOG_CAT_L7VSADM_LOGGER;
-#elif defined(LOGGER_PROCESS_SNM)
- log_category = LOG_CAT_SNMPAGENT_LOGGER;
#else
log_category = LOG_CAT_L7VSD_LOGGER;
#endif
}
#elif defined(LOGGER_PROCESS_ADM)
cat_logger->addAppender(normalAppender);
-#elif defined(LOGGER_PROCESS_SNM)
- cat_logger->addAppender(normalAppender);
#else
cat_logger->addAppender(normalAppender);
#endif
log_category = LOG_CAT_L7VSD_LOGGER;
#elif defined(LOGGER_PROCESS_ADM)
log_category = LOG_CAT_L7VSADM_LOGGER;
-#elif defined(LOGGER_PROCESS_SNM)
- log_category = LOG_CAT_SNMPAGENT_LOGGER;
#else
log_category = LOG_CAT_L7VSD_LOGGER;
#endif
Logger::putLogError(l7vs::LOG_CAT_L7VSD_LOGGER, logno, str, file, line);
#elif defined(LOGGER_PROCESS_ADM)
Logger::putLogError(l7vs::LOG_CAT_L7VSADM_LOGGER, logno, str, file, line);
-#elif defined(LOGGER_PROCESS_SNM)
- Logger::putLogError(l7vs::LOG_CAT_SNMPAGENT_LOGGER, logno, str, file, line);
#else
Logger::putLogError(l7vs::LOG_CAT_L7VSD_LOGGER, logno, str, file, line);
#endif
int vs_port = 0;
int sorry_port = 0;
int sorry_flag = 0;
+ unsigned long long http_requests_tmp = 0;
+ unsigned long long http_get_requests_tmp = 0;
+ unsigned long long http_post_requests_tmp = 0;
struct counter64 sorry_maxconnection = {
0
stats_base& base_stats = protocol_module_ptr->get_stats();
if ( base_stats.get_mode() == stats_base::MODE_HTTP ) {
http_stats &httpstats = static_cast<http_stats&>(base_stats);
- http_requests.low = httpstats.http_requests.get();
- http_get_requests.low = httpstats.http_get_requests.get();
- http_post_requests.low = httpstats.http_post_requests.get();
+ http_requests_tmp = httpstats.http_requests.get();
+ http_get_requests_tmp = httpstats.http_get_requests.get();
+ http_post_requests_tmp = httpstats.http_post_requests.get();
+ //convert to counter64
+ http_requests.low = http_requests_tmp & 0xFFFFFFFF;
+ http_requests.high = http_requests_tmp >> 32;
+ http_get_requests.low = http_get_requests_tmp & 0xFFFFFFFF;
+ http_get_requests.high = http_get_requests_tmp >> 32;
+ http_post_requests.low = http_post_requests_tmp & 0xFFFFFFFF;
+ http_post_requests.high = http_post_requests_tmp >> 32;
}
//set sorry max connection
- sorry_maxconnection.low = srv.sorry_maxconnection;
+ sorry_maxconnection.low = srv.sorry_maxconnection & 0xFFFFFFFF;
+ sorry_maxconnection.high = srv.sorry_maxconnection >> 32;
//set throughput information
- throughput_upstream.low = srv.throughput_upstream * 8;
- throughput_downstream.low = srv.throughput_downstream * 8;
- qos_upstream.low = srv.qos_upstream * 8;
- qos_downstream.low = srv.qos_downstream * 8;
+ throughput_upstream.low = (srv.throughput_upstream * 8) & 0xFFFFFFFF;
+ throughput_upstream.high = (srv.throughput_upstream * 8) >> 32;
+ throughput_downstream.low = (srv.throughput_downstream * 8) & 0xFFFFFFFF;
+ throughput_downstream.high = (srv.throughput_downstream * 8) >> 32;
+
+ //set qos information
+ if (ULLONG_MAX != srv.qos_upstream) {
+ qos_upstream.low = (srv.qos_upstream * 8) & 0xFFFFFFFF;
+ qos_upstream.high = (srv.qos_upstream * 8) >> 32;
+ }
+
+ if (ULLONG_MAX != srv.qos_downstream) {
+ qos_downstream.low = (srv.qos_downstream * 8) & 0xFFFFFFFF;
+ qos_downstream.high = (srv.qos_downstream * 8) >> 32;
+ }
//set session information
pool_session_count = (*it)->get_pool_sessions_count();
#include "logger.h"
#include "utility.h"
-#if !defined(LOGGER_PROCESS_VSD) && !defined(LOGGER_PROCESS_ADM) && !defined(LOGGER_PROCESS_SNM)
+#if !defined(LOGGER_PROCESS_VSD) && !defined(LOGGER_PROCESS_ADM)
#define LOGGER_PROCESS_VSD
#endif
-#ifdef LOGGER_PROCESS_SNM
-l7vs::LOG_CATEGORY_TAG param_cat = l7vs::LOG_CAT_SNMPAGENT_PARAMETER;
-#elif LOGGER_PROCESS_ADM
+#ifdef LOGGER_PROCESS_ADM
l7vs::LOG_CATEGORY_TAG param_cat = l7vs::LOG_CAT_L7VSADM_PARAMETER;
#else
l7vs::LOG_CATEGORY_TAG param_cat = l7vs::LOG_CAT_L7VSD_PARAMETER;
#include <boost/format.hpp>
-#if !defined(LOGGER_PROCESS_VSD) && !defined(LOGGER_PROCESS_ADM) && !defined(LOGGER_PROCESS_SNM)
+#if !defined(LOGGER_PROCESS_VSD) && !defined(LOGGER_PROCESS_ADM)
#define LOGGER_PROCESS_VSD
#endif
-#ifdef LOGGER_PROCESS_SNM
-l7vs::LOG_CATEGORY_TAG logcat = l7vs::LOG_CAT_SNMPAGENT_PARAMETER;
-#elif LOGGER_PROCESS_ADM
+#ifdef LOGGER_PROCESS_ADM
l7vs::LOG_CATEGORY_TAG logcat = l7vs::LOG_CAT_L7VSADM_PARAMETER;
#else
l7vs::LOG_CATEGORY_TAG logcat = l7vs::LOG_CAT_L7VSD_PARAMETER;
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1);
- //socket startup
- SOCK_STARTUP;
-
- //init l7vsAgent
- int ret = init_agent("l7vsAgent");
- if (ret) {
- std::string msg("init_agent failed.");
- Logger::putLogFatal(LOG_CAT_L7VSD_SNMPAGENT, 3, msg, __FILE__, __LINE__);
- //set error code
- err.setter(true, msg);
- return;
- }
-
- init_snmp("l7vsAgent");
-
- //register snmp get item' handle
- init_snmp_handles(err);
-
- if (err) {
- return;
- }
-
//set initialize flag true
initialized = true;
}
try {
+ //socket startup
+ SOCK_STARTUP;
+
+ //init l7vsAgent
+ int ret = init_agent("l7vsAgent");
+ if (ret) {
+ std::string msg("init_agent failed.");
+ Logger::putLogFatal(LOG_CAT_L7VSD_SNMPAGENT, 3, msg, __FILE__, __LINE__);
+ //set error code
+ err.setter(true, msg);
+ return;
+ }
+
+ init_snmp("l7vsAgent");
+
+ //regist snmp get item' handle
+ init_snmp_handles(err);
+
+ if (err) {
+ return;
+ }
+
//collect mib data first time
mibdata::get_instance().collect_mibdata(vsd, err);
if (err) {
//mib collect failed
std::string msg("collect_mibdata failed,thread start failed.");
- Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 3, msg, __FILE__, __LINE__);
+ Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 4, msg, __FILE__, __LINE__);
//set error code
err.setter(true, msg);
return;
std::stringstream msg;
msg << "snmp function start failed : " << e.what() << ".";
- Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 4, msg.str(), __FILE__, __LINE__);
+ Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 5, msg.str(), __FILE__, __LINE__);
//set error code
err.setter(true, msg.str());
}
process_mib_thread.join();
trap_thread.join();
+ snmp_shutdown("l7vsAgent");
+ shutdown_agent();
+ SOCK_CLEANUP;
+
std::string str = "snmp function stop.";
Logger::putLogInfo(LOG_CAT_L7VSD_SNMPAGENT, 3, str, __FILE__, __LINE__);
} catch (const boost::thread_interrupted&) {
std::stringstream msg;
msg << "thread interrupted exception.";
- Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 5, msg.str(), __FILE__, __LINE__);
+ Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 6, msg.str(), __FILE__, __LINE__);
}
}
if (err) {
std::stringstream msg;
msg << "snmp function start failed.";
- Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 6, msg.str(), __FILE__, __LINE__);
+ Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 7, msg.str(), __FILE__, __LINE__);
}
}
else {
if (vsd == NULL) {
//mib collect failed
std::string msg("vsd pointer is NULL.");
- Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 7, msg, __FILE__, __LINE__);
+ Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 8, msg, __FILE__, __LINE__);
return;
}
if (vsd == NULL) {
//mib collect failed
std::string msg("vsd pointer is NULL.");
- Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 8, msg, __FILE__, __LINE__);
+ Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 9, msg, __FILE__, __LINE__);
return;
}
//check vsd pointer
if (vsd == NULL) {
std::string msg("vsd pointer is NULL.");
- Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 9, msg, __FILE__, __LINE__);
+ Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 10, msg, __FILE__, __LINE__);
//set error code
err.setter(true, msg);
return;
if (err) {
std::string msg("collect mib data failed.");
- Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 10, msg, __FILE__, __LINE__);
+ Logger::putLogError(LOG_CAT_L7VSD_SNMPAGENT, 11, msg, __FILE__, __LINE__);
//set error code
err.setter(true, msg);
return;
if (start_flag == true) {
stop();
}
- snmp_shutdown("l7vsAgent");
- SOCK_CLEANUP;
+
}
/*!
} else {
#if defined(LOGGER_PROCESS_ADM)
t.tm_year = numYear - 1900;
-#else //LOGGER_PROCESS_VSD or LOGGER_PROCESS_SNM
+#else //LOGGER_PROCESS_VSD
t.tm_year = numYear + 1 - 1900;
#endif
}
#if defined(LOGGER_PROCESS_ADM)
t.tm_year = numYear - 1900;
t.tm_mon = numMonth - 1;
-#else //LOGGER_PROCESS_VSD or LOGGER_PROCESS_SNM
+#else //LOGGER_PROCESS_VSD
if (12 == numMonth) {
t.tm_year = numYear + 1 - 1900;
t.tm_mon = 0;
} else {
#if defined(LOGGER_PROCESS_ADM)
t.tm_mday = numDate + (numTimingWeek - numNowWeek);
-#else //LOGGER_PROCESS_VSD or LOGGER_PROCESS_SNM
+#else //LOGGER_PROCESS_VSD
t.tm_mday = numDate + (7 - (numNowWeek - numTimingWeek));
#endif
}
} else {
#if defined(LOGGER_PROCESS_ADM)
t.tm_mday = numDate;
-#else //LOGGER_PROCESS_VSD or LOGGER_PROCESS_SNM
+#else //LOGGER_PROCESS_VSD
t.tm_mday = numDate + 1;
#endif
}
} else {
#if defined(LOGGER_PROCESS_ADM)
t.tm_hour = numHour;
-#else //LOGGER_PROCESS_VSD or LOGGER_PROCESS_SNM
+#else //LOGGER_PROCESS_VSD
t.tm_hour = numHour + 1;
#endif
}
// Do not rollover.
return false;
}
-#else //LOGGER_PROCESS_VSD or LOGGER_PROCESS_SNM
+#else //LOGGER_PROCESS_VSD
return now_time > nextCheck;
#endif
}