Memory usage monitoring for process
-
kalyanpabolu
- Posts: 246
- Joined: Fri Jul 03, 2020 4:18 am
Memory usage monitoring for process
Hi Team,
In one of production server, one particular service consuming more memory and crashing application.
We would like to monitor the memory usage of particular service and alert if memory reaches beyond a certain limit.
I checked few plugins for this but it needs NSClient++.
We are monitoring that server using nrpe agent.
Can you please suggest a plugin to use nrpe and monitor the memory usage of that process?
The server is Linux server.
Thanks in advance!!
In one of production server, one particular service consuming more memory and crashing application.
We would like to monitor the memory usage of particular service and alert if memory reaches beyond a certain limit.
I checked few plugins for this but it needs NSClient++.
We are monitoring that server using nrpe agent.
Can you please suggest a plugin to use nrpe and monitor the memory usage of that process?
The server is Linux server.
Thanks in advance!!
Re: Memory usage monitoring for process
This should work:
https://exchange.nagios.org/directory/P ... ge/details
Installing it:
nrpe.cfg entry:
Calling from XI server:
https://exchange.nagios.org/directory/P ... ge/details
Installing it:
Code: Select all
curl -k -L 'https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=6147&cf_id=24' -o /usr/local/nagios/libexec/check_proc_mem.sh
chown nagios.nagios /usr/local/nagios/libexec/check_proc_mem.sh
chmod ug+x /usr/local/nagios/libexec/check_proc_mem.shCode: Select all
command[check_proc_mem]=/usr/local/nagios/libexec/check_proc_mem.sh $ARG1$Code: Select all
/usr/local/nagios/libexec/check_nrpe -H X.X.X.X -c check_proc_mem -a '-w 1024 -c 2048 --cmdpattern "sshd"'-
kalyanpabolu
- Posts: 246
- Joined: Fri Jul 03, 2020 4:18 am
Re: Memory usage monitoring for process
Hello,
Thank you for your reply!!
The plugin you suggested is working fine.
Can we monitor the memory utilization of a service running on Windows server? We have NSClient++ on the Windows server.
Service name: Infor WM Socket Server wmprd-socket1
I checked the below post and tried to check the memory usage for the service:
https://support.nagios.com/forum/viewto ... 6&start=10
But, I am getting below error:
[root@monprdmgtss03 plugins]# ./check_nrpe -n -H 10.50.10.51 -p 5666 -t 60 -c CheckCounter -a "Counter:InforWMSocketServerwmprd-socket1memusage=\Process(Infor WM Socket Server wmprd-socket1)\Private bytes" ShowAll
CHECK_NRPE: Error receiving data from daemon.
[root@monprdmgtss03 plugins]#
I also tried checing the process which is running in backend of this service. It is JBossService.exe. I tried checking that process as well but got the same error.
[root@monprdmgtss03 plugins]# ./check_nrpe -n -H 10.50.10.51 -p 5666 -t 60 -c CheckCounter -a "Counter:JavaServicememusage=\Process(JavaService)\Private bytes" ShowAll CHECK_NRPE: Error receiving data from daemon.
[root@monprdmgtss03 plugins]#
Fyi, we have already changed below value to 1 in nsclient cfg file.
# COMMAND ALLOW NASTY META CHARS
; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow_nasty_meta_chars=1
Please let me know if you need any details.
We want to monitor memory usage for a service running on Windows serever, NSClient++ is installed on that Winows server.
Thank you for your reply!!
The plugin you suggested is working fine.
Can we monitor the memory utilization of a service running on Windows server? We have NSClient++ on the Windows server.
Service name: Infor WM Socket Server wmprd-socket1
I checked the below post and tried to check the memory usage for the service:
https://support.nagios.com/forum/viewto ... 6&start=10
But, I am getting below error:
[root@monprdmgtss03 plugins]# ./check_nrpe -n -H 10.50.10.51 -p 5666 -t 60 -c CheckCounter -a "Counter:InforWMSocketServerwmprd-socket1memusage=\Process(Infor WM Socket Server wmprd-socket1)\Private bytes" ShowAll
CHECK_NRPE: Error receiving data from daemon.
[root@monprdmgtss03 plugins]#
I also tried checing the process which is running in backend of this service. It is JBossService.exe. I tried checking that process as well but got the same error.
[root@monprdmgtss03 plugins]# ./check_nrpe -n -H 10.50.10.51 -p 5666 -t 60 -c CheckCounter -a "Counter:JavaServicememusage=\Process(JavaService)\Private bytes" ShowAll CHECK_NRPE: Error receiving data from daemon.
[root@monprdmgtss03 plugins]#
Fyi, we have already changed below value to 1 in nsclient cfg file.
# COMMAND ALLOW NASTY META CHARS
; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow_nasty_meta_chars=1
Please let me know if you need any details.
We want to monitor memory usage for a service running on Windows serever, NSClient++ is installed on that Winows server.
Re: Memory usage monitoring for process
What version of NSClient++ are you running? You can find it listed next to the program in programs and features in the Control Panel.
Try this:
Taken from here:
https://support.nagios.com/kb/article/p ... _resources
Try this:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 10.25.14.2 -c check_process -a process=JavaService.exe 'warn= virtual > 100m' 'crit= virtual > 200M' detail-syntax='${exe} Virtual: ${virtual}' show-allhttps://support.nagios.com/kb/article/p ... _resources
-
kalyanpabolu
- Posts: 246
- Joined: Fri Jul 03, 2020 4:18 am
Re: Memory usage monitoring for process
Hello,
I am getting below error:
[root@monprdmgtss03 plugins]# ./check_nrpe -H 10.50.10.51 -c check_process -a process=JavaService.exe 'warn= virtual > 100m' 'crit= virtual > 200M' detail-syntax='${exe} Virtual: ${virtual}' show-all
UNKNOWN: No handler for that command
[root@monprdmgtss03 plugins]#
PFA the nsclient file for your reference.
NSClient++ version: 0.3.9
I also tried other plugin - check_process_memory.sh
I am getting OK in output but no values returned.
[root@monprdmgtss03 plugins]# ./check_process_memory.sh -H 10.50.10.51 -p 12489 -P JavaService.exe -w 50000 -c 100000
OK: Used Memory of JavaService.exe: 0 MB|UsedMemory=0;50000;100000;;
[root@monprdmgtss03 plugins]#
I can confirm its not 0 MB.
Can you please help us on the same.
I am getting below error:
[root@monprdmgtss03 plugins]# ./check_nrpe -H 10.50.10.51 -c check_process -a process=JavaService.exe 'warn= virtual > 100m' 'crit= virtual > 200M' detail-syntax='${exe} Virtual: ${virtual}' show-all
UNKNOWN: No handler for that command
[root@monprdmgtss03 plugins]#
PFA the nsclient file for your reference.
NSClient++ version: 0.3.9
I also tried other plugin - check_process_memory.sh
I am getting OK in output but no values returned.
[root@monprdmgtss03 plugins]# ./check_process_memory.sh -H 10.50.10.51 -p 12489 -P JavaService.exe -w 50000 -c 100000
OK: Used Memory of JavaService.exe: 0 MB|UsedMemory=0;50000;100000;;
[root@monprdmgtss03 plugins]#
I can confirm its not 0 MB.
Can you please help us on the same.
You do not have the required permissions to view the files attached to this post.
Re: Memory usage monitoring for process
Are there multiple JavaService running on that system? Does this one work for you?
Please send me your check_process_memory.sh file so I can see what it supports.
Code: Select all
[root@xid libexec]# ./check_nrpe -2 -H X.X.X.X -p 5666 -t 60 -c CheckCounter -a 'Counter:TEST=\Process(spoolsv)\Private bytes'
OK all counters within bounds.|'TEST'=7733248-
kalyanpabolu
- Posts: 246
- Joined: Fri Jul 03, 2020 4:18 am
Re: Memory usage monitoring for process
Hello,
Yes, there are multiple JavaService running. The command provided by you works fine.
[root@monprdmgtss03 plugins]# ./check_nrpe -H 10.50.10.51 -p 5666 -t 60 -c CheckCounter -a 'Counter:TEST=\Process(spoolsv)\Private bytes'
OK all counters within bounds.|'TEST'=17088512
[root@monprdmgtss03 plugins]#
Also, I tried replacing the process with JavaService as bellow:
[root@monprdmgtss03 plugins]# ./check_nrpe -H 10.50.10.51 -p 5666 -t 60 -c CheckCounter -a 'Counter:JavaService=\Process(JavaService)\Private bytes' ShowAll
OK: JavaService: 9.44071e+008|'JavaService'=944070656
I did not understand what above command is doing. Could you please explain?
I am attaching check_process_memory.sh file for your reference.
Yes, there are multiple JavaService running. The command provided by you works fine.
[root@monprdmgtss03 plugins]# ./check_nrpe -H 10.50.10.51 -p 5666 -t 60 -c CheckCounter -a 'Counter:TEST=\Process(spoolsv)\Private bytes'
OK all counters within bounds.|'TEST'=17088512
[root@monprdmgtss03 plugins]#
Also, I tried replacing the process with JavaService as bellow:
[root@monprdmgtss03 plugins]# ./check_nrpe -H 10.50.10.51 -p 5666 -t 60 -c CheckCounter -a 'Counter:JavaService=\Process(JavaService)\Private bytes' ShowAll
OK: JavaService: 9.44071e+008|'JavaService'=944070656
I did not understand what above command is doing. Could you please explain?
I am attaching check_process_memory.sh file for your reference.
You do not have the required permissions to view the files attached to this post.
Re: Memory usage monitoring for process
It's checking the Private bytes performance counter through NRPE to NSClient++ that Windows is reporting. It's returning whatever the counter is returning, you can see a good description of what private bytes is here:[root@monprdmgtss03 plugins]# ./check_nrpe -H 10.50.10.51 -p 5666 -t 60 -c CheckCounter -a 'Counter:JavaService=\Process(JavaService)\Private bytes' ShowAll
OK: JavaService: 9.44071e+008|'JavaService'=944070656
I did not understand what above command is doing. Could you please explain?
https://stackoverflow.com/a/1986486
Does this one work for you?
Code: Select all
./check_process_memory.sh -H 10.50.10.51 -p 12489 -P JavaService -w 50000 -c 100000-
kalyanpabolu
- Posts: 246
- Joined: Fri Jul 03, 2020 4:18 am
Re: Memory usage monitoring for process
Hello,
This is working fine for me. The only thing I am unable to understand is there is approx 10 MB difference in output. If you see the output below:
[root@monprdmgtss03 plugins]# ./check_process_memory.sh -H 10.50.10.51 -p 12489 -P JavaService -w 1000 -c 5000
WARNING: Used Memory of JavaService: 1232 MB|UsedMemory=1232;1000;5000;;
[root@monprdmgtss03 plugins]#
The output shows 1232 MB usage. At the same time, I checked in server and it shows different output. I am attaching the screenshot of the same for your reference.
This is working fine for me. The only thing I am unable to understand is there is approx 10 MB difference in output. If you see the output below:
[root@monprdmgtss03 plugins]# ./check_process_memory.sh -H 10.50.10.51 -p 12489 -P JavaService -w 1000 -c 5000
WARNING: Used Memory of JavaService: 1232 MB|UsedMemory=1232;1000;5000;;
[root@monprdmgtss03 plugins]#
The output shows 1232 MB usage. At the same time, I checked in server and it shows different output. I am attaching the screenshot of the same for your reference.
You do not have the required permissions to view the files attached to this post.
Re: Memory usage monitoring for process
The plugin is looking at the working set, task manager is using private bytes:
I guess you could try changing this line in the plugin:
To this:
And see if that now matches.
I guess you could try changing this line in the plugin:
Code: Select all
perfcount_value="Working Set"Code: Select all
perfcount_value="Private Bytes"