Top Level Namespace

Defined Under Namespace

Modules: AETK Classes: MyCLI, StreamingUploader, String

Constant Summary collapse

JAVA_BIN =
"/usr/java/default/bin/java"
ABIQUO_BASE_DIR =
'/opt/abiquo'
TOMCAT_DIR =
'/opt/abiquo/tomcat'
TOMCAT_PID_FILE =
'/opt/abiquo/tomcat/work/catalina.pid'
ABIQUO_VERSION =
"1.6"
ABIQUO_SERVER_CONFIG =
'/opt/abiquo/config/server.xml'
ABIQUO_VIRTUALFACTORY_CONFIG =
'/opt/abiquo/config/virtualfactory.xml'
ABIQUO_VSM_CONFIG =
'/opt/abiquo/config/vsm.xml'
ABIQUO_NODECOLLECTOR_CONFIG =
'/opt/abiquo/config/nodecollector.xml'
ABIQUO_AM_CONFIG =
'/opt/abiquo/config/am.xml'
ABIQUO_BPMASYNC_CONFIG =
'/opt/abiquo/config/bpm-async.xml'
Log =

INIT

Logger.new('/var/log/abiquo-etk.log')
TOMCAT_SERVER_CONFIG =
'/opt/abiquo/tomcat/conf/Catalina/localhost/server.xml'
TOMCAT_SERVER_BUILTIN_CONFIG =
'/opt/abiquo/tomcat/webapps/server/META-INF/context.xml'
TOMCAT_API_CONFIG =
'/opt/abiquo/tomcat/conf/Catalina/localhost/api.xml'
TOMCAT_API_BUILTIN_CONFIG =
'/opt/abiquo/tomcat/webapps/api/META-INF/context.xml'
TOMCAT_BPMASYNC_CONFIG =
'/opt/abiquo/tomcat/conf/Catalina/localhost/bpm-async.xml'
TOMCAT_BPMASYNC_BUILTIN_CONFIG =
'/opt/abiquo/tomcat/webapps/bpm-async/META-INF/context.xml'
CONFIG_FILE =
'/etc/sysconfig/abiquo-server'

Instance Method Summary collapse

Methods included from AETK

#detect_install_type, load_plugins

Methods included from AETK::OutputFormatters

#two_cols

Instance Method Details

#abiquo_am_configObject



124
125
126
127
128
129
# File 'lib/abiquo-etk.rb', line 124

def abiquo_am_config 
  cfg = nil
  if File.exist? ABIQUO_AM_CONFIG
    cfg = Nokogiri::XML(File.new(ABIQUO_AM_CONFIG))
  end
end

#abiquo_base_dirObject



61
62
63
# File 'lib/abiquo-etk.rb', line 61

def abiquo_base_dir
  return ABIQUO_BASE_DIR
end

#abiquo_bpmasync_configObject



131
132
133
134
135
136
137
# File 'lib/abiquo-etk.rb', line 131

def abiquo_bpmasync_config
  cfg = nil
  if File.exist? ABIQUO_BPMASYNC_CONFIG
    cfg = Nokogiri::XML(File.new(ABIQUO_BPMASYNC_CONFIG))
  end
  return cfg
end

#abiquo_components_installedObject



77
78
79
80
81
# File 'lib/abiquo-etk.rb', line 77

def abiquo_components_installed
  c = Dir["#{TOMCAT_DIR}/webapps/*"].find_all { |d| File.directory? d }
  c.map { |d| d.split('/').last }

end

#abiquo_editionObject



38
39
# File 'lib/abiquo-etk.rb', line 38

def abiquo_edition
end

#abiquo_installed?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/abiquo-etk.rb', line 69

def abiquo_installed?
  return (File.directory?('/opt/abiquo') && RPMUtils.rpm_installed?('abiquo-core'))
end

#abiquo_nodecollector_configObject



116
117
118
119
120
121
122
# File 'lib/abiquo-etk.rb', line 116

def abiquo_nodecollector_config 
  cfg = nil
  if File.exist? ABIQUO_NODECOLLECTOR_CONFIG
    cfg = Nokogiri::XML(File.new(ABIQUO_NODECOLLECTOR_CONFIG))
  end
  return cfg
end

#abiquo_rs_settings(file = '/etc/sysconfig/abiquo-rs') ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/abiquo-etk.rb', line 51

def abiquo_rs_settings(file = '/etc/sysconfig/abiquo-rs')
	settings = {}
  File.read(file).each_line do |l|
    next if l.strip.chomp.empty?
    key,val = l.strip.chomp.split('=')
    settings[key.strip.chomp] = val.strip.chomp rescue ''
  end
  settings
