Comments (3)
if (scriptAction == "powerstate" && namespace == AWS_NAMESPACE_EC2)
instanceRunning = EC2InstanceRunning(instance_id)
checkValue = 0
powerstateMsg = ""
if ( instanceRunning != "terminated" )
checkValue = (instanceRunning) ? 1:0
powerstateMsg = (checkValue == 0 ) ? "off" : "on"
else
checkValue = 0
powerstateMsg = "instance does not exist"
end
retCode = checkThresholds(checkValue, thresholdWarning, thresholdCritical)
printf "#{retCode[:msg]} - Id: #{instance_id} Powerstate: %s\n", powerstateMsg
exit retCode[:value]
end
from nagios-cloudwatch.
def EC2InstanceRunning(instanceId)
$stderr.puts "* Entering: #{thisMethod()}" if $debug
$stderr.puts " - Checking running state of #{instanceId}" if $debug
aws_api = AWS::EC2.new()
#--- get the instance running state
begin
response = aws_api.client.describe_instances({:instance_ids => [ instanceId ]})[:reservation_set][0][:instances_set][0][:instance_state][:name]
rescue Exception => e
# $stderr.puts "ERROR: - #{e.to_s}"
$stderr.puts " - Instance id does not exist" if $debug
return "terminated"
end
# $stderr.puts response if $debug
$stderr.puts " - Done checking running state of #{instanceId} (#{response})" if $debug
if (response == "running")
return true
else
return false
end
end
from nagios-cloudwatch.
Merged with master
from nagios-cloudwatch.
Related Issues (20)
- Bug: There is no --list-instnaces for --elb HOT 1
- Adapt checkcommands.cfg so that it is easy to mix multiple regions
- Add checkcommands.cfg entries to simplify multiple AWS accounts (config.xy.yml) HOT 2
- Adapt checkcommands.cfg so that it is easy to mix multiple regions
- Docu: Add filters for infrastructure and services
- No specific error message for faulty keys HOT 1
- --no-run-check does not seem to do anything HOT 3
- Custom variables not defined in management packs HOT 3
- Pass access and secret keys as arguments for the commands in the management pack HOT 4
- Test/adapt ELB monitoring when using 2 elb nodes in a configuration HOT 1
- Timestamp inconsistency for --powerstate HOT 1
- Some invalid threshold values in op5 management packs HOT 1
- Tags to include in ./check_cloudwatch --ec2 and --elb HOT 1
- Monitor custom metrics HOT 1
- Not all instances in a region is listed with ./check_cloudwatch.rb --ec2 HOT 1
- Using the wrong config file for an instance does not show any warnings/errors
- Support IAM Instance Roles HOT 2
- Github Pages out of date
- Does not fetch metrics for AWS/ApplicationELB HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nagios-cloudwatch.