I have modified metric output and separate into three metrics: instancestate, instancestatus, systemstatus.
For example Instance State:
ec2_inststate{alias="awsec2metrics", application="name", aws_autoscaling_groupName="name", exported_job="monitoring", instance="localhost:9091", instance_id="ide8", instancestate="16", job="pushgateway", role="name" zone="us-east-1"}16
Responce codes
- 0 : pending
- 16 : running
- 32 : shutting-down
- 48 : terminated
- 64 : stopping
- 80 : stopped
This request calculate SUM of instances with code 16 for 1 hour.
(sum by (value) (sum_over_time(ec2_inststate{alias="awsec2metrics",instancestate="16"}[1h])))/16
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…