end

#abiquo_schema_premium?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/checks/mysql.rb', line 16

def abiquo_schema_premium?
  File.exist? '/var/lib/mysql/kinton/virtualimage_conversions.frm'
end

#abiquo_schema_present?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/checks/mysql.rb', line 12

def abiquo_schema_present?
  File.directory? '/var/lib/mysql/kinton'
end

#abiquo_server_configObject



91
92
93
94
95
96
97
# File 'lib/abiquo-etk.rb', line 91

def abiquo_server_config
  cfg = nil
  if File.exist? ABIQUO_SERVER_CONFIG
    cfg = Nokogiri::XML(File.new(ABIQUO_SERVER_CONFIG))
  end
  return cfg 
end

#abiquo_server_settings(file = '/etc/sysconfig/abiquo-server') ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/abiquo-etk.rb', line 41

def abiquo_server_settings(file = '/etc/sysconfig/abiquo-server')
	settings = {}
  File.read(file).each_line do |l|
    next if l.strip.chomp.empty?
    key,val = l.strip.chomp.split('=')
    settings[key.strip.chomp] = val.strip.chomp rescue ''
  end
  settings
end

#abiquo_tomcat_running?Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
# File 'lib/checks/abiquo_service.rb', line 3

def abiquo_tomcat_running?
  return false if not File.exist?(TOMCAT_PID_FILE)

  pid = File.read(TOMCAT_PID_FILE)
  if `ps #{pid}`.lines.count > 1
    return true
  end
  false
end

#abiquo_virtualfactory_configObject



99
100
101
102
103
104
105
# File 'lib/abiquo-etk.rb', line 99

def abiquo_virtualfactory_config
  cfg  = nil
  if File.exist? ABIQUO_VIRTUALFACTORY_CONFIG
    cfg= Nokogiri::XML(File.new(ABIQUO_VIRTUALFACTORY_CONFIG))
  end
  return cfg
end

#abiquo_vsm_configObject



108
109
110
111
112
113
114
# File 'lib/abiquo-etk.rb', line 108

def abiquo_vsm_config
  cfg = nil
  if File.exist? ABIQUO_VSM_CONFIG
    cfg = Nokogiri::XML(File.new(ABIQUO_VSM_CONFIG))
  end
  return cfg
end

#config_get_attribute(cf, path, attrname) ⇒ Object



47
48
49
# File 'bin/abicli', line 47

def config_get_attribute(cf, path, attrname)
	cf.root.xpath(path).first[attrname] rescue nil
end

#config_get_node(cf, path) ⇒ Object



32
33
34
# File 'bin/abicli', line 32

def config_get_node(cf, path)
	cf.root.xpath(path).first.text rescue nil
end

#config_property(config, path) ⇒ Object



73
74
75
# File 'lib/abiquo-etk.rb', line 73

def config_property(config, path)
  config.root.xpath(path).text.chomp.strip
end

#config_set_attribute(file, path, attrname, val, write_changes = false) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'bin/abicli', line 36

def config_set_attribute(file, path, attrname, val, write_changes = false)
  doc = Nokogiri::XML(File.new(file))
	doc.root.xpath(path).first[attrname] = (val||'')
  if write_changes
    File.open(file, 'w') do |f|
      f.puts doc.to_xml
    end
  end
  return doc
end

#config_set_node(file, path, val, write_changes = false) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'bin/abicli', line 21

def config_set_node(file, path, val, write_changes = false)
  doc = Nokogiri::XML(File.new(file))
	doc.root.xpath(path).first.content = (val || '')
  if write_changes
    File.open(file, 'w') do |f|
      f.puts doc.to_xml
    end
  end
  return doc
end

#create_schemas(user = 'root', password = '') ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'bin/aetk-setup-server', line 10

def create_schemas(user = 'root', password = '')
  cmd = ''
  if password.strip.chomp.empty? 
    cmd = "mysql -u #{user} "
  else
    cmd = "mysql -u #{user} -p#{password} "
  end

  if `#{cmd} -e 'show databases'|grep kinton`.strip.chomp.empty?
    cib = false
    if File.exist? '/etc/abiquo-release'
      if File.readlines('/etc/abiquo-release').join =~ /cloud-in-a-box/
        Log.info 'Cloud in a Box profile found'
        cib = true
      end
    end
    if cib
      out = `mysql -u root < /usr/share/doc/abiquo-16-pocsetup/cloud-in-a-box.sql`
      if $?.exitstatus == 0 
        Log.info 'cloud-in-a-box schema imported succesfully.'
      else
        Log.error "Error importing cloud-in-a-box schema: #{out}"
      end
    else
      out = `mysql -u root < /usr/share/doc/abiquo-server/database/kinton-schema.sql`
      if $?.exitstatus == 0 
        Log.info 'kinton-schema imported succesfully.'
      else
        Log.error "Error importing kinton-schema: #{out}"
      end
      out = `mysql -u root < /usr/share/doc/abiquo-server/database/kinton-premium-schema.sql`
      if $?.exitstatus == 0 
        Log.info 'kinton-premium-schema imported succesfully.'
      else
        Log.error "Error importing kinton-premium-schema: #{out}"
      end
    end
  else
    Log.warn 'kinton schema found. Skipping schema creation.'
  end
  
