#define DCIDESC_AGENT_LOG_STATUS _T("Agent log status")
#define DCIDESC_AGENT_PROCESSEDREQUESTS _T("Number of requests processed by agent")
#define DCIDESC_AGENT_REGISTRAR _T("Registrar server address set on agent startup")
+#define DCIDESC_AGENT_RECEIVEDSYSLOGMESSAGES _T("Number of syslog messages received by agent")
#define DCIDESC_AGENT_REJECTEDCONNECTIONS _T("Number of connections rejected by agent")
#define DCIDESC_AGENT_SENT_TRAPS _T("Number of traps successfully sent to server")
#define DCIDESC_AGENT_SOURCEPACKAGESUPPORT _T("Check if source packages are supported")
#define DCIDESC_AGENT_SUPPORTEDCIPHERS _T("List of ciphers supported by agent")
+#define DCIDESC_AGENT_SYSLOGPROXYQUEUESIZE _T("Agent syslog proxy queue size")
#define DCIDESC_AGENT_THREADPOOL_ACTIVEREQUESTS _T("Agent thread pool {instance}: active requests")
#define DCIDESC_AGENT_THREADPOOL_CURRSIZE _T("Agent thread pool {instance}: current size")
#define DCIDESC_AGENT_THREADPOOL_LOAD _T("Agent thread pool {instance}: current load")
LONG H_SHA1Hash(const TCHAR *cmd, const TCHAR *arg, TCHAR *value, AbstractCommSession *session);
LONG H_SubAgentList(const TCHAR *cmd, const TCHAR *arg, StringList *value, AbstractCommSession *session);
LONG H_SubAgentTable(const TCHAR *cmd, const TCHAR *arg, Table *value, AbstractCommSession *session);
+LONG H_SyslogStats(const TCHAR *cmd, const TCHAR *arg, TCHAR *value, AbstractCommSession *session);
LONG H_ActionList(const TCHAR *cmd, const TCHAR *arg, StringList *value, AbstractCommSession *session);
LONG H_ExternalParameter(const TCHAR *cmd, const TCHAR *arg, TCHAR *value, AbstractCommSession *session);
LONG H_ExternalList(const TCHAR *cmd, const TCHAR *arg, StringList *value, AbstractCommSession *session);
{ _T("Agent.LogFile.Status"), H_ComponentStatus, _T("L"), DCI_DT_UINT, DCIDESC_AGENT_LOG_STATUS },
{ _T("Agent.ProcessedRequests"), H_UIntPtr, (TCHAR *)&m_dwProcessedRequests, DCI_DT_UINT, DCIDESC_AGENT_PROCESSEDREQUESTS },
{ _T("Agent.Registrar"), H_StringConstant, g_szRegistrar, DCI_DT_STRING, DCIDESC_AGENT_REGISTRAR },
+ { _T("Agent.ReceivedSyslogMessages"), H_SyslogStats, _T("R"), DCI_DT_UINT64, DCIDESC_AGENT_RECEIVEDSYSLOGMESSAGES },
{ _T("Agent.RejectedConnections"), H_UIntPtr, (TCHAR *)&g_dwRejectedConnections, DCI_DT_UINT, DCIDESC_AGENT_REJECTEDCONNECTIONS },
{ _T("Agent.SentTraps"), H_AgentTraps, _T("S"), DCI_DT_UINT64, DCIDESC_AGENT_SENT_TRAPS },
{ _T("Agent.SourcePackageSupport"), H_StringConstant, _T("0"), DCI_DT_INT, DCIDESC_AGENT_SOURCEPACKAGESUPPORT },
{ _T("Agent.SupportedCiphers"), H_SupportedCiphers, NULL, DCI_DT_STRING, DCIDESC_AGENT_SUPPORTEDCIPHERS },
+ { _T("Agent.SyslogProxyQueueSize"), H_SyslogStats, _T("Q"), DCI_DT_UINT, DCIDESC_AGENT_SYSLOGPROXYQUEUESIZE },
{ _T("Agent.ThreadPool.ActiveRequests(*)"), H_ThreadPoolInfo, (TCHAR *)THREAD_POOL_REQUESTS, DCI_DT_UINT, DCIDESC_AGENT_THREADPOOL_ACTIVEREQUESTS },
{ _T("Agent.ThreadPool.CurrSize(*)"), H_ThreadPoolInfo, (TCHAR *)THREAD_POOL_CURR_SIZE, DCI_DT_UINT, DCIDESC_AGENT_THREADPOOL_CURRSIZE },
{ _T("Agent.ThreadPool.Load(*)"), H_ThreadPoolInfo, (TCHAR *)THREAD_POOL_LOAD, DCI_DT_UINT, DCIDESC_AGENT_THREADPOOL_LOAD },
*/
static Queue s_syslogSenderQueue;
+/**
+ * Counter for received messages
+ */
+static UINT64 s_receivedMessages = 0;
+
+/**
+ * Handler for syslog proxy information parameters
+ */
+LONG H_SyslogStats(const TCHAR *cmd, const TCHAR *arg, TCHAR *value, AbstractCommSession *session)
+{
+ switch(*arg)
+ {
+ case 'R': // received messages
+ ret_uint64(value, s_receivedMessages);
+ break;
+ case 'Q': // queue size
+ ret_int(value, s_syslogSenderQueue.size());
+ break;
+ default:
+ return SYSINFO_RC_UNSUPPORTED;
+ }
+ return SYSINFO_RC_SUCCESS;
+}
+
/**
* Shutdown trap sender
*/
{
syslogMessage[bytes] = 0;
s_syslogSenderQueue.put(new SyslogRecord(InetAddress::createFromSockaddr((struct sockaddr *)&addr), syslogMessage, bytes));
+ s_receivedMessages++;
}
else
{