mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
- have some dirs
This commit is contained in:
parent
0b089ea777
commit
08346aac58
687 changed files with 0 additions and 0 deletions
110
plugins/php/eaccelerator-python
Executable file
110
plugins/php/eaccelerator-python
Executable file
|
@ -0,0 +1,110 @@
|
|||
#!/usr/bin/env python
|
||||
'''
|
||||
Plugin to monitor performance of eaccelerator module for PHP.
|
||||
|
||||
To use:
|
||||
1. Copy script to munin plugins folder
|
||||
2. Symbolically link to eacc_memory and eacc_cached
|
||||
* eacc_memory shows memory usage
|
||||
* eacc_cached shows number of scripts cached and discarded
|
||||
3. Set configuration options in munin config file as follows
|
||||
[eacc_*]
|
||||
env.auth_user username
|
||||
env.auth_pwd password
|
||||
env_cpanel url_of_stats.php
|
||||
4. Copy stats.php into the eacc control panel folder and set $user/$pw to match auth_user/auth_pwd
|
||||
* Ideally, these should be the same values as set in control.php
|
||||
5. Run `munin-run eacc_memory` and `munin-run eacc_cached` to make sure scripts are running correctly, you should see non-zero values
|
||||
6. Restart munin-node
|
||||
|
||||
This script's homepage: https://github.com/hermzz/munin-eaccelerator-plugin
|
||||
eAccelerator homepage: http://eaccelerator.net/
|
||||
'''
|
||||
import sys, os
|
||||
|
||||
command_vars = {
|
||||
'memory': ['memorysize', 'memoryallocated'],
|
||||
'cached': ['cachedscripts', 'removedscripts']
|
||||
}
|
||||
|
||||
config = {
|
||||
'memory':
|
||||
'graph_title eacceleratory memory usage\n' +
|
||||
'graph_info This graph shows memory performance of PHP eaccelerator module\n' +
|
||||
'graphs_args -1 0\n' +
|
||||
'graph_category php\n' +
|
||||
|
||||
'memorysize.label total\n' +
|
||||
'memorysize.draw AREA\n' +
|
||||
'memorysize.min 0\n' +
|
||||
'memorysize.info Total memory\n' +
|
||||
|
||||
'memoryallocated.label allocated\n' +
|
||||
'memoryallocated.draw LINE1\n' +
|
||||
'memoryallocated.min 0\n' +
|
||||
'memoryallocated.info Memory allocated',
|
||||
'cached':
|
||||
'graph_title eacceleratory cached scripts\n' +
|
||||
'graph_info This graph shows how many scripts are cached by PHP eaccelerator module\n' +
|
||||
'graphs_args -1 0\n' +
|
||||
'graph_category php\n' +
|
||||
|
||||
'cachedscripts.label cached scripts\n' +
|
||||
'cachedscripts.draw LINE1\n' +
|
||||
'cachedscripts.min 0\n' +
|
||||
'cachedscripts.info Cached scripts\n' +
|
||||
|
||||
'removedscripts.label removed scripts\n' +
|
||||
'removedscripts.draw LINE1\n' +
|
||||
'removedscripts.min 0\n' +
|
||||
'removedscripts.info Removed scripts'
|
||||
}
|
||||
|
||||
def print_config(command):
|
||||
print config[command]
|
||||
|
||||
def get_stats():
|
||||
fetcher = httplib2.Http()
|
||||
if 'auth_user' in os.environ and 'auth_pwd' in os.environ:
|
||||
fetcher.add_credentials(os.environ['auth_user'], os.environ['auth_pwd'])
|
||||
resp, content = fetcher.request(os.environ["cpanel"])
|
||||
|
||||
if resp['status'] != '200':
|
||||
content = '0 0 0 0'
|
||||
|
||||
bits = content.split(' ')
|
||||
return {'memorysize': bits[0], 'memoryallocated': bits[1], 'cachedscripts': bits[2], 'removedscripts': bits[3]}
|
||||
|
||||
def print_stats(command):
|
||||
stats = get_stats()
|
||||
|
||||
for var in command_vars[command]:
|
||||
print "%s.value %s" % (var, stats[var])
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
import httplib2
|
||||
except ImportError:
|
||||
print "httplib2 not found"
|
||||
sys.exit(1)
|
||||
|
||||
if os.environ['cpanel'] == '':
|
||||
print "env.cpanel not defined in munin config"
|
||||
sys.exit()
|
||||
|
||||
underscore = sys.argv[0].find('_')
|
||||
|
||||
if underscore == -1:
|
||||
print "Symbolically link this file to eacc_memory or eacc_cached"
|
||||
sys.exit(1)
|
||||
else:
|
||||
command = sys.argv[0][underscore+1:]
|
||||
|
||||
if len(sys.argv) > 1 and sys.argv[1] != '':
|
||||
if sys.argv[1] == 'config':
|
||||
print_config(command)
|
||||
else:
|
||||
print "Command %s not recognized" % sys.argv[1]
|
||||
sys.exit(1)
|
||||
else:
|
||||
print_stats(command)
|
100
plugins/php/eaccelerator-usage
Executable file
100
plugins/php/eaccelerator-usage
Executable file
|
@ -0,0 +1,100 @@
|
|||
#!/usr/bin/perl -w
|
||||
# -*- perl -*-
|
||||
|
||||
=head1 NAME
|
||||
|
||||
eacc - Plugin to monitor eAccelerator
|
||||
|
||||
=head1 CONFIGURATION EXAMPLE
|
||||
|
||||
/etc/munin/plugin-conf.d/eacc or other file in that dir must contain:
|
||||
|
||||
[eacc]
|
||||
env.user admin
|
||||
env.pass eAccelerator
|
||||
env.host 127.0.0.1
|
||||
env.port 80
|
||||
env.page control.php
|
||||
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
falselike at gmail dot com
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
No license
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=cut
|
||||
|
||||
use LWP;
|
||||
|
||||
my $host = $ENV{'host'} || '127.0.0.1';
|
||||
my $port = $ENV{'port'} || 80;
|
||||
my $page = $ENV{'page'} || 'control.php';
|
||||
|
||||
my $user = $ENV{'user'} || 'admin';
|
||||
my $pass = $ENV{'pass'} || 'eAccelerator';
|
||||
my $realm = $ENV{'realm'} || 'eAccelerator control panel';
|
||||
|
||||
if ($#ARGV eq 0) {
|
||||
if ($ARGV[0] eq 'autoconf') {
|
||||
print "yes\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($ARGV[0] eq 'config') {
|
||||
print "eAccelerator\n";
|
||||
print "graph_title eAccelerator\n";
|
||||
print "graph_category php-cgi\n";
|
||||
print "memusage.label Memory Usage %\n";
|
||||
print "memusage.warning 95\n";
|
||||
print "memusage.critical 95\n";
|
||||
print "memusage.label Memory Usage MB\n";
|
||||
print "memmax.label Cache Size MB\n";
|
||||
print "memused.label Used Memory MB\n";
|
||||
print "memfree.label Free Memory MB\n";
|
||||
print "cached.label Scripts Cached\n";
|
||||
print "removed.label Scripts Removed\n";
|
||||
print "keys.label Keys Cached\n";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
my $ua = LWP::UserAgent->new();
|
||||
$ua->credentials($host . ':' . $port, $realm, $user, $pass);
|
||||
my $url = 'http://'. $host .':'. $port .'/'. $page;
|
||||
my $resp = $ua->get($url);
|
||||
|
||||
if ($resp->is_success) {
|
||||
$b = '';
|
||||
foreach (split '\n', $resp->content) {
|
||||
if (/([\d\.]+)/) {
|
||||
$v = $1;
|
||||
# debug
|
||||
#print "$b\n$_\n";
|
||||
print "memmax.value $v\n" if $b =~ /total/i;
|
||||
if ($b =~ /in use/i) {
|
||||
print "memused.value $v\n";
|
||||
if (/([\d+\.]+)\s*%/) {
|
||||
print "memusage.value $1\n";
|
||||
}
|
||||
}
|
||||
print "memfree.value $v\n" if $b =~ /free/i;
|
||||
print "cached.value $v\n" if $b =~ /cached/i;
|
||||
print "removed.value $v\n" if $b =~ /removed/i;
|
||||
print "keys.value $v\n" if $b =~ /keys/i;
|
||||
|
||||
}
|
||||
$b = $_;
|
||||
}
|
||||
} else {
|
||||
my $ret = $resp->status_line;
|
||||
die "Authorization failed!\nPlease recheck your credentials:\n\tenv.user $user\n\tenv.pass $pass\n\n" if $ret =~ /401/;
|
||||
die "Can't get $url -- ", $ret;
|
||||
}
|
105
plugins/php/php-fastcgi
Executable file
105
plugins/php/php-fastcgi
Executable file
|
@ -0,0 +1,105 @@
|
|||
#!/usr/bin/perl -w
|
||||
# -*- mode: cperl; mode: autopair -*-
|
||||
# Magic markers:
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
# php_fcgi --- Munin plugin for determining the memory usage and
|
||||
# number of PHP FastCGI processes.
|
||||
|
||||
# Copyright (C) 2010 Antonio P. P. Almeida <appa@perusio.net>
|
||||
|
||||
# Author: Antonio P. P. Almeida <appa@perusio.net>
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
|
||||
# Except as contained in this notice, the name(s) of the above copyright
|
||||
# holders shall not be used in advertising or otherwise to promote the sale,
|
||||
# use or other dealings in this Software without prior written authorization.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
=head1 NAME
|
||||
|
||||
php_fcgi - Munin plugin to show the Memory anf number of processes used by PHP FastCGI.
|
||||
|
||||
=encoding utf8
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
Any host running PHP FastCGI.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.0
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
This shows the default configuration of this plugin. You can override
|
||||
the process name of php-fcgi.
|
||||
|
||||
[php-fcgi]
|
||||
env.pname php-cgi
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
None known
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Antonio Almeida <appa@perusio.net>
|
||||
|
||||
=head1 REPOSITORY
|
||||
|
||||
Source code at http://github.com/perusio/munin-php-cgi
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
MIT
|
||||
|
||||
=cut
|
||||
|
||||
## Support for rounding functions.
|
||||
use POSIX;
|
||||
|
||||
## Environment defined variables.
|
||||
## The default process name if different set it in the environment.
|
||||
|
||||
my $PROCESS_NAME = exists $ENV{'pname'} ? $ENV{'pname'} : "php-cgi";
|
||||
|
||||
## Munin config method.
|
||||
if (exists $ARGV[0] and $ARGV[0] eq "config") {
|
||||
|
||||
print "graph_title PHP CGI [MB]\n";
|
||||
print "graph_vlabel PHP CGI Memory usage\n";
|
||||
print "graph_category php-cgi\n";
|
||||
print "graph_args -l 0\n";
|
||||
print "php_cgi_ram.label PHP CGI Used RAM\n";
|
||||
print "php_cgi_ram.draw LINE2\n";
|
||||
print "php_cgi_processes.info Number of PHP CGI processes\n";
|
||||
print "php_cgi_processes.label processes\n";
|
||||
|
||||
exit 0;
|
||||
} else {
|
||||
my ($pp, $pm) = eval(`ps u -p \$(pidof $PROCESS_NAME) | awk 'NR > 1 {pm += \$5} END {print "("NR-1","pm/1024")"}'`);
|
||||
printf("php_cgi_ram.value %d\n", ceil($pm));
|
||||
print "php_cgi_processes.value $pp\n";
|
||||
}
|
92
plugins/php/php-fcgi
Executable file
92
plugins/php/php-fcgi
Executable file
|
@ -0,0 +1,92 @@
|
|||
#!/usr/bin/perl -w
|
||||
# -*- mode: cperl; mode: autopair -*-
|
||||
# Magic markers:
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
# php_fcgi --- Munin plugin for determining the memory usage and
|
||||
# number of PHP FastCGI processes.
|
||||
|
||||
# Copyright (C) 2010 António P. P. Almeida <appa@perusio.net>
|
||||
|
||||
# Author: António P. P. Almeida <appa@perusio.net>
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
|
||||
# Except as contained in this notice, the name(s) of the above copyright
|
||||
# holders shall not be used in advertising or otherwise to promote the sale,
|
||||
# use or other dealings in this Software without prior written authorization.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
=head1 NAME
|
||||
|
||||
php_fcgi - Munin plugin to show the Memory anf number of processes used by PHP FastCGI.
|
||||
|
||||
=encoding utf8
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
Any host running PHP FastCGI.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.0
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
None known
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
António Almeida <appa@perusio.net>
|
||||
|
||||
=head1 REPOSITORY
|
||||
|
||||
Source code at http://github.com/perusio/munin-php-cgi
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
MIT
|
||||
|
||||
=cut
|
||||
|
||||
## Support for rounding functions.
|
||||
use POSIX;
|
||||
|
||||
## Munin config method.
|
||||
if (exists $ARGV[0] and $ARGV[0] eq "config") {
|
||||
|
||||
print "graph_title PHP CGI [MB]\n";
|
||||
print "graph_vlabel PHP CGI Memory usage\n";
|
||||
print "graph_category php-cgi\n";
|
||||
print "graph_args -l 0\n";
|
||||
print "php_cgi_ram.label PHP CGI Used RAM\n";
|
||||
print "php_cgi_ram.draw LINE2\n";
|
||||
print "php_cgi_processes.info Number of PHP CGI processes\n";
|
||||
print "php_cgi_processes.label processes\n";
|
||||
|
||||
exit 0;
|
||||
} else {
|
||||
my ($pp, $pm) = eval(`ps u -p \$(pidof php-cgi) | awk 'NR > 1 {pm += \$5} END {print "("NR-1","pm/1024")"}'`);
|
||||
printf("php_cgi_ram.value %d\n", ceil($pm));
|
||||
print "php_cgi_processes.value $pp\n";
|
||||
}
|
BIN
plugins/php/php_apc_
Executable file
BIN
plugins/php/php_apc_
Executable file
Binary file not shown.
54
plugins/php/php_xcache
Executable file
54
plugins/php/php_xcache
Executable file
|
@ -0,0 +1,54 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
|
||||
require LWP::UserAgent;
|
||||
|
||||
########################################################################################
|
||||
#
|
||||
# Installation / Configuration
|
||||
#
|
||||
# - place munin_xcache.php in a directory on your webserver
|
||||
# - add the url config to plugin-conf.d/munin-node
|
||||
#
|
||||
#
|
||||
# for more info see http://www.ohardt.net/dev/munin/
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
|
||||
chomp(my $fqdn=`hostname -f`);
|
||||
|
||||
|
||||
my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://user:pwd\@$fqdn/munin_xcache_new.php";
|
||||
|
||||
$URL = $URL . "?what=mem";
|
||||
|
||||
my $ua = LWP::UserAgent->new(timeout => 30);
|
||||
|
||||
|
||||
if ( exists $ARGV[0] and $ARGV[0] eq "config" )
|
||||
{
|
||||
|
||||
$URL = $URL . '&config';
|
||||
|
||||
my $response = $ua->request(HTTP::Request->new('GET',$URL . '&config' ));
|
||||
|
||||
print $response->content;
|
||||
|
||||
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
|
||||
my $response = $ua->request(HTTP::Request->new('GET',$URL));
|
||||
|
||||
|
||||
print $response->content;
|
||||
|
||||
|
||||
exit( 0 );
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue