Max size of agent data collectiors pool can be configured
authorVictor Kirhenshtein <victor@netxms.org>
Thu, 7 Jul 2016 06:54:21 +0000 (09:54 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Thu, 7 Jul 2016 06:54:21 +0000 (09:54 +0300)
ChangeLog
src/agent/core/datacoll.cpp
src/agent/core/nxagentd.cpp
src/agent/core/sysinfo.cpp

index 834cdcc..9696be4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,7 @@
 - LVM monitoring parameters on AIX
 - Added option to get normalized server thread pool load average
 - Fixed bug in self-monitoring termplates
+- Max size of agent data collectiors pool can be configured
 - Management console
         - Fixed possible deadlock when executing server script
         - Fixed area charts on dashboards
index 9bdd787..0557860 100644 (file)
@@ -30,6 +30,7 @@ UINT32 GetSnmpValue(const uuid& target, UINT16 port, const TCHAR *oid, TCHAR *va
 
 extern UINT32 g_dcReconciliationBlockSize;
 extern UINT32 g_dcReconciliationTimeout;
+extern UINT32 g_dcMaxCollectorPoolSize;
 
 /**
  * Data collector start indicator
@@ -970,7 +971,7 @@ static UINT32 DataCollectionSchedulerRun()
 static THREAD_RESULT THREAD_CALL DataCollectionScheduler(void *arg)
 {
    DebugPrintf(INVALID_INDEX, 1, _T("Data collection scheduler thread started"));
-   s_dataCollectorPool = ThreadPoolCreate(1, 64, _T("DATACOLL"));
+   s_dataCollectorPool = ThreadPoolCreate(1, g_dcMaxCollectorPoolSize, _T("DATACOLL"));
 
    UINT32 sleepTime = DataCollectionSchedulerRun();
    while(!AgentSleepAndCheckForShutdown(sleepTime * 1000))
index f3dfe51..129963f 100644 (file)
@@ -165,6 +165,7 @@ UINT32 g_dwSNMPTrapPort = 162;
 UINT32 g_longRunningQueryThreshold = 250;
 UINT32 g_dcReconciliationBlockSize = 1024;
 UINT32 g_dcReconciliationTimeout = 15000;
+UINT32 g_dcMaxCollectorPoolSize = 64;
 #ifdef _WIN32
 UINT16 g_sessionAgentPort = 28180;
 #else
@@ -232,6 +233,7 @@ static NX_CFG_TEMPLATE m_cfgTemplate[] =
    { _T("BackgroundLogWriter"), CT_BOOLEAN, 0, 0, AF_BACKGROUND_LOG_WRITER, 0, &g_dwFlags, NULL },
    { _T("ControlServers"), CT_STRING_LIST, ',', 0, 0, 0, &m_pszControlServerList, NULL },
    { _T("CreateCrashDumps"), CT_BOOLEAN, 0, 0, AF_CATCH_EXCEPTIONS, 0, &g_dwFlags, NULL },
+   { _T("DataCollectionThreadPoolSize"), CT_LONG, 0, 0, 0, 0, &g_dcMaxCollectorPoolSize, NULL },
        { _T("DataDirectory"), CT_STRING, 0, 0, MAX_PATH, 0, g_szDataDirectory, NULL },
    { _T("DataReconciliationBlockSize"), CT_LONG, 0, 0, 0, 0, &g_dcReconciliationBlockSize, NULL },
    { _T("DataReconciliationTimeout"), CT_LONG, 0, 0, 0, 0, &g_dcReconciliationTimeout, NULL },
index 4fa7614..50c4802 100644 (file)
@@ -468,8 +468,9 @@ LONG H_ResolverNameByAddr(const TCHAR *cmd, const TCHAR *arg, TCHAR *value, Abst
  */
 LONG H_ThreadPoolInfo(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCommSession *session)
 {
-   TCHAR poolName[64];
-   if (!AgentGetParameterArg(param, 1, poolName, 64))
+   TCHAR poolName[64], options[64];
+   if (!AgentGetParameterArg(param, 1, poolName, 64) ||
+       !AgentGetParameterArg(param, 2, options, 64))
       return SYSINFO_RC_UNSUPPORTED;
 
    ThreadPoolInfo info;
@@ -485,13 +486,22 @@ LONG H_ThreadPoolInfo(const TCHAR *param, const TCHAR *arg, TCHAR *value, Abstra
          ret_int(value, info.load);
          break;
       case THREAD_POOL_LOADAVG_1:
-         ret_double(value, info.loadAvg[0]);
+         if ((options[0] != 0) && _tcstol(options, NULL, 10))
+            ret_double(value, info.loadAvg[0] / info.maxThreads, 2);
+         else
+            ret_double(value, info.loadAvg[0], 2);
          break;
       case THREAD_POOL_LOADAVG_5:
-         ret_double(value, info.loadAvg[1]);
+         if ((options[0] != 0) && _tcstol(options, NULL, 10))
+            ret_double(value, info.loadAvg[1] / info.maxThreads, 2);
+         else
+            ret_double(value, info.loadAvg[1], 2);
          break;
       case THREAD_POOL_LOADAVG_15:
-         ret_double(value, info.loadAvg[2]);
+         if ((options[0] != 0) && _tcstol(options, NULL, 10))
+            ret_double(value, info.loadAvg[2] / info.maxThreads, 2);
+         else
+            ret_double(value, info.loadAvg[2], 2);
          break;
       case THREAD_POOL_MAX_SIZE:
          ret_int(value, info.maxThreads);