Memory consumption in 2.0b3

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.gov.au
Thu Apr 21 07:15:46 CEST 2005


Dear Sir,

I am writing to thank you for your letter and say,

On Wed, Apr 20, 2005 at 08:11:13PM -0700, nagios-users-request at lists.sourceforge.net wrote:
> 
> Message: 4
> Date: Wed, 20 Apr 2005 08:51:39 +0200
> From: "Schimpke, Dr. Thomas / bhn" <Schimpke.Thomas at bhn-services.com>
> To: "Nagios User List" <nagios-users at lists.sourceforge.net>
> Subject: [Nagios-users] Memory consumption in 2.0b3
> 
> 
> --=-JRB1Bxf01FPblohGHfpJ
> Content-Type: text/plain
> Content-Transfer-Encoding: quoted-printable
> 
> Hi all,
> 
> I think it was already mentioned here, but I'm not sure:
> nagios 2.0b3 (at least) consumes *lots* of memory if running for several
> days. Now the binary consumes about 84 MB, the output of=20
> ps -e -o pid,cmd,%mem,rss,trs,sz,vsz:
> 
>  PID CMD              %MEM  RSS  TRS    SZ   VSZ
> 10512 /usr/local/nagio  8.3 86148 362 27254 109016
> 24937 /usr/local/nagio  8.3 86152 362 27255 109020
> 
> For one running binary, that wouldn't be much of a problem, but since
> nagios forks to execute the service checks, I sometimes have some 10 of
> this processes running (142 hosts, 921 services).=20
>

For this Nag hacked 2.0b3 with the memory pig of champions - embedded 
Perl - FreeBSD 4.11-RELEASE

tsitc> ps -o pid,command,%mem,rss,tsiz,vsz -U nagios 
  PID COMMAND          %MEM  RSS TSIZ   VSZ
44558 /usr/local/nagio  6.3 16272  368 18516
44561 sh -c /usr/local  0.1  272  424   632
44562 /usr/local/nagio  6.3 16272  368 18516
44564 sh -c /usr/local  0.1  272  424   632
44565 /usr/local/nagio  0.2  560   20   980
44566 /usr/local/nagio  0.2  564   20   984
44567 /usr/local/nagio  6.3 16272  368 18516
44568 /sbin/ping -n -c  0.1  192  184   460
44569 /sbin/ping -n -c  0.1  192  184   460
44570 sh -c /usr/local  0.1  272  424   632
44572 /usr/local/nagio  0.2  560   20   980
44573 /usr/local/nagio  6.3 16272  368 18516
44574 sh -c /usr/local  0.1  272  424   632
44575 /sbin/ping -n -c  0.1  192  184   460
44576 /usr/local/nagio  0.2  560   20   980
44577 /sbin/ping -n -c  0.1  192  184   460
62195 /usr/local/nagio  6.3 16244  368 18516
tsitc> 


This is for a Nag only running 0d 15h 40m 48s.

It has 50-60 Perl plugins (custom memory pigs) and runs 

Service Check Execution Time:	0.00 / 76.28 / 4.273 sec
Service Check Latency:	0.00 / 5.36 / 0.203 sec
Host Check Execution Time:	0.02 / 3.60 / 0.155 sec
Host Check Latency:	0.00 / 0.00 / 0.000 sec
# Active Host / Service Checks:	196 / 665
# Passive Host / Service Checks:	0 / 91

quite well.

The rate of memory increase (leak) for this leaky embedded Perl Nagios 
is (so far) about 

Thu Apr 21 13:00:01 EST 2005: Checking if memory size of Nagios process 
>= 40000 kB.
WARNING (VSZ>-1): 18484 18484
Thu Apr 21 13:00:03 EST 2005: No restart necessary.

Thu Apr 21 13:20:01 EST 2005: Checking if memory size of Nagios process 
>= 40000 kB.
WARNING (VSZ>-1): 18492 18492
Thu Apr 21 13:20:03 EST 2005: No restart necessary.

Thu Apr 21 13:40:00 EST 2005: Checking if memory size of Nagios process 
>= 40000 kB.
WARNING (VSZ>-1): 18500 18500 18500 18500 18500 18500 18500 18500
Thu Apr 21 13:40:02 EST 2005: No restart necessary.

Thu Apr 21 14:00:00 EST 2005: Checking if memory size of Nagios process 
>= 40000 kB.
WARNING (VSZ>-1): 18508 18508 18508 18508 18508 18508
Thu Apr 21 14:00:02 EST 2005: No restart necessary.

8 kB/hour ~ 200 kB/day or 2 MB each 10 days.

This 2.0b3 is hacked but only in the (very limited) parts of the code 
that handle embedded Perl (the patches are <= 100 lines and unlikely to 
influence memory use _except_ by embedded Perl Nagios).

If you are running embedded Perl, you are welcome to test the patches.
 
> Nagios is running on a DL 360 with only 1 GB memory (and 2 GB swap). We
> noticed, that the swap was (after 4 days or so) was completely used and
> never freed, BUT that might have been an apache problem together with
> mod_ntlm. I'm checking that right now.=20

You may have to do what those that relie on embedded Perl Nag 2.x do, 
namely, monitor vsz (check_procs etc) and restart if the mem usage is 
over threshold.

BTW, this Nag is running on a Celeron 8xx and with only 256 MB RAM. It 
doesn't run other apps but its performing Ok.

> 
> I've added some more swap space (another 2 GB). I think, there should be
> a hint in the docs: "add swap" or better "buy memory..."
> 

That hasn't been my experience with a smaller (but non trivial) Nag with 
2.0b3.

The same box also hosts

smslink
apache/mod_perl
small sendmail relay
small nfs/amd
snmptrapd

Yours sincerely.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: disclaimer.txt
URL: <https://www.monitoring-lists.org/archive/users/attachments/20050421/c3af5150/attachment.txt>


More information about the Users mailing list