end

#find_version(file) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/checks/abiquo_version.rb', line 3

def find_version(file)
  File.open(file) do |f|
    m = f.read.match(/return\s+"([\da-zA-Z\.\-)]+?)"\s*;/)
    version = m[1]
    if version and not version.strip.chomp.empty?
      two_cols('Abiquo Version:'.bold, version)
    else
      two_cols 'Abiquo Version:'.bold, 'Unknown'	
    end
  end
end

#fw_rules_defined?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/checks/firewall.rb', line 3

def fw_rules_defined?
  not `iptables -nL | grep -iv ^chain | grep -iv ^target | grep -v ^$`.empty?
end

#helpObject



103
104
105
# File 'lib/abicli/commands/set.rb', line 103

def help
  puts "Available subcommands:"
end

#hvpasswd_match?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/checks/hv_passwords.rb', line 7

def hvpasswd_match?
  vf_cfg = abiquo_virtualfactory_config
  vsm_cfg  = abiquo_vsm_config
  nc_cfg = abiquo_nodecollector_config
  #check libvirt 
  vsm_pwd = config_property(vsm_cfg, 'hypervisors/libvirtAgent/password')
  nc_pwd = config_property(nc_cfg, 'wsman/password')
  vf_pwd = config_property(vf_cfg, 'rimp/password')
  if (vsm_pwd != nc_pwd) or (vsm_pwd != vf_pwd) or (nc_pwd != vf_pwd)
    return false
  end
  
  #check vmware
  vsm_pwd = config_property(vsm_cfg, 'hypervisors/vmware/password')
  nc_pwd = config_property(nc_cfg, 'hypervisors/esxi/password')
  vf_pwd = config_property(vf_cfg, 'hypervisors/vmware/password')
  if (vsm_pwd != nc_pwd) or (vsm_pwd != vf_pwd) or (nc_pwd != vf_pwd)
    return false
  end
  #check hyperv
  vsm_pwd = config_property(vsm_cfg, 'hypervisors/hyperv/password')
  nc_pwd = config_property(nc_cfg, 'hypervisors/hyperv/password')
  vf_pwd = config_property(vf_cfg, 'hypervisors/hyperv/password')
  if (vsm_pwd != nc_pwd) or (vsm_pwd != vf_pwd) or (nc_pwd != vf_pwd)
    return false
  end
  #check xenserver
  vsm_pwd = config_property(vsm_cfg, 'hypervisors/xenserver/password')
  nc_pwd = config_property(nc_cfg, 'hypervisors/xenserver/password')
  vf_pwd = config_property(vf_cfg, 'hypervisors/xenserver/password')
  if (vsm_pwd != nc_pwd) or (vsm_pwd != vf_pwd) or (nc_pwd != vf_pwd)
    return false
  end
  true
end

#java_ok?Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/checks/java.rb', line 3

def java_ok?
  if not File.exist? JAVA_BIN
    Log.error "Java binary not found in #{JAVA_BIN}"
    return false
  end

  if `java -version 2>&1 | grep '64-Bit Server'`.empty?
    Log.error "Java 64-Bit runtime not found"
    return false
  end

  return true
end

#mapping_exist?(key) ⇒ Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/abicli/commands/set.rb', line 95

def mapping_exist?(key)
  $command_mappings.has_key? key
end

#mapping_has_proc?(comp) ⇒ Boolean

Returns:

  • (Boolean)


99
100
101
# File 'lib/abicli/commands/set.rb', line 99

def mapping_has_proc?(comp)
  $command_mappings[comp].is_a? Proc
end

#mysqld_installed?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/checks/mysql.rb', line 8

def mysqld_installed?
  RPMUtils.rpm_installed?('mysql-server')
end

#mysqld_running?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/checks/mysql.rb', line 4

def mysqld_running?
  return true if `service mysqld status`.strip.chomp != 'mysqld is stopped'
end

#nfs_server_running?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/checks/nfs.rb', line 4

