ec2

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const IndexPrefixEC2Report = "ec2-reports"
View Source
const MonitorInstanceStsSessionName = "monitor-instance"
View Source
const TemplateEc2Report = `` /* 1814-byte string literal not displayed */
View Source
const TemplateNameEC2Report = "ec2-reports"
View Source
const TypeEC2Report = "ec2-report"

Variables

This section is empty.

Functions

func FetchDailyInstancesStats

func FetchDailyInstancesStats(ctx context.Context, awsAccount taws.AwsAccount) error

FetchDailyInstancesStats fetches the stats of the EC2 instances of an AwsAccount to import them in ElasticSearch. The stats are fetched from the last hour. In this way, FetchInstancesStats should be called every hour.

func PutEc2MonthlyReport

func PutEc2MonthlyReport(ctx context.Context, ec2Cost, cloudWatchCost []utils.CostPerResource, aa taws.AwsAccount, startDate, endDate time.Time) (bool, error)

PutEc2MonthlyReport puts a monthly report of EC2 instance in ES

Types

type Cpu

type Cpu struct {
	Average float64 `json:"average"`
	Peak    float64 `json:"peak"`
}

Cpu contains cpu statistics of an instance

type Instance

type Instance struct {
	InstanceBase
	Tags  []utils.Tag        `json:"tags"`
	Costs map[string]float64 `json:"costs"`
	Stats Stats              `json:"stats"`
}

Instance contains all the information of an EC2 instance

type InstanceBase

type InstanceBase struct {
	Id         string `json:"id"`
	Region     string `json:"region"`
	State      string `json:"state"`
	Purchasing string `json:"purchasing"`
	KeyPair    string `json:"keyPair"`
	Type       string `json:"type"`
	Platform   string `json:"platform"`
}

InstanceBase contains basics information of an EC2 instance

type InstanceReport

type InstanceReport struct {
	utils.ReportBase
	Instance Instance `json:"instance"`
}

InstanceReport is saved in ES to have all the information of an EC2 instance

type Network

type Network struct {
	In  float64 `json:"in"`
	Out float64 `json:"out"`
}

Network contains network statistics of an instance

type Stats

type Stats struct {
	Cpu     Cpu      `json:"cpu"`
	Network Network  `json:"network"`
	Volumes []Volume `json:"volumes"`
}

Stats contains statistics of an instance get on CloudWatch

type Volume

type Volume struct {
	Id    string  `json:"id"`
	Read  float64 `json:"read"`
	Write float64 `json:"write"`
}

Volume contains information about an EBS volume

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL