AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.138.120.122
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/munin/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /usr/share/munin/plugins/multips
#!/usr/bin/sh
# -*- sh -*-

: <<=cut

=head1 NAME

multips - Munin plugin to monitor number of processes. Which processes
are configured in client-conf.d

=head1 APPLICABLE SYSTEMS

Any system with a pgrep, /usr/ucb/ps or other UCB compatible ps command.

=head1 CONFIGURATION

There is no default configuration.  This is an example:

  [multips]
     env.names pop3d imapd sslwrap
     env.regex_imapd ^[0-9]* imapd:
     env.regex_pop3d ^[0-9]* pop3d:

The regex parts are not needed if the name given in "names" can be
used to grep with directly.

=head1 INTERPRETATION

This plugin simply counts the total number of processes matching the
configured regular expressions.  The regular expressions are
interpreted by "grep" (and not grep -E or perl).

=head1 MAGIC MARKERS

  #%# family=manual
  #%# capabilities=autoconf


=head1 BUGS

None known

=head1 AUTHOR

Unknown

=head1 LICENSE

GPLv2

=cut

. "$MUNIN_LIBDIR/plugins/plugin.sh"


names=${names:-}


if [ "$1" = "autoconf" ]; then
	if [ -z "$names" ]; then
		echo "no (Configuration required)"
	else
		echo yes
	fi
	exit 0
fi

if [ -z "$names" ]; then
  echo "Configuration required"
  exit 1
fi

if [ "$1" = "config" ]; then

	echo graph_title Number of selected processes
	echo 'graph_category processes'
	echo 'graph_args --base 1000 --vertical-label processes -l 0'
	for name in $names; do
		fieldname=$(clean_fieldname "$name")
		eval REGEX='"${regex_'"$name"'-\<'"$name"'\>}"'

		echo "$fieldname.label $name"
		echo "$fieldname.draw LINE2"
		echo "$fieldname.info Processes matching this regular expression: /$REGEX/"
		print_warning "$fieldname"
		print_critical "$fieldname"
	done
	exit 0
fi

for name in $names; do
        fieldname=$(clean_fieldname "$name")
	printf "%s.value " "$fieldname"

	eval REGEX='"${regex_'"$name"'-\<'"$name"'\>}"'
	PGREP=$(command -v pgrep)
	if [ -n "$PGREP" ] && [ -x "$PGREP" ]; then
		"$PGREP" -f -l "$name" | grep "$REGEX" | wc -l
	elif [ -x /usr/ucb/ps ]; then
		# Solaris without pgrep. How old is that?
		/usr/ucb/ps auxwww | grep "$REGEX" | grep -v grep | wc -l
	else
		ps auxwww | grep "$REGEX" | grep -v grep | wc -l
	fi
done

Anon7 - 2022
AnonSec Team