1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Ruby plugins: apply style changes as suggested by "rubocop --fix-layout"

This commit is contained in:
Lars Kruse 2020-08-25 16:52:39 +02:00
parent 26c29daa2b
commit b0b39b018e
30 changed files with 1447 additions and 1384 deletions

View file

@ -1,21 +1,26 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# netstat_bsd_m revision 1 (Feb 2012) =begin
#
# This plugin shows various statistics from 'netstat -m' netstat_bsd_m revision 1 (Feb 2012)
#
# Required privileges: none This plugin shows various statistics from 'netstat -m'
#
# OS: Required privileges: none
# Supposed: BSD
# Tested: FreeBSD 8.2 OS:
# Supposed: BSD
# Author: Artem Sheremet <dot.doom@gmail.com> Tested: FreeBSD 8.2
#
Author: Artem Sheremet <dot.doom@gmail.com>
#%# family=auto #%# family=auto
#%# capabilities=autoconf suggest #%# capabilities=autoconf suggest
=end
# original filename # original filename
PLUGIN_NAME = 'netstat_bsd_m_' PLUGIN_NAME = 'netstat_bsd_m_'
@ -61,7 +66,7 @@ when 'config'
desc, values = data.first desc, values = data.first
stack = values.size > 1 stack = values.size > 1
first = true first = true
puts <<CONFIG puts <<~CONFIG
graph_title Netstat: #{desc} graph_title Netstat: #{desc}
graph_category network graph_category network
graph_vlabel current graph_vlabel current

View file

@ -125,6 +125,7 @@ end
new_data.split("\n=").each { |report| new_data.split("\n=").each { |report|
next if report.empty? next if report.empty?
report =~ /\A(\w+) REPORT==== (.*) ===\n(.*)\z/m report =~ /\A(\w+) REPORT==== (.*) ===\n(.*)\z/m
type, time, text = $1, $2, $3 type, time, text = $1, $2, $3
next unless type and time and text next unless type and time and text
@ -141,7 +142,7 @@ log_info[:start] += new_data.size
File.open(CACHE_FILE, 'w') { |f| f.write log_info.to_yaml } unless $debug_mode File.open(CACHE_FILE, 'w') { |f| f.write log_info.to_yaml } unless $debug_mode
if ARGV.first == 'config' if ARGV.first == 'config'
puts <<CONFIG puts <<~CONFIG
graph_title Ejabberd Log graph_title Ejabberd Log
graph_vlabel total graph_vlabel total
graph_category chat graph_category chat

View file

@ -1,37 +1,42 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# mongrel_memory - A munin plugin for OpenSolaris to monitor memory size of
# each individual mongrel process =begin
# Copyright (C) 2009 Matthias Marschall - mm@agileweboperations.com
# mongrel_memory - A munin plugin for OpenSolaris to monitor memory size of
# Based on: each individual mongrel process
# mongrel_process_memory - A munin plugin to monitor memory size of Copyright (C) 2009 Matthias Marschall - mm@agileweboperations.com
# each individual mongrel process
# Copyright (C) 2007 Ben VandenBos and Avvo, Inc. Based on:
# mongrel_process_memory - A munin plugin to monitor memory size of
# This program is free software; you can redistribute it and/or modify each individual mongrel process
# it under the terms of the GNU General Public License version 2 Copyright (C) 2007 Ben VandenBos and Avvo, Inc.
# as published by the Free Software Foundation.
# This program is free software; you can redistribute it and/or modify
# This program is distributed in the hope that it will be useful, it under the terms of the GNU General Public License version 2
# but WITHOUT ANY WARRANTY; without even the implied warranty of as published by the Free Software Foundation.
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# You should have received a copy of the GNU General Public License along MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# with this program; if not, write to the Free Software Foundation, Inc., GNU General Public License for more details.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# You should have received a copy of the GNU General Public License along
# Author: Ben VandenBos with this program; if not, write to the Free Software Foundation, Inc.,
# Contributors: Adam Jacob (<adam@hjksolutions.com>) 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Ryan Woodrum
# Matthias Marschall (mm@agileweboperations.com) Author: Ben VandenBos
# Contributors: Adam Jacob (<adam@hjksolutions.com>)
Ryan Woodrum
Matthias Marschall (mm@agileweboperations.com)
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=end
module Munin module Munin
class MongrelProcessMemory class MongrelProcessMemory
def run def run
pid_port_map = get_pids() pid_port_map = get_pids()
port_list = Hash.new port_list = Hash.new
@ -57,7 +62,6 @@ module Munin
def autoconf def autoconf
get_pids().length > 0 get_pids().length > 0
end end
end end
end end

View file

@ -1,32 +1,36 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
#
# mongrel_process_memory - A munin plugin to monitor memory size of =begin
# each individual mongrel process
# Copyright (C) 2007 Ben VandenBos and Avvo, Inc. mongrel_process_memory - A munin plugin to monitor memory size of
# each individual mongrel process
# This program is free software; you can redistribute it and/or modify Copyright (C) 2007 Ben VandenBos and Avvo, Inc.
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation. This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# This program is distributed in the hope that it will be useful, as published by the Free Software Foundation.
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the This program is distributed in the hope that it will be useful,
# GNU General Public License for more details. but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# You should have received a copy of the GNU General Public License along GNU General Public License for more details.
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 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.,
# Author: Ben VandenBos 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Contributors: Adam Jacob (<adam@hjksolutions.com>)
# Ryan Woodrum Author: Ben VandenBos
# Contributors: Adam Jacob (<adam@hjksolutions.com>)
Ryan Woodrum
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=end
module Munin module Munin
class MongrelProcessMemory class MongrelProcessMemory
def run def run
h = get_pids() h = get_pids()
ps_output = "" ps_output = ""
@ -68,7 +72,6 @@ module Munin
def autoconf def autoconf
pids.length > 0 pids.length > 0
end end
end end
end end

View file

@ -1,25 +1,30 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
#
# Plugin to monitor the number of connections blocked by moblock. =begin
#
# Requirements: Plugin to monitor the number of connections blocked by moblock.
#
# Moblock up and running with generated log files going to /var/log/moblock Requirements:
#
# Parameters supported: Moblock up and running with generated log files going to /var/log/moblock
#
# config Parameters supported:
# autoconf
# config
# Configurable variables autoconf
#
# logfile - Override default moblock logfile Configurable variables
#
# Magic markers logfile - Override default moblock logfile
#
Magic markers
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=end
# #
# Initialize vars # Initialize vars
# #

View file

@ -1,49 +1,54 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
#
# Munin Plugin for MSSQL - transaction monitoring =begin
#
# Author: Wilfred Chau <openapp.developer@gmail.com> Munin Plugin for MSSQL - transaction monitoring
# Date: 2011-05-18
# Version: 1.0 Author: Wilfred Chau <openapp.developer@gmail.com>
# Date: 2011-05-18
# This program is free software; you can redistribute it and/or modify Version: 1.0
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation. This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# This program is distributed in the hope that it will be useful, as published by the Free Software Foundation.
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the This program is distributed in the hope that it will be useful,
# GNU General Public License for more details. but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# You should have received a copy of the GNU General Public License along GNU General Public License for more details.
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 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.
# Prerequistes:
# 1) /etc/odbc.ini and /etc/freetds.conf
# 2) rubygems Prerequistes:
# 3) ruby-dbi 1) /etc/odbc.ini and /etc/freetds.conf
# 2) rubygems
# Usage: 3) ruby-dbi
# 1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
# 2) chmod to allow executable to others Usage:
# 3) create symbolic link in /etc/munin/plugins 1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
# ln -s /usr/share/munin/plugins/mssql_transaction.rb /etc/munin/plugins/mssql_transaction.rb 2) chmod to allow executable to others
# 3) create symbolic link in /etc/munin/plugins
# Parameters: ln -s /usr/share/munin/plugins/mssql_transaction.rb /etc/munin/plugins/mssql_transaction.rb
# autoconf
# config (required) Parameters:
# autoconf
# Config variables: config (required)
# sqluser : mssql user who has view server state privilege
# sqlpass : password for the mssql user Config variables:
# dsn : datasource name as defined in /etc/odbc.ini sqluser : mssql user who has view server state privilege
# instance: instance to monitor sqlpass : password for the mssql user
# dsn : datasource name as defined in /etc/odbc.ini
instance: instance to monitor
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=end
require 'rubygems' require 'rubygems'
require 'dbi' require 'dbi'

View file

@ -1,48 +1,53 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
#
# Munin Plugin for MSSQL - Buffer cache hit ratio monitoring =begin
#
# Author: Wilfred Chau <openapp.developer@gmail.com> Munin Plugin for MSSQL - Buffer cache hit ratio monitoring
# Date: 2011-05-19
# Version: 1.0 Author: Wilfred Chau <openapp.developer@gmail.com>
# Date: 2011-05-19
# This program is free software; you can redistribute it and/or modify Version: 1.0
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation. This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# This program is distributed in the hope that it will be useful, as published by the Free Software Foundation.
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the This program is distributed in the hope that it will be useful,
# GNU General Public License for more details. but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# You should have received a copy of the GNU General Public License along GNU General Public License for more details.
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 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.
# Prerequistes:
# 1) /etc/odbc.ini and /etc/freetds.conf
# 2) rubygems Prerequistes:
# 3) ruby-dbi 1) /etc/odbc.ini and /etc/freetds.conf
# 2) rubygems
# Usage: 3) ruby-dbi
# 1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
# 2) chmod to allow executable to others Usage:
# 3) create symbolic link in /etc/munin/plugins 1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
# ln -s /usr/share/munin/plugins/mssql_buffercachehitratio.rb /etc/munin/plugins/mssql_buffercachehitratio.rb 2) chmod to allow executable to others
# 3) create symbolic link in /etc/munin/plugins
# Parameters: ln -s /usr/share/munin/plugins/mssql_buffercachehitratio.rb /etc/munin/plugins/mssql_buffercachehitratio.rb
# autoconf
# config (required) Parameters:
# autoconf
# Config variables: config (required)
# sqluser : mssql user who has view server state privilege
# sqlpass : password for the mssql user Config variables:
# dsn : datasource name as defined in /etc/odbc.ini sqluser : mssql user who has view server state privilege
# sqlpass : password for the mssql user
dsn : datasource name as defined in /etc/odbc.ini
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=end
require 'rubygems' require 'rubygems'
require 'dbi' require 'dbi'

View file

@ -1,49 +1,54 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
#
# Munin Plugin for MSSQL - Data file size monitoring =begin
#
# Author: Wilfred Chau <openapp.developer@gmail.com> Munin Plugin for MSSQL - Data file size monitoring
# Date: 2011-05-19
# Version: 1.0 Author: Wilfred Chau <openapp.developer@gmail.com>
# Date: 2011-05-19
# This program is free software; you can redistribute it and/or modify Version: 1.0
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation. This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# This program is distributed in the hope that it will be useful, as published by the Free Software Foundation.
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the This program is distributed in the hope that it will be useful,
# GNU General Public License for more details. but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# You should have received a copy of the GNU General Public License along GNU General Public License for more details.
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 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.
# Prerequistes:
# 1) /etc/odbc.ini and /etc/freetds.conf
# 2) rubygems Prerequistes:
# 3) ruby-dbi 1) /etc/odbc.ini and /etc/freetds.conf
# 2) rubygems
# Usage: 3) ruby-dbi
# 1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
# 2) chmod to allow executable to others Usage:
# 3) create symbolic link in /etc/munin/plugins 1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
# ln -s /usr/share/munin/plugins/mssql_datafilesizes.rb /etc/munin/plugins/mssql_datafilesizes.rb 2) chmod to allow executable to others
# 3) create symbolic link in /etc/munin/plugins
# Parameters: ln -s /usr/share/munin/plugins/mssql_datafilesizes.rb /etc/munin/plugins/mssql_datafilesizes.rb
# autoconf
# config (required) Parameters:
# autoconf
# Config variables: config (required)
# sqluser : mssql user who has view server state privilege
# sqlpass : password for the mssql user Config variables:
# dsn : datasource name as defined in /etc/odbc.ini sqluser : mssql user who has view server state privilege
# instance: instance to monitor sqlpass : password for the mssql user
# dsn : datasource name as defined in /etc/odbc.ini
instance: instance to monitor
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=end
require 'rubygems' require 'rubygems'
require 'dbi' require 'dbi'

View file

@ -1,49 +1,54 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
#
# Munin Plugin for MSSQL - log files monitoring =begin
#
# Author: Wilfred Chau <openapp.developer@gmail.com> Munin Plugin for MSSQL - log files monitoring
# Date: 2011-05-19
# Version: 1.0 Author: Wilfred Chau <openapp.developer@gmail.com>
# Date: 2011-05-19
# This program is free software; you can redistribute it and/or modify Version: 1.0
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation. This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# This program is distributed in the hope that it will be useful, as published by the Free Software Foundation.
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the This program is distributed in the hope that it will be useful,
# GNU General Public License for more details. but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# You should have received a copy of the GNU General Public License along GNU General Public License for more details.
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 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.
# Prerequistes:
# 1) /etc/odbc.ini and /etc/freetds.conf
# 2) rubygems Prerequistes:
# 3) ruby-dbi 1) /etc/odbc.ini and /etc/freetds.conf
# 2) rubygems
# Usage: 3) ruby-dbi
# 1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
# 2) chmod to allow executable to others Usage:
# 3) create symbolic link in /etc/munin/plugins 1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
# ln -s /usr/share/munin/plugins/mssql_logfilesizes.rb /etc/munin/plugins/mssql_logfilesizes.rb 2) chmod to allow executable to others
# 3) create symbolic link in /etc/munin/plugins
# Parameters: ln -s /usr/share/munin/plugins/mssql_logfilesizes.rb /etc/munin/plugins/mssql_logfilesizes.rb
# autoconf
# config (required) Parameters:
# autoconf
# Config variables: config (required)
# sqluser : mssql user who has view server state privilege
# sqlpass : password for the mssql user Config variables:
# dsn : datasource name as defined in /etc/odbc.ini sqluser : mssql user who has view server state privilege
# instance: instance to monitor sqlpass : password for the mssql user
# dsn : datasource name as defined in /etc/odbc.ini
instance: instance to monitor
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=end
require 'rubygems' require 'rubygems'
require 'dbi' require 'dbi'

View file

@ -1,22 +1,26 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# netstat_s revision 6 (Nov 2013) =begin
#
# This plugin shows various statistics from 'netstat -s' netstat_s revision 6 (Nov 2013)
#
# Required privileges: none This plugin shows various statistics from 'netstat -s'
#
# OS: Required privileges: none
# Supposed: BSD, Linux (only a few items, see netstat_multi for more)
# Tested: FreeBSD: 8.2, 8.3, 9.1 OS:
# Linux : Debian 6 (kernel 2.6.32), Arch (kernel 3.11.6), CentOS 6 Supposed: BSD, Linux (only a few items, see netstat_multi for more)
# Tested: FreeBSD: 8.2, 8.3, 9.1
# Author: Artem Sheremet <dot.doom@gmail.com> Linux : Debian 6 (kernel 2.6.32), Arch (kernel 3.11.6), CentOS 6
#
Author: Artem Sheremet <dot.doom@gmail.com>
#%# family=auto #%# family=auto
#%# capabilities=autoconf suggest #%# capabilities=autoconf suggest
=end
# original filename # original filename
PLUGIN_NAME = 'netstat_s_' PLUGIN_NAME = 'netstat_s_'
@ -54,6 +58,7 @@ class Graph
multigraphs = {} multigraphs = {}
@parse_expr.each { |expr, descr| @parse_expr.each { |expr, descr|
next unless descr # no label - skip this entry next unless descr # no label - skip this entry
descr.each { |entry| descr.each { |entry|
labels_array = (multigraphs[entry[0]] ||= []) labels_array = (multigraphs[entry[0]] ||= [])
labels_array.push [entry[1], entry[2]] labels_array.push [entry[1], entry[2]]
@ -125,6 +130,7 @@ class Graph
multigraphs = {} multigraphs = {}
@parse_expr.each { |expr, descr| @parse_expr.each { |expr, descr|
next unless descr # no label - skip this entry next unless descr # no label - skip this entry
index = data.index { |line| line =~ expr } index = data.index { |line| line =~ expr }
if index if index
data.delete_at index data.delete_at index
@ -291,8 +297,7 @@ def graphs_for(protocol)
]) ])
] ]
when 'udp' when 'udp'
$os == :linux ? [ $os == :linux ? [] : [
] : [
Graph.new('received', protocol, [ Graph.new('received', protocol, [
[/(\d+) datagrams received$/, [[:packets, 'total']]], [/(\d+) datagrams received$/, [[:packets, 'total']]],
[/(\d+) with incomplete header$/, [[:packets, 'incomplete header']]], [/(\d+) with incomplete header$/, [[:packets, 'incomplete header']]],
@ -312,8 +317,7 @@ def graphs_for(protocol)
]) ])
] ]
when 'ip' when 'ip'
$os == :linux ? [ $os == :linux ? [] : [
] : [
Graph.new('received', protocol, [ Graph.new('received', protocol, [
[/(\d+) total packets received$/, [[:packets, 'total']]], [/(\d+) total packets received$/, [[:packets, 'total']]],
[/(\d+) bad header checksums$/, [[:packets, 'bad header checksum']]], [/(\d+) bad header checksums$/, [[:packets, 'bad header checksum']]],

View file

@ -1,54 +1,59 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
#
# Munin Plugin for PGA memory components monitoring =begin
#
# Author: Wilfred Chau <openapp.developer@gmail.com> Munin Plugin for PGA memory components monitoring
# Date: 2011-05-13
# Version: 1.0 Author: Wilfred Chau <openapp.developer@gmail.com>
# Date: 2011-05-13
# This program is free software; you can redistribute it and/or modify Version: 1.0
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation. This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# This program is distributed in the hope that it will be useful, as published by the Free Software Foundation.
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the This program is distributed in the hope that it will be useful,
# GNU General Public License for more details. but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# You should have received a copy of the GNU General Public License along GNU General Public License for more details.
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 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.
# Prerequistes:
# 1) env.ORACLE_HOME set in munin-node
# 2) rubygems Prerequistes:
# 3) oci8 - DBI gem for connecting to Oracle 1) env.ORACLE_HOME set in munin-node
# * instruction of installing oci8 is available here: 2) rubygems
# http://ruby-oci8.rubyforge.org/en/InstallBinaryPackage.html 3) oci8 - DBI gem for connecting to Oracle
# * instruction of installing oci8 is available here:
# Usage: http://ruby-oci8.rubyforge.org/en/InstallBinaryPackage.html
# 1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
# 2) chmod to allow executable to others Usage:
# 3) create symbolic link in /etc/munin/plugins 1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
# ln -s /usr/share/munin/plugins/oracle_<sid>_pga.rb /etc/munin/plugins/oracle_<sid>_pga.rb 2) chmod to allow executable to others
# ** replace <sid> with your oralce sid 3) create symbolic link in /etc/munin/plugins
# ln -s /usr/share/munin/plugins/oracle_<sid>_pga.rb /etc/munin/plugins/oracle_<sid>_pga.rb
# Parameters: ** replace <sid> with your oralce sid
# autoconf
# config (required) Parameters:
# autoconf
# Configurable variables: config (required)
# orauser : oracle user who has select privilege to query v$pgastat view
# orapass : password for the oracle user Configurable variables:
# dbport : port used by the monitored instance (notice: numeric value) orauser : oracle user who has select privilege to query v$pgastat view
# dbname : database to be monitored orapass : password for the oracle user
# dbhost : host or ip address of db instance dbport : port used by the monitored instance (notice: numeric value)
# dbname : database to be monitored
# dbhost : host or ip address of db instance
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=end
require 'rubygems' require 'rubygems'
require 'oci8' require 'oci8'
@ -68,7 +73,6 @@ def runQuery (name,query)
rows.close rows.close
end end
# #
# Queries # Queries
# #
@ -79,8 +83,7 @@ pga_query = "SELECT TO_CHAR(ROUND(decode(unit,'bytes',(value)/(1024*1024),value)
from V$PGASTAT where name = 'total PGA inuse'" from V$PGASTAT where name = 'total PGA inuse'"
pga_components = { "pga_target" => pga_target_query, pga_components = { "pga_target" => pga_target_query,
"pga_in_use" => pga_query "pga_in_use" => pga_query }
}
# #
# autoconf # autoconf

View file

@ -1,53 +1,58 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
#
# Munin Plugin for SGA memory components monitoring =begin
#
# Author: Wilfred Chau <openapp.developer@gmail.com> Munin Plugin for SGA memory components monitoring
# Date: 2011-05-12
# Version: 1.0 Author: Wilfred Chau <openapp.developer@gmail.com>
# Date: 2011-05-12
# This program is free software; you can redistribute it and/or modify Version: 1.0
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation. This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# This program is distributed in the hope that it will be useful, as published by the Free Software Foundation.
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the This program is distributed in the hope that it will be useful,
# GNU General Public License for more details. but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# You should have received a copy of the GNU General Public License along GNU General Public License for more details.
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 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.
# Prerequistes:
# 1) env.ORACLE_HOME set in munin-node
# 2) rubygems Prerequistes:
# 3) oci8 - DBI gem for connecting to Oracle 1) env.ORACLE_HOME set in munin-node
# * instruction of installing oci8 is available here: 2) rubygems
# http://ruby-oci8.rubyforge.org/en/InstallBinaryPackage.html 3) oci8 - DBI gem for connecting to Oracle
# * instruction of installing oci8 is available here:
# Usage: http://ruby-oci8.rubyforge.org/en/InstallBinaryPackage.html
# 1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
# 2) chmod to allow executable to others Usage:
# 3) create symbolic link in /etc/munin/plugins 1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
# ln -s /usr/share/munin/plugins/oracle_orcl_sga.rb /etc/munin/plugins/oracle_orcl_sga.rb 2) chmod to allow executable to others
# 3) create symbolic link in /etc/munin/plugins
# Parameters: ln -s /usr/share/munin/plugins/oracle_orcl_sga.rb /etc/munin/plugins/oracle_orcl_sga.rb
# autoconf
# config (required) Parameters:
# autoconf
# Configurable variables: config (required)
# orauser : oracle user who has select privilege to query v$sgastat view
# orapass : password for the oracle user Configurable variables:
# dbport : port used by the monitored instance (notice: numeric value) orauser : oracle user who has select privilege to query v$sgastat view
# dbname : database to be monitored orapass : password for the oracle user
# dbhost : host or ip address of db instance dbport : port used by the monitored instance (notice: numeric value)
# dbname : database to be monitored
# dbhost : host or ip address of db instance
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=end
require 'rubygems' require 'rubygems'
require 'oci8' require 'oci8'
@ -67,7 +72,6 @@ def runQuery (name,query)
rows.close rows.close
end end
# #
# Queries # Queries
# #
@ -98,14 +102,12 @@ log_buffer_query = "SELECT TO_CHAR(ROUND(SUM(decode(pool, NULL,
decode(name, 'log_buffer', (bytes)/(1024*1024),0),0)),2)) sga_lbuffer decode(name, 'log_buffer', (bytes)/(1024*1024),0),0)),2)) sga_lbuffer
from V$SGASTAT" from V$SGASTAT"
memory_components = { "fixed_area" => fixed_area_query, memory_components = { "fixed_area" => fixed_area_query,
"buffer_cache" => buffer_cache_query, "buffer_cache" => buffer_cache_query,
"java_pool" => java_pool_query, "java_pool" => java_pool_query,
"large_pool" => large_pool_query, "large_pool" => large_pool_query,
"log_buffer" => log_buffer_query, "log_buffer" => log_buffer_query,
"shared_pool" => shared_pool_query "shared_pool" => shared_pool_query }
}
# #
# autoconf # autoconf

