NetXMS Support Forum

English Support => General Support => Topic started by: Egert143 on April 21, 2020, 12:21:08 PM

Title: Linux process monitoring
Post by: Egert143 on April 21, 2020, 12:21:08 PM
Hello

Linux(ubuntu server edition) beginner here, In short i wanted to test ELK Stack and Netxms to monitor its state. Got elk running but i cant figure it out, how to monitor linux "services".

i start them with commands:

sudo systemctl start nxagentd.service
sudo systemctl start elasticsearch.service
sudo systemctl start kibana.service
sudo systemctl start logstash.service
sudo service keepalived start

in NetXms i tryed adding: DCI System.ProcessCount("nxagentd.service") but it returns as unsupported.

Any hints? :)
Title: Re: Linux process monitoring
Post by: gmonk63 on April 22, 2020, 05:30:17 AM
Not sure netxms would monitor all you need.  Have you tried https://www.elastichq.org/features.html   it does have an api that you could probly incorporate into netxms if really needed
Title: Re: Linux process monitoring
Post by: Egert143 on April 22, 2020, 08:31:09 AM
Looks intresting il give it a try. But any hints on original question for simple service monitoring ? :)
Title: Re: Linux process monitoring
Post by: Filipp Sudanov on April 22, 2020, 11:15:15 AM
nxagentd.service is the file name for systemd scripts, not the name of actual process. The process name is visible in command like top, ps, for netxms agent it's nxagentd.
Title: Re: Linux process monitoring
Post by: Egert143 on April 22, 2020, 03:57:51 PM
For NetXms i got it working, but looking from "top" the ELK processes are all java, only different user.

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
2462 elastic+  20   0 3379664 1.457g 173544 S  8.3 75.0  23:30.87 java
3454 logstash  39  19 3318852 222712  12784 S  1.3 10.9   4:06.48 java
  922 kibana    20   0 1701224  62008   6984 S  0.7  3.0   4:01.10 node
Title: Re: Linux process monitoring
Post by: Filipp Sudanov on April 23, 2020, 01:03:54 AM
There is Process.CountEx() metric, that should allow to filter processes by the command line that was used to launch them.
https://www.netxms.org/documentation/adminguide/appendix.html#process-countex

You can find the command line by running
px fax

Filtering is done with the help of regular expression. You can test your regular expression here: https://regex101.com/
Title: Re: Linux process monitoring
Post by: Egert143 on April 23, 2020, 08:40:47 AM
Thanks for the tip. Gave it a try:

From ps fox i got:

  922 ?        Ssl   14:57 /usr/share/kibana/bin/../node/bin/node /usr/share/kibana/bin/../src/cli -c /etc/kibana/kibana.yml
3454 ?        SNsl  14:49 /usr/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Djava.awt.headless=true -Dfile.
2462 ?        SLsl  49:45 /usr/share/elasticsearch/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headle


Then i played litle bit with regex tester:

Match string and regex = \/kibana\/

/usr/share/kibana/bin/../node/bin/node /usr/share/kibana/bin/../src/cli -c /etc/kibana/kibana.yml

But in NetXms i get 0 results no matter what formating i use in dci:
Process.CountEx("/kibana/", "\/kibana\/")


Title: Re: Linux process monitoring
Post by: Filipp Sudanov on April 28, 2020, 01:20:28 AM
First parameter of CountEx should be process name which is actually "node".
Try something like this:
Process.CountEx("node", "\/kibana\/")
Title: Re: Linux process monitoring
Post by: Egert143 on April 28, 2020, 08:47:31 AM
Thanks, that worked. :)