RLIMIT_NPROC Question

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jstormshak
Posts: 27
Joined: Mon May 04, 2020 11:41 am

RLIMIT_NPROC Question

Post by jstormshak »

Greetings...
I've looked over in this forum some of the existing NPROC issues and saw a mix of "Dev say it can safely be ignored due to wrong calcs" to others that seem to move over to executing SQL commands/tunings. With that said, my question is that with the following message in the /var/log/messages, once I added the line below into the "/etc/systemd/system/multi-user.target.wants/nagios.service" for LimitNPROC=xyz, the messages no longer are displaying.

My concern is that its only taking as an "systemd" setting and not the /etc/security/limits.d/20-nproc. Can someone confirm that this is the proper place fo the setting and will future XI upgrades overwite this file and loose the value? I speculate that it would. Thoughts?

message:
Feb 2 15:06:15 ch-nagios-p02 nagios: WARNING: RLIMIT_NPROC is 31192, total max estimated processes is 33804! You should increase your limits (ulimit -u, or limits.conf)

setting:
[Service]
LimitNPROC=46080
jstormshak
Posts: 27
Joined: Mon May 04, 2020 11:41 am

Re: RLIMIT_NPROC Question

Post by jstormshak »

When saying the systemd, I'm talking about it was placed into the /etc/systemd/system/multiuser.../nagios.service file. That I would think would be overridden/replaced on any future XI updates, etc?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: RLIMIT_NPROC Question

Post by ssax »

The reason the calculation is invalid is because nagios doesn't run all of the checks all at the same time, they are scheduled in a smart manner by default so that number is invalid.

I've created an issue on github for it:

https://github.com/NagiosEnterprises/na ... issues/857

See here for some additional information on scheduling:

https://assets.nagios.com/downloads/nag ... uling.html

EDIT: I found this that says systemd ignores the limits:

https://bugzilla.redhat.com/show_bug.cgi?id=754285
Systemd does not support global limits, the file is intentionally ignored.
Here's another good comment on there:
You can set a global limit for systemd; simply put your limit (e.g. "DefaultLimitCORE=1000000") into /etc/systemd/system.conf instead of your specific .service file, then it becomes global.

Code: Select all

/etc/security/limits.conf
/etc/security/limits.d/
If you define * in the limits.conf and * in the limits.d, the limits.d entry will override the limits.conf one.

So the limits will need to be high enough to support the service allowing that many.

What I do is this:
- NOTE: I've only done this with mariadb on EL7+ because it tells you to do it, I've never had to add them for nagios before, I only usually have to adjust the system limits for that

Code: Select all

systemctl edit nagios
Add the overrides in there:

Code: Select all

[Service]
LimitNOFILE=10000
LimitNPROC=10000
Then run these commands to pick them up:

Code: Select all

systemctl daemon-reload
NOTE: If you make changes to the limits.conf or limits.d you need to reboot to pick up the changes.

Here is what the MariaDB one that gives some good information/links:

Code: Select all

cat /usr/lib/systemd/system/mariadb.service
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades.  If you want to customize, the
# best way is to create a file "/etc/systemd/system/mariadb.service",
# containing
#       .include /lib/systemd/system/mariadb.service
#       ...make your changes here...
# or create a file "/etc/systemd/system/mariadb.service.d/foo.conf",
# which doesn't need to include ".include" call and which will be parsed
# after the file mariadb.service itself is parsed.
#
# For more info about custom unit files, see systemd.unit(5) or
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

# For example, if you want to increase mariadb's open-files-limit to 10000,
# you need to increase systemd's LimitNOFILE setting, so create a file named
# "/etc/systemd/system/mariadb.service.d/limits.conf" containing:
#       [Service]
#       LimitNOFILE=10000
Locked