[Solved] Log Parser - Failed to start when ExternalParameter

Started by jdl, June 18, 2009, 06:33:23 PM

Previous topic - Next topic

jdl

Hi,

It seems I have some conflict between the log parser and the ExternalParameter definition in a node configuration.
could you, please, let me know if I do sth wrong here?

Here is the agent log file when the following ExternalParameterShellExec is defined:
ExternalParameterShellExec = TCP.SocketStatus(*):/home/netxms/scripts/socket_status.pl $1 $2 $3 $4

Log file content:

[18-Jun-2009 17:21:41] Debug: Executing action Agent.Restart of type 2
[18-Jun-2009 17:21:41] Debug: EXEC: Expanding command ""/usr/local/bin/nxagentd" -c "/etc/nxagentd.conf" -d -D -X 12677"
[18-Jun-2009 17:21:41] Debug: EXEC: Executing ""/usr/local/bin/nxagentd" -c "/etc/nxagentd.conf" -d -D -X 12677"
[18-Jun-2009 17:21:41] Debug: {1} Sending message CMD_REQUEST_COMPLETED (size 32)
[18-Jun-2009 17:21:41] Debug: {1} Session with 10.10.64.125 closed
[18-Jun-2009 17:21:41] Debug: Trap sender thread terminated
[18-Jun-2009 17:21:41] Debug: {0} Session with 10.10.64.125 closed
[18-Jun-2009 17:21:42] Debug: Session Watchdog thread terminated
[18-Jun-2009 17:21:42] Debug: Listener thread terminated
[18-Jun-2009 17:21:42] NetXMS Agent stopped

[18-Jun-2009 17:21:43] Log file opened
[18-Jun-2009 17:21:43] Debug: Log file opened
[18-Jun-2009 17:21:43] Debug: Subagent API initialized
[18-Jun-2009 17:21:44] Subagent "/usr/local/lib/libnsm_linux.so" loaded successfully
[18-Jun-2009 17:21:44] Initialization of subagent "/usr/local/lib/libnsm_logwatch.so" failed
[18-Jun-2009 17:21:45] Debug: Trying to bind on 0.0.0.0:4700
[18-Jun-2009 17:21:45] Listening on socket 0.0.0.0:4700
[18-Jun-2009 17:21:46] NetXMS Agent started
[18-Jun-2009 17:21:49] Debug: Incoming connection from 10.10.64.125
[18-Jun-2009 17:21:49] Debug: Connection from 10.10.64.125 accepted
[18-Jun-2009 17:21:49] Debug: {0} Received control message CMD_GET_NXCP_CAPS
[18-Jun-2009 17:21:49] Debug: {0} Sending message CMD_NXCP_CAPS (size 16)
[18-Jun-2009 17:21:49] Debug: {0} Received message CMD_KEEPALIVE



One can easily see that logwatch subagent fails to initialize
If I remove the ExternalParameterShellExec fro mteh config file (commented out) here is the outcome:

[18-Jun-2009 17:24:18] Debug: EXEC: Executing ""/usr/local/bin/nxagentd" -c "/etc/nxagentd.conf" -d -D -X 13173"
[18-Jun-2009 17:24:18] Debug: {1} Sending message CMD_REQUEST_COMPLETED (size 32)
[18-Jun-2009 17:24:18] Debug: {1} Session with 10.10.64.125 closed
[18-Jun-2009 17:24:18] Debug: Trap sender thread terminated
[18-Jun-2009 17:24:18] Debug: {0} Session with 10.10.64.125 closed
[18-Jun-2009 17:24:19] Debug: Session Watchdog thread terminated
[18-Jun-2009 17:24:19] Debug: Listener thread terminated
[18-Jun-2009 17:24:19] NetXMS Agent stopped

[18-Jun-2009 17:24:20] Log file opened
[18-Jun-2009 17:24:20] Debug: Log file opened
[18-Jun-2009 17:24:20] Debug: Subagent API initialized
[18-Jun-2009 17:24:21] Subagent "/usr/local/lib/libnsm_linux.so" loaded successfully
[18-Jun-2009 17:24:21] Debug: LogWatch: registered parser for file /home/dk/out.txt, trace level set to 0
[18-Jun-2009 17:24:21] Subagent "/usr/local/lib/libnsm_logwatch.so" loaded successfully
[18-Jun-2009 17:24:21] Debug: LogParser: parser thread for file "/home/dk/out.txt" started
[18-Jun-2009 17:24:21] Debug: LogParser: file "/home/dk/out.txt" successfully opened
[18-Jun-2009 17:24:22] Debug: Trying to bind on 0.0.0.0:4700
[18-Jun-2009 17:24:22] Listening on socket 0.0.0.0:4700

Subagent logwatch successfully loaded.
Here is the config for the logwatch:

SubAgent = /usr/local/lib/libnsm_logwatch.so
*LOGWATCH
Parser = /home/netxms/parser/my_script_out.xml


Many thanks in advance fro your support.
Best regards,

Jdamien

jdl

Hehehe  ;D I found the fix...

I'm sure many will come across that one as well so hope you'll find this post quickly and not waste too much of your time on this issue.

Well basically, it is just about defining the things according to a certain order in the agent config file. Unfortunately I cannot explain why but probably our NetXMS gurus will do later on...

This is how I defined it in my agent config file.
The only difference is that ExternalParameterShellExec is defined RIGHT after the subagent declaration. Then and only then comes the logwatch subagent declaration.

Agent config file extract:
SubAgent = /usr/local/lib/libnsm_linux.so
ExternalParameterShellExec = TCP.SocketStatus(*):/home/netxms/scripts/socket_status.pl $1 $2

SubAgent = /usr/local/lib/libnsm_logwatch.so
*LOGWATCH
Parser = /home/netxms/parser/log_parser_n2p.xml


Agent log file extract:
[19-Jun-2009 15:57:39] Log file opened
[19-Jun-2009 15:57:39] Debug: Log file opened
[19-Jun-2009 15:57:39] Debug: Subagent API initialized
[19-Jun-2009 15:57:40] Subagent "/usr/local/lib/libnsm_linux.so" loaded successfully
[19-Jun-2009 15:57:40] Subagent "Linux" already loaded from module "/usr/local/lib/libnsm_linux.so"
[19-Jun-2009 15:57:40] Debug: LogWatch: registered parser for file /home/dk/out.txt, trace level set to 0
[19-Jun-2009 15:57:40] Subagent "/usr/local/lib/libnsm_logwatch.so" loaded successfully
[19-Jun-2009 15:57:40] Debug: LogParser: parser thread for file "/home/dk/out.txt" started
[19-Jun-2009 15:57:40] Debug: LogParser: file "/home/dk/out.txt" successfully opened
[19-Jun-2009 15:57:41] Debug: Trying to bind on 0.0.0.0:4700
[19-Jun-2009 15:57:41] Listening on socket 0.0.0.0:4700
[19-Jun-2009 15:57:42] NetXMS Agent started
...


Hope this will be of any value to someone else.

Regards & Have fun
Jdamien

Victor Kirhenshtein

Lines started with * character defines a new config section (usually subagent configuration) - and parameters allowed in each section are specific to this section. Core agent parameters should be defined in "default" section - unnamed section in the beginning of the file. Order within section is not important.

Best regards,
Victor