mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 10:39:53 +00:00
Ruby plugins: apply code changes as suggested by "rubocop --auto-correct"
This commit is contained in:
parent
b0b39b018e
commit
809639ab65
33 changed files with 904 additions and 910 deletions
|
@ -21,38 +21,35 @@ 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
|
||||
3) oci8 - DBI gem for connecting to Oracle
|
||||
* instruction of installing oci8 is available here:
|
||||
http://ruby-oci8.rubyforge.org/en/InstallBinaryPackage.html
|
||||
1) env.ORACLE_HOME set in munin-node
|
||||
2) rubygems
|
||||
3) oci8 - DBI gem for connecting to Oracle
|
||||
* instruction of installing oci8 is available here:
|
||||
http://ruby-oci8.rubyforge.org/en/InstallBinaryPackage.html
|
||||
|
||||
Usage:
|
||||
1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
|
||||
2) chmod to allow executable to others
|
||||
3) create symbolic link in /etc/munin/plugins
|
||||
1) copy this script to the munin install plugins directory (e.g. /usr/share/munin/plugins)
|
||||
2) chmod to allow executable to others
|
||||
3) create symbolic link in /etc/munin/plugins
|
||||
ln -s /usr/share/munin/plugins/oracle_orcl_sga.rb /etc/munin/plugins/oracle_orcl_sga.rb
|
||||
|
||||
Parameters:
|
||||
autoconf
|
||||
config (required)
|
||||
autoconf
|
||||
config (required)
|
||||
|
||||
Configurable variables:
|
||||
orauser : oracle user who has select privilege to query v$sgastat view
|
||||
orapass : password for the oracle user
|
||||
dbport : port used by the monitored instance (notice: numeric value)
|
||||
dbname : database to be monitored
|
||||
dbhost : host or ip address of db instance
|
||||
|
||||
orauser : oracle user who has select privilege to query v$sgastat view
|
||||
orapass : password for the oracle user
|
||||
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
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=end
|
||||
|
||||
|
||||
require 'rubygems'
|
||||
require 'oci8'
|
||||
|
||||
|
@ -68,7 +65,7 @@ tnsname = "(DESCRIPTION =
|
|||
|
||||
def runQuery(name, query)
|
||||
rows = $conn.exec(query)
|
||||
puts "#{name}.value #{rows.fetch().to_s}"
|
||||
puts "#{name}.value #{rows.fetch}"
|
||||
rows.close
|
||||
end
|
||||
|
||||
|
@ -102,35 +99,36 @@ log_buffer_query = "SELECT TO_CHAR(ROUND(SUM(decode(pool, NULL,
|
|||
decode(name, 'log_buffer', (bytes)/(1024*1024),0),0)),2)) sga_lbuffer
|
||||
from V$SGASTAT"
|
||||
|
||||
memory_components = { "fixed_area" => fixed_area_query,
|
||||
"buffer_cache" => buffer_cache_query,
|
||||
"java_pool" => java_pool_query,
|
||||
"large_pool" => large_pool_query,
|
||||
"log_buffer" => log_buffer_query,
|
||||
"shared_pool" => shared_pool_query }
|
||||
memory_components = { 'fixed_area' => fixed_area_query,
|
||||
'buffer_cache' => buffer_cache_query,
|
||||
'java_pool' => java_pool_query,
|
||||
'large_pool' => large_pool_query,
|
||||
'log_buffer' => log_buffer_query,
|
||||
'shared_pool' => shared_pool_query }
|
||||
|
||||
#
|
||||
# autoconf
|
||||
#
|
||||
if ARGV[0] == "autoconf"
|
||||
case ARGV[0]
|
||||
when 'autoconf'
|
||||
if tnsname.length > 1 && orauser.length > 1 && orapass.length > 1
|
||||
puts "yes"
|
||||
puts 'yes'
|
||||
else
|
||||
puts "no"
|
||||
puts 'no'
|
||||
puts "Usage: #{__FILE__} autoconf|conf"
|
||||
end
|
||||
exit 0
|
||||
#
|
||||
# config definition
|
||||
#
|
||||
elsif ARGV[0] == "config"
|
||||
puts "graph_args --base 1024k -r --lower-limit 0"
|
||||
when 'config'
|
||||
puts 'graph_args --base 1024k -r --lower-limit 0'
|
||||
puts "graph_title Oracle SGA from #{dbname}"
|
||||
puts "graph_category db"
|
||||
puts "graph_info This graph shows the SGA memory usage (in MB)"
|
||||
puts "graph_vlabel MB"
|
||||
puts "graph_scale no"
|
||||
puts "graph_period second"
|
||||
puts 'graph_category db'
|
||||
puts 'graph_info This graph shows the SGA memory usage (in MB)'
|
||||
puts 'graph_vlabel MB'
|
||||
puts 'graph_scale no'
|
||||
puts 'graph_period second'
|
||||
|
||||
memory_components.keys.each do |m|
|
||||
puts "#{m}.label #{m}"
|
||||
|
@ -138,7 +136,7 @@ elsif ARGV[0] == "config"
|
|||
puts "#{m}.type GAUGE"
|
||||
|
||||
# make sure fixed_area is at the bottom of the stack
|
||||
if (m == 'fixed_area')
|
||||
if m == 'fixed_area'
|
||||
puts "#{m}.draw AREA"
|
||||
else
|
||||
puts "#{m}.draw STACK"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue