# how to increase RLIMIT_NPROC? [solved]

## Majed17

When i restart nagios and check its status, i get:

```
WARNING: RLIMIT_NPROC is 15689, total max estimated processes is 16494! You should increase your limits (ulimit -u, or limits.conf)
```

i have pam in use flags.

i tried setting:

in /etc/login.defs

```
# The ERASECHAR and KILLCHAR are used only on System V machines.

# The ULIMIT is used only if the system supports it.

# (now it works with setrlimit too; ulimit is in 512-byte units)

#

# Prefix these values with "0" to get octal, "0x" to get hexadecimal.

#

ERASECHAR   0177

KILLCHAR   025

ULIMIT      2097152
```

and rebooted..

and nothing changed

then i added in /etc/security/limits.conf

```
nagios          soft     nproc          unlimited
```

rebooted

and still the same behavior

what to do?

----------

## alamahant

Please try this

```

nagios         -    nproc     unlimited

```

or

```

nagios          hard     nproc          unlimited

nagios          soft     nproc          unlimited

```

or

```

*         -    nproc     unlimited

```

for all domains/users

Apparently the unlimited option applied to the soft value for a domain cannot go beyond its hard limit.

----------

## Majed17

man i tried, 

*         -    nproc     unlimited 

now:

```
ulimit -Hn

524288

ulimit -n

1024

ulimit -u

unlimited

```

but still when restarting nagis, the nag remains:

```
WARNING: RLIMIT_NPROC is 15689, total max estimated processes is 16494!You shou
```

knowing that the systemd nagios service is self made:

```
[Unit]

Description=Nagios

BindTo=network.target

[Install]

WantedBy=multi-user.target

[Service]

#LimitNOFILE=65536

User=nagios

Group=nagios

Type=simple

ExecStart=/usr/sbin/nagios /etc/nagios/nagios.cfg
```

----------

## alamahant

```

systemctl daemon-reload

```

----------

## Majed17

nope, 

still there

and usually if a service has been updated and you restart it, it explicitly states that it needs a daemon reload

----------

## alamahant

```

cat  /proc/sys/fs/file-max

echo "fs.file-max=200000" > /etc/sysctl.d/system-ulimit.conf

sysctl -p /etc/sysctl.d/system-ulimit.conf

```

----------

## Majed17

```
cat  /proc/sys/fs/file-max 

9223372036854775807
```

there is no system-ulimit.conf  in /etc/sysctl.d

so i created it and put there

```
fs.file-max = 200000
```

 now it produces

```
sudo sysctl -p /etc/sysctl.d/system-ulimit.conf

fs.file-max = 200000
```

and still the nag

----------

## alamahant

Even with

*         -    nproc     unlimited

?

----------

## Majed17

yeah

```
#<domain>      <type>  <item>         <value>

#

#*               soft    core            0

#*               hard    rss             10000

#@student        hard    nproc           20

#@faculty        soft    nproc           20

#@faculty        hard    nproc           50

#ftp             hard    nproc           0

#@student        -       maxlogins       4

*              -         nproc          unlimited

# End of file
```

mentioning that emerging nagios did not create the systemd service file for

----------

## alamahant

systemd totally disregards the limits set in /etc/security...

Its a thug in that and many other respects.

Try

```

LimitNOFILE=200000

LimitNPROC=200000

```

in systemd nagios service you created.

plus a daemon-reload...

 :Smile: 

----------

## Majed17

hmm seems like you learned something new...

it worked man! just like a miracle!

----------

## Krnos2022

 *Majed17 wrote:*   

> hmm seems like you learned something new...
> 
> it worked man! just like a miracle!

 

There's another simple way. If you read the warning limit, there is a hint on that line that said [You should increase your limits (ulimit -u, or limits.conf)] 

Next step to do is:

```
 ulimit -u 20000 
```

and you are done   :Very Happy:  [/code]

----------

## Hu

 *Krnos2022 wrote:*   

> There's another simple way. If you read the warning limit, there is a hint on that line that said [You should increase your limits (ulimit -u, or limits.conf)] 
> 
> Next step to do is:
> 
> ```
> ...

 As I read the rest of this thread, that was not the right solution, because ulimit is a shell directive, and the problem was that the system service manager was starting Nagios with a bad limit.  Changing the interactive shell's limit will not help with that.  Instructing the system service manager to use an alternate limit does help, and was the solution found last year.

----------

