Class: Check
- Inherits:
-
CloudstackNagios::Base
- Object
- Thor
- CloudstackNagios::Base
- Check
- Defined in:
- lib/cloudstack-nagios/commands/check.rb
Constant Summary
Constants included from CloudstackNagios::Helper
CloudstackNagios::Helper::RETURN_CODES
Instance Attribute Summary
Attributes inherited from CloudstackNagios::Base
Instance Method Summary collapse
Methods inherited from CloudstackNagios::Base
Methods included from CloudstackNagios::Helper
#check_data, #cs_routers, #exit_with_failure, #load_template
Instance Method Details
#async_jobs ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/cloudstack-nagios/commands/check.rb', line 69 def async_jobs jobs = client.send_request('command' => 'listAsyncJobs', 'listall' => 'true')['asyncjobs'] outstanding_jobs = jobs.select {|job| job['jobstatus'] == 0 } if outstanding_jobs.size < [:warning] code = 0 elsif outstanding_jobs.size < [:critical] code = 1 else code = 2 end puts "async_jobs #{RETURN_CODES[code]} - jobs = #{outstanding_jobs.size} | jobs=#{outstanding_jobs.size}" end |
#storage_pool ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/cloudstack-nagios/commands/check.rb', line 46 def storage_pool pool = client.list_storage_pools(name: [:pool_name], zone: [:zone]).first data = check_data( pool['disksizetotal'] * [:over_provisioning], pool['disksizeallocated'].to_f, [:warning], [:critical] ) puts "storage_pool #{options[:pool_name]} #{RETURN_CODES[data[0]]} - usage = #{data[1]}% | usage=#{pool['disksizeused']}" exit data[0] end |