Linux process monitoring

Started by Egert143, April 21, 2020, 12:21:08 PM

Previous topic - Next topic

Egert143

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? :)

gmonk63

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

Egert143

Looks intresting il give it a try. But any hints on original question for simple service monitoring ? :)

Filipp Sudanov

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.

Egert143

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

Filipp Sudanov

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/

Egert143

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\/")



Filipp Sudanov

First parameter of CountEx should be process name which is actually "node".
Try something like this:
Process.CountEx("node", "\/kibana\/")

Egert143