Great! Thanks for your support and for pointing out the abort statement, very useful in these scenarios.
Best regards,
Kjell
			Best regards,
Kjell
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
~/netxms-2.0.3/src/server/core$ diff -u objects.cpp_orig objects.cpp
--- objects.cpp_orig    2016-04-10 12:46:07.272845568 +0200
+++ objects.cpp 2016-04-12 08:41:45.788328287 +0200
@@ -69,7 +69,12 @@
  */
 static THREAD_RESULT THREAD_CALL ApplyTemplateThread(void *pArg)
 {
-       DbgPrintf(1, _T("Apply template thread started"));
+   DbgPrintf(1, _T("Apply template thread started"));
+
+   DbgPrintf(2, _T("Delaying start of ApplyTemplateThread for 5min..."));
+   sleep(300);
+   DbgPrintf(2, _T("ApplyTemplateThread continuing."));
+
    while(1)
    {
       TEMPLATE_UPDATE_INFO *pInfo = (TEMPLATE_UPDATE_INFO *)g_pTemplateUpdateQueue->getOrBlock();
@@ -241,8 +246,8 @@
        // Initialize service checks
        SlmCheck::init();
-   // Start template update applying thread
-   ThreadCreate(ApplyTemplateThread, 0, NULL);
+   // Start template update applying thread, moved to end of LoadObjects
+   //ThreadCreate(ApplyTemplateThread, 0, NULL);
 }
 /**
@@ -1773,6 +1778,10 @@
    // Start map update thread
    ThreadCreate(MapUpdateThread, 0, NULL);
+   // Start template update applying thread. Moved from ObjectsInit
+   ThreadCreate(ApplyTemplateThread, 0, NULL);
+
+
    return TRUE;
 }
dcival = $1;
--- icmp.cpp_bak        2014-11-28 09:23:44.559231668 +0100
+++ icmp.cpp    2014-11-28 09:28:48.212833890 +0100
@@ -227,8 +227,15 @@
    // Do ping
    nBytes = dwPacketSize - sizeof(IPHDR);
+   UINT32 seed = time(0) * dwAddr; // attempt to create different seeds for each call to each node
+   int iNumRetriesOrig = iNumRetries;
    while(iNumRetries--)
-   {
+   {  // random delay before start pinging
+      int min = 500 * (iNumRetriesOrig - iNumRetries+1); // min = 0 in first run, then wait longer and longer
+      int max = 1000 + min;  // increased random window between retries
+      int delay = min + (rand_r(&seed) % (int)(max - min + 1));
+      ThreadSleepMs(delay);
+
       dwRTT = 0;  // Round-trip time for current request
       request.m_icmpHdr.m_wId = ICMP_REQUEST_ID;
       request.m_icmpHdr.m_wSeq++;
@@ -364,7 +371,7 @@
 #endif
       }
-      ThreadSleepMs(500);     // Wait half a second before sending next packet
+      // ThreadSleepMs(500);     // Wait half a second before sending next packet // We do random delay in beginning of loop instead
    }
 stop_ping:
# ulimit -n
8192
# ulimit -Hn
16384
# ulimit -Sn
8192
root            soft    nofile          8192
root            hard    nofile          16384
sub main() {
   ver = GetDCIValue($node, FindDCIByName($node, "AppVersion(theApp)"));
   // nxsl finally uses short-circuit evaluation :-)
   return (ver != NULL && $node->name ~= "node-name-regexp" && real(ver) > 1.2 && real(ver) < 2.0);
}
netxmsd: sh stat
Total number of objects:     5988
Number of monitored nodes:   1530
Number of collectable DCIs:  45318
Item Poller                                      20       Running
Syncer Thread                                    130      Not responding
Poll Manager                                     60       Running
./configure --with-static-agent --with-all-static --with-static-subagents="pingcheck"
../../../tools/create_ssa_list.sh "linux pingcheck" > static_subagents.cpp
  CXX    static_subagents.o
make[4]: *** No rule to make target `../../../src/db/libnxdb/libnxdb.la', needed by `nxagentd'.  Stop.
  CXX    extagent.o
extagent.cpp: In function CSCPMessage* ReadMessageFromPipe(void*, void*):
extagent.cpp:131:34: error: cast from void to SOCKET loses precision
make[4]: *** [extagent.o] Error 1
typedef intptr_t SOCKET;
push.cpp: In function void* PushConnector(void*):
push.cpp:245:63: error: cannot convert size_t* to socklen_t* for argument 3 to int accept(int, sock  addr*, socklen_t*)
make[4]: *** [push.o] Error 1
 from: size_t size = sizeof(struct sockaddr_un);
 to: socklen_t size = sizeof(struct sockaddr_un);
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld: attempted static link of dynamic object `../../../src/db/libnxdb/.libs/libnxdb.so'
collect2: ld returned 1 exit status
 Will try again when next release is out. Again, thanks for your support.
 Will try again when next release is out. Again, thanks for your support.
./configure --with-static-agent
  CXX    snmpproxy.o
../../../tools/create_ssa_list.sh "linux ecs logwatch ping portcheck ups" > static_subagents.cpp
  CXX    static_subagents.o
  CXX    subagent.o
  CXX    sysinfo.o
  CXX    tools.o
  CXX    trap.o
  CXX    upgrade.o
  CXX    watchdog.o
make[4]: *** No rule to make target `../../../src/db/libnxdb/libnxdb.la', needed by `nxagentd'.  Stop.