NAME

Monitoring::Sneck::Checks::procs - checks how many processes are running

VERSION

Version 0.0.1

SYNOPSIS

sshd_running|perl:procs -C sshd
php_fpm|perl:procs -C php-fpm -w 2:50 -c 1:100
worker|perl:procs -r 'bin/worker --queue mail' -u www -c 1:1
zombies|perl:procs -s Z -w 0 -c 5
java_rss|perl:procs -C java --rss-warning 4096 --rss-critical 6144
runaway|perl:procs -u www --cpu-warning 80 --cpu-critical 95 -c 0:

DESCRIPTION

Counts the processes matching all of the filters given, through Proc::ProcessTable, and checks the count against the ranges. By default, none matching is CRITICAL. sneck itself is never counted.

--command is the process name. Linux cuts it to 15 characters, so match longer names with --regex.

--rss-warning and the like check each matching process, the one using the most being said. CPU is the percent over its whole life, as ps shows it, not right now, so a process that only just started spinning takes a while to show it.

OPTIONS

- -C, --command :: The process name, exactly.

- -r, --regex :: A regex matched against the whole command line, so matching anywhere in it is enough.

- -u, --user :: The user it runs as, by name or UID.

- -s, --state :: Its state, one of R, running, S, sleeping, D, waiting on IO, Z, zombie, T, stopped, or I, idle.

- -w, --warning :: Range for the count.

- -c, --critical :: Range for the count. Default :: 1:

- --rss-warning :: Range of MiB of memory for each process.

- --rss-critical :: Range of MiB of memory for each process.

- --cpu-warning :: Range of percent CPU for each process.

- --cpu-critical :: Range of percent CPU for each process.

- --fd-warning :: Range of percent of its open file limit each process is using. Linux only, as it reads /proc. UNKNOWN elsewhere.

- --fd-critical :: Range of percent of its open file limit each process is using. Linux only, the same as --fd-warning.

METHODS

check

Does the check.

fd_use

Works out how much of its open file limit a process is using, from /proc/PID/fd and the soft limit in /proc/PID/limits. Seeing other users' processes needs root.

Returns a hash ref of open, limit, and percent, or undef if it can not be read or has no limit.