View file

@ -14,13 +14,12 @@ require 'mysql'
require 'yaml' require 'yaml'
class Grapher class Grapher
def initialize(db_conf) def initialize(db_conf)
@db_conf = db_conf @db_conf = db_conf
end end
def config def config
puts <<-END_CONFIG puts <<~END_CONFIG
graph_title Delayed_Jobs Queue Size graph_title Delayed_Jobs Queue Size
graph_args -l 0 graph_args -l 0
graph_vlabel jobs to be run graph_vlabel jobs to be run
@ -39,7 +38,6 @@ jobs.type GAUGE
value = result.fetch_hash.values.first value = result.fetch_hash.values.first
puts "jobs.value #{value}" puts "jobs.value #{value}"
end end
end end
if __FILE__ == $0 if __FILE__ == $0

View file

@ -20,7 +20,6 @@ SERVICE_F = '/etc/services'
PORT = /^[\d]+(\.[\d]+){0,1}$/ === SERVICE ? SERVICE : %x[grep #{SERVICE} #{SERVICE_F}].split("\t\t")[1].split('/')[0] PORT = /^[\d]+(\.[\d]+){0,1}$/ === SERVICE ? SERVICE : %x[grep #{SERVICE} #{SERVICE_F}].split("\t\t")[1].split('/')[0]
class PortMonit < Munin::Plugin class PortMonit < Munin::Plugin
graph_attributes "#{SERVICE} port usage, known as #{PORT}", graph_attributes "#{SERVICE} port usage, known as #{PORT}",
:category => 'network', :category => 'network',
:info => 'This graph shows connection split by the state of the socket.', :info => 'This graph shows connection split by the state of the socket.',
@ -55,10 +54,8 @@ class PortMonit < Munin::Plugin
:type => :GAUGE, :min => 0 :type => :GAUGE, :min => 0
def retrieve_values def retrieve_values
@_netstat = %x[netstat -n -P tcp | egrep "\.#{PORT} "].split("\n") @_netstat = %x[netstat -n -P tcp | egrep "\.#{PORT} "].split("\n")
{ :ESTABLISHED => count(@_netstat, 'ESTABLISHED'), { :ESTABLISHED => count(@_netstat, 'ESTABLISHED'),
:CLOSE_WAIT => count(@_netstat, 'CLOSE_WAIT'), :CLOSE_WAIT => count(@_netstat, 'CLOSE_WAIT'),
:CLOSING => count(@_netstat, 'CLOSING'), :CLOSING => count(@_netstat, 'CLOSING'),
@ -69,6 +66,7 @@ class PortMonit < Munin::Plugin
end end
private private
def count(source, regex) def count(source, regex)
@_result = 0 @_result = 0

View file

@ -24,10 +24,10 @@ passenger_rss = nil
`#{memory_stats_command}`.each_line do |line| `#{memory_stats_command}`.each_line do |line|
next unless /### Total private dirty RSS: (\d+\.\d+) MB/.match(line) next unless /### Total private dirty RSS: (\d+\.\d+) MB/.match(line)
passenger_rss = $~[1] unless apache_rss.nil? passenger_rss = $~[1] unless apache_rss.nil?
apache_rss ||= $~[1] apache_rss ||= $~[1]
end end
puts "apache_rss.value #{apache_rss}" puts "apache_rss.value #{apache_rss}"
puts "passenger_rss.value #{passenger_rss}" puts "passenger_rss.value #{passenger_rss}"

View file

@ -39,4 +39,3 @@ puts "max.value #{max}"
puts "count.value #{count}" puts "count.value #{count}"
puts "active.value #{active}" puts "active.value #{active}"
puts "queued.value #{queued.to_i}" puts "queued.value #{queued.to_i}"

View file

@ -1,7 +1,7 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
def output_config def output_config
puts <<-END puts <<~END
graph_category webserver graph_category webserver
graph_title status graph_title status
graph_vlabel count graph_vlabel count

View file

@ -98,7 +98,5 @@ open(url, :http_basic_authentication=>[user, pwd]) do |f|
key = line.gsub!(/(<[^>]*>)|\n|\t| /s, "") key = line.gsub!(/(<[^>]*>)|\n|\t| /s, "")
one_liners = one_liners + 1 one_liners = one_liners + 1
end end
end end
end end

View file

@ -1,36 +1,41 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# munin plugin to retrieve connection statistics from the web admin interface
# on a Linksys AG241v2 ADSL modem
# Makes use of the http://modemaddress/ADSLCStatus.htm page
#This plugin has only been tested on a Debian testing system =begin
# This modem also has some basic SNMP support so you can configure it munin plugin to retrieve connection statistics from the web admin interface
# as per the instructions on the munin wiki on a Linksys AG241v2 ADSL modem
# http://munin.projects.linpro.no/wiki/Using_SNMP_plugins Makes use of the http://modemaddress/ADSLCStatus.htm page
# By default the SNMP server is disabled, you can enable it in the web admin
# You will need to set up the "virtual node" configuration as detailed
# for snmp plugins
# Plugin will require some configuration in /etc/munin/plugin-conf.d/ag241_MODEMADDRESS This plugin has only been tested on a Debian testing system
# e.g.
# [ag241_vocume.stargate_*]
# env.user admin
# env.pass password
# #env.port 80
# Once you have the above config set you will need to symlink the plugin to This modem also has some basic SNMP support so you can configure it
# /etc/munin/plugins/ag241_MODEMADDRESS_syncrate as per the instructions on the munin wiki
# /etc/munin/plugins/ag241_MODEMADDRESS_attenutation http://munin.projects.linpro.no/wiki/Using_SNMP_plugins
# /etc/munin/plugins/ag241_MODEMADDRESS_noise By default the SNMP server is disabled, you can enable it in the web admin
# now restart munin-node. You will need to set up the "virtual node" configuration as detailed
# hopefully in 20-30mins you will have some nice graphs for snmp plugins
Plugin will require some configuration in /etc/munin/plugin-conf.d/ag241_MODEMADDRESS
e.g.
[ag241_vocume.stargate_*]
env.user admin
env.pass password
#env.port 80
#Some magical munin foo... Once you have the above config set you will need to symlink the plugin to
/etc/munin/plugins/ag241_MODEMADDRESS_syncrate
/etc/munin/plugins/ag241_MODEMADDRESS_attenutation
/etc/munin/plugins/ag241_MODEMADDRESS_noise
now restart munin-node.
hopefully in 20-30mins you will have some nice graphs
Some magical munin foo...
#%# family=manual #%# family=manual
#%# capabilities= #%# capabilities=
=end
# Require this module, it is part of the standard ruby lib AFAIK # Require this module, it is part of the standard ruby lib AFAIK
require 'net/http' require 'net/http'

View file

@ -31,7 +31,6 @@ require 'mechanize'
require 'digest/md5' require 'digest/md5'
require 'nokogiri' require 'nokogiri'
def output def output
nics = Hash.new nics = Hash.new
nics["LAN"] = Hash.new nics["LAN"] = Hash.new
@ -135,7 +134,6 @@ def output
end end
end end
def config def config
# build the configuration for graphs # build the configuration for graphs
puts "multigraph if_packets" puts "multigraph if_packets"
@ -244,7 +242,6 @@ def config
end end
end end
# main # main
if ARGV.length == 1 and ARGV[0] == 'config' if ARGV.length == 1 and ARGV[0] == 'config'
config() config()

View file

@ -89,6 +89,7 @@ when "config"
if not is_vb_valid(vb, subchannel) if not is_vb_valid(vb, subchannel)
next next
end end
puts "#{field_name(unit, vb, letter)}.label #{label(unit, vb)}" puts "#{field_name(unit, vb, letter)}.label #{label(unit, vb)}"
end end
end end
@ -96,7 +97,6 @@ when "config"
exit 0 exit 0
end end
units.each do |unit| units.each do |unit|
SNMP::Manager.open(:Host => unit, SNMP::Manager.open(:Host => unit,
:Community => community, :Community => community,
@ -105,6 +105,7 @@ units.each do |unit|
if not is_vb_valid(vb, subchannel) if not is_vb_valid(vb, subchannel)
next next
end end
puts "#{field_name(unit, vb, letter)}.value #{vb.value.to_f / 100}" puts "#{field_name(unit, vb, letter)}.value #{vb.value.to_f / 100}"
end end
end end

View file

@ -1,32 +1,38 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# Plugin to monitor the number of invalid access to sshd per country
# =begin
# Require read permissions for SYSLOG
# ref) ls -l /var/log/secure Plugin to monitor the number of invalid access to sshd per country
# Require geoip rubygem
# ref) http://geoip.rubyforge.org/ Require read permissions for SYSLOG
# Require GeoIP-database for searching ip or host for the country ref) ls -l /var/log/secure
# ref) http://www.maxmind.com/app/geoip_country Require geoip rubygem
# ref) http://geoip.rubyforge.org/
# Parameters: Require GeoIP-database for searching ip or host for the country
# config (required) ref) http://www.maxmind.com/app/geoip_country
# autoconf (optional - used by munin-config)
# Parameters:
# $Log$ config (required)
# Revision 1.0 2010/12/25 11:56:12 hirata yoshiyuki autoconf (optional - used by munin-config)
# released.
# $Log$
# Magick markers (optional): Revision 1.0 2010/12/25 11:56:12 hirata yoshiyuki
released.
Magick markers (optional):
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
#
# config example for /etc/munin/plugin-conf.d/munin-node config example for /etc/munin/plugin-conf.d/munin-node
#[sshd_invalid_countries_ruby] [sshd_invalid_countries_ruby]
#user root user root
#group root group root
#env.logfile /var/log/secure env.logfile /var/log/secure
#env.geoip /home/you/GeoIP.dat env.geoip /home/you/GeoIP.dat
#env.loadpath /usr/local/lib/ruby/gems/1.9.1/gems/geoip-0.8.8/lib/ env.loadpath /usr/local/lib/ruby/gems/1.9.1/gems/geoip-0.8.8/lib/
=end
require (ENV['loadpath'] || '') + 'geoip' require (ENV['loadpath'] || '') + 'geoip'

View file

@ -1,44 +1,49 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# thin_memory - A munin plugin for Linux to monitor memory size of each individual thin process
# =begin
# For Linux ONLY !
# DOES NOT WORK on OSX, Solaris or BSD. thin_memory - A munin plugin for Linux to monitor memory size of each individual thin process
# only linux, because this script relies on proc filesystem
# For Linux ONLY !
# Original author: DOES NOT WORK on OSX, Solaris or BSD.
# Frederico de Souza Araujo - fred.the.master@gmail.com only linux, because this script relies on proc filesystem
# http://www.frederico-araujo.com
# Original author:
# Usurper: Frederico de Souza Araujo - fred.the.master@gmail.com
# Adam Michel - elfurbe@furbism.com http://www.frederico-araujo.com
# http://www.furbism.com
# Usurper:
# Originally based on: Adam Michel - elfurbe@furbism.com
# thin_process_memory - http://www.furbism.com
# A munin plugin to monitor memory size of
# each individual thin process Originally based on:
# by Ben VandenBos and Avvo, Inc. thin_process_memory -
# A munin plugin to monitor memory size of
# This program is free software; you can redistribute it and/or modify each individual thin process
# it under the terms of the GNU General Public License version 2 by Ben VandenBos and Avvo, Inc.
# as published by the Free Software Foundation.
# This program is free software; you can redistribute it and/or modify
# This program is distributed in the hope that it will be useful, it under the terms of the GNU General Public License version 2
# but WITHOUT ANY WARRANTY; without even the implied warranty of as published by the Free Software Foundation.
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# You should have received a copy of the GNU General Public License along MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# with this program; if not, write to the Free Software Foundation, Inc., GNU General Public License for more details.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# 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.
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=end
module Munin module Munin
class ThinProcessMemory class ThinProcessMemory
# run main method # run main method
def run def run
instances = get_pids() instances = get_pids()
@ -67,7 +72,6 @@ module Munin
def autoconf def autoconf
get_pids().length > 0 get_pids().length > 0
end end
end end
end end

View file

@ -1,45 +1,50 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# thin_threads -
# A munin plugin for Linux to monitor how many threads per thin process =begin
#
# For Linux ONLY ! thin_threads -
# DOES NOT WORK on OSX, Solaris or BSD. A munin plugin for Linux to monitor how many threads per thin process
# only linux, because this script relies on proc filesystem
# For Linux ONLY !
# Original author: DOES NOT WORK on OSX, Solaris or BSD.
# Frederico de Souza Araujo - fred.the.master@gmail.com only linux, because this script relies on proc filesystem
# http://www.frederico-araujo.com
# Original author:
# Usurper: Frederico de Souza Araujo - fred.the.master@gmail.com
# Adam Michel - elfurbe@furbism.com http://www.frederico-araujo.com
# http://www.furbism.com
# Usurper:
# Originally based on: Adam Michel - elfurbe@furbism.com
# thin_process_memory - http://www.furbism.com
# A munin plugin to monitor memory size of
# each individual thin process Originally based on:
# by Ben VandenBos and Avvo, Inc. thin_process_memory -
# A munin plugin to monitor memory size of
# This program is free software; you can redistribute it and/or modify each individual thin process
# it under the terms of the GNU General Public License version 2 by Ben VandenBos and Avvo, Inc.
# as published by the Free Software Foundation.
# This program is free software; you can redistribute it and/or modify
# This program is distributed in the hope that it will be useful, it under the terms of the GNU General Public License version 2
# but WITHOUT ANY WARRANTY; without even the implied warranty of as published by the Free Software Foundation.
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# You should have received a copy of the GNU General Public License along MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# with this program; if not, write to the Free Software Foundation, Inc., GNU General Public License for more details.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# 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.
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=end
module Munin module Munin
class ThinThreads class ThinThreads
def run def run
instances = get_pids() instances = get_pids()
instances.each do |instance| instances.each do |instance|
@ -71,7 +76,6 @@ module Munin
def autoconf def autoconf
get_pids().length > 0 get_pids().length > 0
end end
end end
end end

View file

@ -1,42 +1,47 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# thin_peak_memory -
# A munin plugin for Linux to monitor the maximum memory size =begin
# that an each individual thin process has reached
# thin_peak_memory -
# For Linux ONLY ! A munin plugin for Linux to monitor the maximum memory size
# DOES NOT WORK on OSX, Solaris or BSD. that an each individual thin process has reached
# only linux, because this script relies on proc filesystem
# For Linux ONLY !
# Author: DOES NOT WORK on OSX, Solaris or BSD.
# Frederico de Souza Araujo - fred.the.master@gmail.com only linux, because this script relies on proc filesystem
# http://www.frederico-araujo.com
# Author:
# Based on: Frederico de Souza Araujo - fred.the.master@gmail.com
# thin_process_memory - http://www.frederico-araujo.com
# A munin plugin to monitor memory size of
# each individual thin process Based on:
# by Ben VandenBos and Avvo, Inc. thin_process_memory -
# A munin plugin to monitor memory size of
# This program is free software; you can redistribute it and/or modify each individual thin process
# it under the terms of the GNU General Public License version 2 by Ben VandenBos and Avvo, Inc.
# as published by the Free Software Foundation.
# This program is free software; you can redistribute it and/or modify
# This program is distributed in the hope that it will be useful, it under the terms of the GNU General Public License version 2
# but WITHOUT ANY WARRANTY; without even the implied warranty of as published by the Free Software Foundation.
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# You should have received a copy of the GNU General Public License along MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# with this program; if not, write to the Free Software Foundation, Inc., GNU General Public License for more details.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# 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.
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
=end
module Munin module Munin
class ThinPeakMemory class ThinPeakMemory
def run def run
instances = get_pids() instances = get_pids()
instances.each do |instance| instances.each do |instance|
@ -69,7 +74,6 @@ module Munin
def autoconf def autoconf
get_pids().length > 0 get_pids().length > 0
end end
end end
end end

View file

@ -32,6 +32,7 @@ module Munin
chunks = line.strip.split(/\s+/, 5) chunks = line.strip.split(/\s+/, 5)
pid, pcmd = chunks[0], chunks[4] pid, pcmd = chunks[0], chunks[4]
next if pid !~ /\A\d+\z/ or pcmd !~ /worker/ next if pid !~ /\A\d+\z/ or pcmd !~ /worker/
result << pid.to_i result << pid.to_i
end end
result result

View file

@ -32,6 +32,7 @@ module Munin
chunks = line.strip.split(/\s+/, 5) chunks = line.strip.split(/\s+/, 5)
pid, pcmd = chunks[0], chunks[4] pid, pcmd = chunks[0], chunks[4]
next if pid !~ /\A\d+\z/ or pcmd !~ /worker/ next if pid !~ /\A\d+\z/ or pcmd !~ /worker/
result << pid.to_i result << pid.to_i
end end
result result