def nfs_server_running?
  return ((`exportfs`.lines.first.strip.chomp == '/opt/vm_repository') rescue false)
end

#os_versionObject



1
2
3
# File 'lib/checks/os_version.rb', line 1

def os_version
  File.read('/etc/redhat-release').strip.chomp rescue 'Unknown'
end


53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'bin/abiquo-check-16-install', line 53

def print_nodecollector_config
  puts "NODE COLLECTOR".bold
  puts "--------------"
  sc = abiquo_nodecollector_config
  two_cols("  VMWARE User:", "#{config_property(sc, 'hypervisors/esxi/user')}")
  two_cols("  VMWARE Password:", "#{config_property(sc, 'hypervisors/esxi/password')}")
  two_cols("  Hyper-V User:", "#{config_property(sc, 'hypervisors/hyperv/user')}")
  two_cols("  Hyper-V Password:", "#{config_property(sc, 'hypervisors/hyperv/password')}")
  two_cols("  LibVirt User:", "#{config_property(sc, 'wsman/user')}")
  two_cols("  LibVirt Password:", "#{config_property(sc, 'wsman/password')}")
  two_cols("  LibVirt Port:", "#{config_property(sc, 'wsman/port')}")
  two_cols("  XenServer User:", "#{config_property(sc, 'hypervisors/xenserver/user')}")
  two_cols("  XenServer Password:", "#{config_property(sc, 'hypervisors/xenserver/password')}")
end


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/abicli/commands/remote-services-settings.rb', line 11

def print_remote_services_settings
  f = ABIQUO_BASE_DIR + '/config/virtualfactory.xml'
  doc = Nokogiri::XML(File.new(f))
  puts
  two_cols("NFS Repository:".bold, config_get_node(doc, 'hypervisors/xenserver/abiquoRepository'))
  two_cols("CIFS Repository:".bold, config_get_node(doc, 'hypervisors/hyperv/destinationRepositoryPath'))
  two_cols("Storage Link URL:".bold, config_get_node(doc, 'storagelink/address'))
  two_cols("Storage Link User:".bold, config_get_node(doc, 'storagelink/user'))
  two_cols("Storage Link Password:".bold, config_get_node(doc, 'storagelink/password'))
  puts
end


19
20
21
22
23
24
25
26
27
28
# File 'bin/abiquo-check-16-install', line 19

def print_server_config
  puts "SERVER CONFIG".bold
  puts "-------------"
  sc = abiquo_server_config
  puts "  Version: #{config_property(sc, 'abicloud/version')}"
  puts "  Event Sink Address: #{config_property(sc, 'eventSinkAddress')}"
  puts "  API Location: #{config_property sc, 'apiLocation'}"
  puts "  Repository Space: #{config_property(sc,'repositorySpace')}"
  puts "  Session Timeout: #{config_property(sc, 'sessionTimeout')}"
end


11
12
13
14
15
16
17
18
# File 'lib/abicli/commands/server-settings.rb', line 11

def print_server_settings
  f = ABIQUO_BASE_DIR + '/config/server.xml'
  doc = Nokogiri::XML(File.new(f))
  puts
  two_cols("Event Sink URL:".bold, config_get_node(doc, 'eventSinkAddress'))
  two_cols("Session Timeout:".bold, config_get_node(doc, 'sessionTimeout'))
  puts
end


30
31
32
33
34
35
36
# File 'bin/abiquo-check-16-install', line 30

def print_virtualfactory_config
  puts "VIRTUAL FACTORY".bold
  puts "---------------"
  sc = abiquo_virtualfactory_config
  two_cols("  Hyper-V LocalRepo:", "#{config_property(sc, 'hypervisors/hyperv/localRepositoryPath')}")
  two_cols("  Hyper-V DestRepo:", "#{config_property(sc, 'hypervisors/hyperv/destinationRepositoryPath')}")
end


38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'bin/abiquo-check-16-install', line 38

def print_vsm_config
  puts "VIRTUAL SYSTEM MONITOR".bold
  puts "----------------------"
  sc = abiquo_vsm_config
  two_cols("  VMWARE User:", "#{config_property(sc, 'hypervisors/vmware/user')}")
  two_cols("  VMWARE Password:", "#{config_property(sc, 'hypervisors/vmware/password')}")
  two_cols("  Hyper-V User:", "#{config_property(sc, 'hypervisors/hyperv/user')}")
  two_cols("  Hyper-V Password:", "#{config_property(sc, 'hypervisors/hyperv/password')}")
  two_cols("  LibVirt User:", "#{config_property(sc, 'hypervisors/libvirtAgent/user')}")
  two_cols("  LibVirt Password:", "#{config_property(sc, 'hypervisors/libvirtAgent/password')}")
  two_cols("  LibVirt Port:", "#{config_property(sc, 'hypervisors/libvirtAgent/port')}")
  two_cols("  XenServer User:", "#{config_property(sc, 'hypervisors/xenserver/user')}")
  two_cols("  XenServer Password:", "#{config_property(sc, 'hypervisors/xenserver/password')}")
