mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Move php plugins where they belong.
This commit is contained in:
parent
a75c969c83
commit
178747d96d
3 changed files with 0 additions and 0 deletions
36
plugins/php/php-cgi
Executable file
36
plugins/php/php-cgi
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
# -*- sh -*-
|
||||
#
|
||||
# Plugin to monitor the number of PHP processes on the machine.
|
||||
#
|
||||
# Copyright Khalid Baheyeldin 2009 http://2bits.com
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
# Magick markers (optional - used by munin-config and som installation
|
||||
# scripts):
|
||||
#%# family=manual
|
||||
#%# capabilities=autoconf
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Number of php-cgi processes'
|
||||
echo 'graph_args --base 1000 -l 0 '
|
||||
echo 'graph_vlabel number of php-cgi processes'
|
||||
echo 'graph_category apache'
|
||||
echo 'graph_info This graph shows the number of php-cgi processes in the system.'
|
||||
echo 'php_processes.label php-cgi'
|
||||
echo 'php_processes.draw LINE2'
|
||||
echo 'php_processes.info The current number of php-cgi processes.'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -n "php_processes.value "
|
||||
/bin/ps ax | /usr/bin/grep -i php-cgi | /usr/bin/grep -v grep | /usr/bin/wc -l | /usr/bin/sed 's/\t +//' | /usr/bin/sed 's/ *//'
|
104
plugins/php/php_eaccelerator
Executable file
104
plugins/php/php_eaccelerator
Executable file
|
@ -0,0 +1,104 @@
|
|||
#!/usr/bin/ruby
|
||||
|
||||
# Monitor your EAccelerator usage.
|
||||
# Requires: ruby
|
||||
|
||||
# Mandatory Parameters
|
||||
|
||||
# user / pwd - for basic authentication against control.php
|
||||
# url - fullpath to control.php
|
||||
|
||||
# Author: Dirk Gomez <munin@dirkgomez.de>
|
||||
# Copyright (C) 2007 Dirk Gomez
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require 'open-uri'
|
||||
|
||||
user = ENV['user'] || 'user'
|
||||
pwd = ENV['password'] || 'password'
|
||||
url = ENV['url'] || 'http://127.0.0.1/control.php'
|
||||
|
||||
if ARGV[0]=="config"
|
||||
print "EAccelerator Monitoring\n"
|
||||
print "graph_title PHP Eaccelerator\n"
|
||||
print "graph_category Apache\n"
|
||||
print "Memoryusagepercentage.label Memory Usage %\n"
|
||||
print "Memoryusagepercentage.warning 95\n"
|
||||
print "Memoryusagepercentage.critical 95\n"
|
||||
print "Memoryusage.label Memory Usage MB\n"
|
||||
print "Memorymax.label Cache Size MB\n"
|
||||
print "Freememory.label Free Memory MB\n"
|
||||
print "Cachedscripts.label Cached Scripts\n"
|
||||
print "Removedscripts.label Removed Scripts\n"
|
||||
print "Cachedkeys.label Cached Keys\n"
|
||||
exit
|
||||
end
|
||||
|
||||
one_liners=0
|
||||
three_liners=0
|
||||
key=""
|
||||
|
||||
open(url, :http_basic_authentication=>[user, pwd]) do |f|
|
||||
f.each do |line|
|
||||
if three_liners>0
|
||||
three_liners=three_liners+1
|
||||
|
||||
if three_liners==2
|
||||
print "Memoryusagepercentage.value "
|
||||
end
|
||||
|
||||
if three_liners==3
|
||||
print "Memoryusage.value "
|
||||
end
|
||||
|
||||
if three_liners==4
|
||||
print "Memorymax.value "
|
||||
end
|
||||
|
||||
print line.gsub!(/[^0-9.]/s,"")
|
||||
print "\n"
|
||||
end
|
||||
|
||||
if one_liners>0
|
||||
one_liners=one_liners+1
|
||||
print "#{key}.value "
|
||||
print line.gsub!(/[^0-9.]/s,"")
|
||||
print "\n"
|
||||
end
|
||||
|
||||
if one_liners>1
|
||||
line=""
|
||||
one_liners=0
|
||||
end
|
||||
|
||||
if three_liners>3
|
||||
line=""
|
||||
three_liners=0
|
||||
end
|
||||
|
||||
if line =~ /Memory usage/
|
||||
key=line.gsub!(/(<[^>]*>)|\n|\t| /s,"")
|
||||
three_liners=three_liners+1
|
||||
end
|
||||
|
||||
if line =~ /<td class="e">Free memory/ || line =~ /<td class="e">Cached scripts/ || line =~ /<td class="e">Removed scripts/ || line =~ /<td class="e">Cached keys/
|
||||
key=line.gsub!(/(<[^>]*>)|\n|\t| /s,"")
|
||||
one_liners=one_liners+1
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
72
plugins/php/php_sessions
Executable file
72
plugins/php/php_sessions
Executable file
|
@ -0,0 +1,72 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2006-2008 Benjamin Schweizer. All rights reserved.
|
||||
#
|
||||
#
|
||||
# Abstract
|
||||
# ~~~~~~~~
|
||||
# munin plugin that logs active apache sessions
|
||||
#
|
||||
# Authors
|
||||
# ~~~~~~~
|
||||
# Benjamin Schweizer <code at benjamin-schweizer dot de>
|
||||
# Ronan Guilloux <ronan at coolforest dot net>
|
||||
# Andras Kemeny <subpardaemon at gmail dot com>
|
||||
|
||||
# Copy this to your node's config file (default: plugin-conf.d/munin-node):
|
||||
# [php_sessions]
|
||||
# user root
|
||||
# env.sessiondir /var/lib/php/session
|
||||
#
|
||||
# Modify env.sessiondir to match your system's setting. This should be fine
|
||||
# on most systems.
|
||||
#
|
||||
# Changes
|
||||
# ~~~~~~~
|
||||
# 2011-02-13, subpardaemon: add env.sessiondir, make sure find uses
|
||||
# the given path (it hadn't before)
|
||||
# 2011-01-01, guilloux : find commands & plugin conf improvements
|
||||
# 2008-10-15, schweizer: added active sessions
|
||||
# 2008-10-10, schweizer: forked from munin_squid_efficiency
|
||||
# 2006-10-11, schweizer: initial release.
|
||||
#
|
||||
# Todo
|
||||
# ~~~~
|
||||
# - we'll see
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
SESSDIR=${sessiondir:-"/var/lib/php/session"}
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
test -d "$SESSDIR" > /dev/null 2>&1
|
||||
if [ $? ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo "no (session directory not found)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Apache/PHP Sessions'
|
||||
echo 'graph_info This graph shows active Apache/PHP sessions.'
|
||||
echo 'graph_category apache'
|
||||
echo "graph_args --lower-limit 0"
|
||||
echo 'graph_vlabel n'
|
||||
|
||||
echo 'sessions.label total sessions'
|
||||
echo 'asessions.label active sessions'
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ACTIVE_SESSIONS_NUM=`find $SESSDIR/ -type f -iname "sess_*" -amin -5 | wc -l`
|
||||
TOTAL_SESSIONS_NUM=`find $SESSDIR/ -type f -iname "sess_*" | wc -l`
|
||||
|
||||
echo "sessions.value ${TOTAL_SESSIONS_NUM}"
|
||||
echo "asessions.value ${ACTIVE_SESSIONS_NUM}"
|
||||
|
||||
# eof.
|
Loading…
Add table
Add a link
Reference in a new issue