Repository
Munin (contrib)
Last change
2020-04-21
Graph Categories
Family
auto
Capabilities
Keywords
Language
Shell
License
GPL-2.0-only
Authors

apache_tmemmory

Name

apache_tmemmory - Indicate the total memory used by apache

Configuration

[apache_*] env.apuser user_running_apache (default: “www-data”) env.binname apache_binary_name (default: “apache2”)

Author

Ricardo Fraile rfrail3@yahoo.es

License

GPLv2

Magick Markers

#%# family=auto
#%# capabilities=autoconf
#!/bin/sh
# -*- sh -*-

: << =cut

=head1 NAME

apache_tmemmory - Indicate the total memory used by apache

=head1 CONFIGURATION

[apache_*]
env.apuser user_running_apache (default: "www-data")
env.binname apache_binary_name (default: "apache2")

=head1 AUTHOR

Ricardo Fraile <rfrail3@yahoo.es>

=head1 LICENSE

GPLv2

=head1 MAGICK MARKERS

 #%# family=auto
 #%# capabilities=autoconf

=cut

. "$MUNIN_LIBDIR/plugins/plugin.sh"

USR=${apuser:-www-data}
PROCS=${binname:-apache2}


if [ "$1" = "autoconf" ]; then
    echo yes
    exit 0
fi

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

    echo 'graph_title Total memory used by apache'
    echo 'graph_args --base 1024 -l 0 '
    echo 'graph_vlabel bytes'
    echo 'graph_scale no'
    echo 'graph_category webserver'
    echo 'graph_info Indicate the total memory used by apache.'

    echo "servers.label servers"
    echo "servers.type GAUGE"
    echo "servers.min 0"

    exit 0
fi

total_memory=$(ps auxf | grep -- "$PROCS" | grep "^$USR" | grep -v grep | awk '{s+=$6} END {print s * 1024}')
echo "servers.value $total_memory"