Menu

Show posts

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

Messages - MarkusW

#1
General / Can't make AppAgent work
November 05, 2020, 05:20:21 PM
I'm trying to integrate AppAgent into a small C app. I'm doing a successful AppAgentInit, and then a AppAgentStart call. There are no obvious indications that it doesn't work, except that "nxappget" says "ERROR: Cannot connect to application agent" when I run it with the app name supplied in the APPAGENT_INIT struct. When configuring the local nxagentd with an AppAgent, it outputs the same error message in the logs periodically.

I've narrowed it down to the fact that it doesn't create a named pipe in /tmp as I would expect from reading the source. But I get no indication as to why. I've tried as root as well without success, so it doesn't seem to be a permission issue.

There's no helpful log output anywhere.

I'm using the libraries from NetXMS 3.5.152 source package on a Ubuntu 18.04 machine.

Init data:

static APPAGENT_INIT m_info =
{
        _T("VRECLIENT"),
        _T("root"),
        handleMessage,
        logger,
        1,
        m_parameters,
        0,
        NULL,
        0,
        NULL
};


The call in main():
        printf("Initializing AppAgent...\n");
        if (!AppAgentInit(&m_info))
        {
                printf("Init failed!\n");
        }
        printf("Starting AppAgent...\n");
        AppAgentStart();


At this point I start the rest of the application logic, which works well. But the AppAgent part just won't work. I'm not even sure that the pipe listener thread is running at all, and I'm not sure how to check it.

Do you have any hints on where to look for faults?

Thank you in advance!
#2
I got it working. Installed Eclipse, which required Java 8. Installed Java 8, and now NetXMS Console works as expected.

#3
I just got a new Macbook which I upgraded to macOS 10.13 High Sierra before installing anything else.

Then I downloaded NetXMS Console 2.1.1. At first start it prompted me to install Java 6, which I did. After that, startup fails with a generic "An error has occurred" message and a reference to a log file (attached).

Am I missing a dependency or something? I can't remember needing anything else than Java for my previous machine.

Thank you in advance!
#4
Quote from: Victor Kirhenshtein on January 24, 2017, 08:17:28 PM
just tested in on Windows - works as expected.

I did some further testing on different nodes. Process.CountEx works as expected on Windows 8.1 Pro, but not on Windows 7 Home Premium (don't ask, not my system design  :o ).

Is the Windows subagent supposed to be generic, or do you have a specific version subset that is supported?
#5
Quote from: Victor Kirhenshtein on January 25, 2017, 10:07:57 AM
Remember that second argument is regular expression, so certain characters have special meaning. For example, \ is an escape character, so to match it you should specify it as \\. As for class name you're probably right - agent extracts only first 255 characters of process command line. I'll fix that in next release.

Best regards,
Victor

Thank you. I have not used any special characters in the second argument.

I just did some testing. The class path of one of the java processes contains the word "symmetric".

Process.CountEx(java) returns 2 as expected.
Process.CountEx(java,symmetric) returns 0.
Process.CountEx(java,s) returns 1, even though the character "s" is present in the command line of both java processes.
Process.CountEx(java,sy) returns 0.
Process.CountEx(java,.) returns 1.

Process.CountEx(java,_) returns 1 even though _ is not present in either command line.

It seems no matter what I put as matching pattern, CountEx returns 0 if the pattern is longer than one character (other than regex special chars), and 1 if the pattern is one character.

Any ideas?

#6
Quote from: Victor Kirhenshtein on January 24, 2017, 08:17:28 PM
Hi,

just tested in on Windows - works as expected. Please provide exact details - process name and command line and how you specify Process.CountEx parameter.

Best regards,
Victor

Thanks for your reply.

There are two Java processes running on the agent host.

The process I need to monitor has a long command line (700+ chars), mostly consisting of class path declarations and jvm arguments. I can't give the exact details, but it looks basically like this:

"java" -cp "C:\SomePath1\;C:\SomePath2\;C:\SomePath3" -DsomeJvmArg1=someValue1 -DsomeJvmArg2=someValue2 com.domain.package.ClassName --someArg someValue

The above is what comes up when I run the PowerShell command
WMIC path win32_process get Commandline | select-string ClassName

Process.CountEx(java) returns "2" as expected.

Process.CountEx(java,ClassName) returns "0". I understand this might be because the command line is longer than the MAX_PATH defined in the source code? Since ClassName appears at the end of the long command line.

However:

Process.CountEx(java, SomePath1) also returns 0. As does any attempt to match on anything at the beginning of the command line.

The Windows host seems to be a 32 bit system.
#7
I see now in the docs that CountEx should be able to match the command line as well. It does not work for me unfortunately.

Process.CountEx(java, <Java class name>) still returns 0. Is there some subtle feature here that I'm missing?

NetXMS agent version is 2.0.6. Agent is running on a Windows 7 host.
NetXMS server version is 2.0.3.
#8
General Support / Powershell commands in Agent config
January 18, 2017, 11:46:36 AM
I need to monitor a java process on some Windows hosts with the NetXMS Agent installed and running. The regular Process.Count and Process.CountEx only work for the process name, which is "java". This is not enough for my needs, since I need to make sure that java is run with certain arguments.

In linux, I would simply to a ps aux | grep <Java class or jar name> | wc -l which works for all user permissions.

I'm not very familiar with neither Windows nor Powershell, but I did manage to construct this one-liner for doing (sort of) the same thing:

(WMIC path win32_process get Commandline | select-string <Java class name>).Matches.count

This command returns the number of matches, or null if none were found.

This works when I manually start a powershell with elevated permissions. It does not work through an ExternalParameter in the Agent though. When querying in the DCI config it returns "" even when the process is running. Is this because powershell commands are not run with elevated privileges? The agent itself is run elevated as far as I know.

The full external parameter line in the config looks like this:
ExternalParameter = ProcMon.SymmetricLauncher:powershell -Command "& {(WMIC path win32_process get Commandline | select-string <Java class name>).Matches.count}"

I also tried ExternalParameterShellExec, but it didn't work either.

Are there any simple solutions to my problem?
#9
Quote from: Alex Kirhenshtein on November 07, 2013, 12:19:06 PM
It seems to be related to Apple's Gatekeeper: http://support.apple.com/kb/ht5290


Indeed. I had the same problem. Turning off Gatekeeper did work. It's fine as a temporary work-around, but a real fix would be appreciated.
#10
It seems this is planned for the next release (1.2.9)

https://www.radensolutions.com/chiliproject/issues/309
#11
General / Re: Contributing code
September 03, 2013, 11:39:39 AM
I have submitted a small patch in ticket #332 now.

Looking forward to the git migration by the way. Already in its vanilla implementation it's awesome for collaboration. :)
#12
General / Re: Contributing code
September 02, 2013, 11:11:51 PM
Sounds good, thanks for the reply!
#13
General / Contributing code
September 02, 2013, 01:44:49 PM
I have been using NetXMS for a long time, and I think it's a great piece of software! As is customary in the open source community, I'd love to show my appreciation by contributing code to the project. So my questions are:

1) Do you have any established routines/workflow for submitting patches, documentation or otherwise?

2) Have you considered migrating to GitHub (or equivalent) for easier collaboration and broader project visibility?

Thanks in advance!
#14
Announcements / Re: NetXMS 1.0.13 released
October 30, 2011, 11:27:11 AM
I would also like to know if there is a time estimate on the release of 1.2. We are planning a long overdue update from 1.0.4 on 1500+ nodes of a production system, and if 1.2 comes soon we may decide to wait for it.
#15
Awesome, thanks!