end

#service_installed?(service_name) ⇒ Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/abiquo-etk.rb', line 87

def service_installed?(service_name)
  File.exist?("/etc/rc.d/init.d/#{service_name}")
end

#set_database_host(val) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/abicli/commands/set.rb', line 9

def set_database_host(val)
  url = "jdbc:mysql://#{val}:3306/kinton?autoReconnect=true"
  [TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
    if File.exist?(f)
      config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'url', url, true)
    end
  end
  
  [TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
    if File.exist?(f)
      config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'url', url,true)
      config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'url', url, true)
    end
  end
  [TOMCAT_BPMASYNC_CONFIG, TOMCAT_BPMASYNC_BUILTIN_CONFIG].each do |f|
    if File.exist?(f)
      config_set_attribute(f, 'Resource[@name="jdbc/abiquoBpmDB"]', 'url', url, true)
    end
  end
end

#set_database_password(val) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/abicli/commands/set.rb', line 49

def set_database_password(val)
  [TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
    if File.exist?(f)
      config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'password', val, true)
    end
  end
  [TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
    if File.exist?(f)
      config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'password', val, true)
      config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'password', val, true)
    end
  end
  [TOMCAT_BPMASYNC_CONFIG, TOMCAT_BPMASYNC_BUILTIN_CONFIG].each do |f|
    if File.exist?(f)
      config_set_attribute(f, 'Resource[@name="jdbc/abiquoBpmDB"]', 'password', val, true)
    end
  end
end

#set_database_user(val) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/abicli/commands/set.rb', line 30

def set_database_user(val)
  [TOMCAT_API_BUILTIN_CONFIG, TOMCAT_API_CONFIG].each do |f|
    if File.exist?(f)
      config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'username', val, true)
    end
  end
  [TOMCAT_SERVER_CONFIG, TOMCAT_SERVER_BUILTIN_CONFIG].each do |f|
    if File.exist?(f)
      config_set_attribute(f, 'Resource[@name="jdbc/abiquoDB"]', 'username', val, true)
      config_set_attribute(f, 'Resource[@name="jdbc/heartbeatDB"]', 'username', val, true)
    end
  end
  [TOMCAT_BPMASYNC_CONFIG, TOMCAT_BPMASYNC_BUILTIN_CONFIG].each do |f|
    if File.exist?(f)
      config_set_attribute(f, 'Resource[@name="jdbc/abiquoBpmDB"]', 'username', val, true)
    end
  end
end

#set_nfs_repository(val) ⇒ Object



68
69
70
71
72
73
74
75
76
77
# File 'lib/abicli/commands/set.rb', line 68

def set_nfs_repository(val)
  f = ABIQUO_BASE_DIR + '/config/am.xml' 
  if File.exist? f
    config_set_node(f, 'repository/location', val, true)
  end
  f = ABIQUO_BASE_DIR + '/config/virtualfactory.xml' 
  if File.exist? f
    config_set_node(f, 'hypervisors/xenserver/abiquoRepository', val, true)
  end
end

#system_service_on?(service) ⇒ Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/abiquo-etk.rb', line 83

def system_service_on?(service)
  not `/sbin/chkconfig --list #{service}|grep 3:on`.empty?
end

#tomcat_base_dirObject



65
66
67
# File 'lib/abiquo-etk.rb', line 65

def tomcat_base_dir
  return TOMCAT_DIR
end

#tomcat_mem_limitsObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/checks/abiquo_service.rb', line 13

def tomcat_mem_limits
  return ['unknown','unknown', 'unknown'] if not File.exist?(TOMCAT_PID_FILE)
  pid = File.read(TOMCAT_PID_FILE)
  `ps #{pid}` =~ /-XX:MaxPermSize=(.*?)\s/
  perm_size = $1 || 'unknown'
  `ps #{pid}` =~ /-Xms(.*?)\s/
  xms = $1 || 'unknown'
  `ps #{pid}` =~ /-Xmx(.*?)\s/
  xmx = $1 || 'unknown'
  [perm_size, xms, xmx]
end

#vbox_installed?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/checks/virtualbox.rb', line 5

def vbox_installed?
  RPMUtils.rpm_installed? 'vboxmanage'
end