EC2

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AwsxEc2CpuUtilizationCmd = &cobra.Command{
	Use:   "cpu_utilization_panel",
	Short: "get cpu utilization metrics data",
	Long:  `command to get cpu utilization metrics data`,

	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetCpuUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting cpu utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}
View Source
var AwsxEc2MemoryUtilizationCmd = &cobra.Command{
	Use:   "memory_utilization_panel",
	Short: "get memory utilization metrics data",
	Long:  `command to get memory utilization metrics data`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("running from child command")
		var authFlag, clientAuth, err = authenticate.AuthenticateCommand(cmd)
		if err != nil {
			log.Printf("Error during authentication: %v\n", err)
			err := cmd.Help()
			if err != nil {
				return
			}
			return
		}
		if authFlag {
			responseType, _ := cmd.PersistentFlags().GetString("responseType")
			jsonResp, cloudwatchMetricResp, err := GetMemoryUtilizationPanel(cmd, clientAuth, nil)
			if err != nil {
				log.Println("Error getting memory utilization: ", err)
				return
			}
			if responseType == "frame" {
				fmt.Println(cloudwatchMetricResp)
			} else {

				fmt.Println(jsonResp)
			}
		}

	},
}

Functions

func GetCPUUsageUserMetricData added in v1.2.0

func GetCPUUsageUserMetricData(clientAuth *model.Auth, instanceID string, namespace string, startTime, endTime *time.Time) (*cloudwatch.GetMetricDataOutput, error)

func GetCPUUsageUserPanel added in v1.2.0

func GetCPUUsageUserPanel(cmd *cobra.Command, clientAuth *model.Auth) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetCpuUtilizationMetricData added in v1.0.2

func GetCpuUtilizationMetricData(clientAuth *model.Auth, instanceID, elementType string, startTime, endTime *time.Time, statistic string, cloudWatchClient *cloudwatch.CloudWatch) (*cloudwatch.GetMetricDataOutput, error)

func GetCpuUtilizationPanel added in v1.0.7

func GetCpuUtilizationPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDiskReadPanel added in v1.1.6

func GetDiskReadPanel(cmd *cobra.Command, clientAuth *model.Auth) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDiskReadPanelMetricData added in v1.1.6

func GetDiskReadPanelMetricData(clientAuth *model.Auth, instanceID string, elementType string, startTime, endTime *time.Time) (*cloudwatch.GetMetricDataOutput, error)

func GetDiskReadpanelMetricData added in v1.1.7

func GetDiskReadpanelMetricData(clientAuth *model.Auth, instanceID string, namespace string, startTime, endTime *time.Time) (*cloudwatch.GetMetricDataOutput, error)

func GetDiskUsagePanel added in v1.1.7

func GetDiskUsagePanel(cmd *cobra.Command, clientAuth *model.Auth) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDiskWritePanel added in v1.1.7

func GetDiskWritePanel(cmd *cobra.Command, clientAuth *model.Auth) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetDiskWritePanelMetricData added in v1.1.7

func GetDiskWritePanelMetricData(clientAuth *model.Auth, instanceID string, namespace string, startTime, endTime *time.Time) (*cloudwatch.GetMetricDataOutput, error)

func GetDiskWritepanelMetricData added in v1.1.7

func GetDiskWritepanelMetricData(clientAuth *model.Auth, instanceID string, elementType string, startTime, endTime *time.Time) (*cloudwatch.GetMetricDataOutput, error)

func GetMemoryUtilizationMetricData added in v1.1.6

func GetMemoryUtilizationMetricData(clientAuth *model.Auth, instanceID, elementType string, startTime, endTime *time.Time, statistic string, cloudWatchClient *cloudwatch.CloudWatch) (*cloudwatch.GetMetricDataOutput, error)

func GetMemoryUtilizationPanel added in v1.1.6

func GetMemoryUtilizationPanel(cmd *cobra.Command, clientAuth *model.Auth, cloudWatchClient *cloudwatch.CloudWatch) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetMetrics added in v1.1.5

func GetMetrics(clientAuth *model.Auth, instanceID, volumeID, elementType string, startTime, endTime *time.Time, metrics ...string) (*cloudwatch.GetMetricDataOutput, error)

func GetNetworkInBytesMetricData added in v1.1.8

func GetNetworkInBytesMetricData(clientAuth *model.Auth, instanceID string, elementType string, startTime, endTime *time.Time) (*cloudwatch.GetMetricDataOutput, error)

func GetNetworkInBytesPanel added in v1.1.8

func GetNetworkInBytesPanel(cmd *cobra.Command, clientAuth *model.Auth) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkInPackerMetricData added in v1.1.6

func GetNetworkInPackerMetricData(clientAuth *model.Auth, instanceID string, elementType string, startTime, endTime *time.Time) (*cloudwatch.GetMetricDataOutput, error)

func GetNetworkInPacketsPanel added in v1.1.6

func GetNetworkInPacketsPanel(cmd *cobra.Command, clientAuth *model.Auth) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkMetricData added in v1.1.1

func GetNetworkMetricData(clientAuth *model.Auth, instanceID, elementType string, startTime, endTime *time.Time, metricName string) (*cloudwatch.GetMetricDataOutput, error)

func GetNetworkOutBytesMetricData added in v1.2.0

func GetNetworkOutBytesMetricData(clientAuth *model.Auth, instanceID string, elementType string, startTime, endTime *time.Time) (*cloudwatch.GetMetricDataOutput, error)

func GetNetworkOutBytesPanel added in v1.2.0

func GetNetworkOutBytesPanel(cmd *cobra.Command, clientAuth *model.Auth) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkOutPacketsMetricData added in v1.1.6

func GetNetworkOutPacketsMetricData(clientAuth *model.Auth, instanceID string, elementType string, startTime, endTime *time.Time) (*cloudwatch.GetMetricDataOutput, error)

func GetNetworkOutPacketsPanel added in v1.1.6

func GetNetworkOutPacketsPanel(cmd *cobra.Command, clientAuth *model.Auth) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetNetworkUtilizationPanel added in v1.1.1

func GetNetworkUtilizationPanel(cmd *cobra.Command, clientAuth *model.Auth) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

func GetVolumeMetricsPanel added in v1.1.5

func GetVolumeMetricsPanel(cmd *cobra.Command, clientAuth *model.Auth) (string, map[string]*cloudwatch.GetMetricDataOutput, error)

Types

type CpuUsageUser added in v1.2.0

type CpuUsageUser struct {
	RawData []struct {
		Timestamp time.Time
		Value     float64
	} `json:"RawData"`
}

type DiskReadPanelData added in v1.1.6

type DiskReadPanelData struct {
	RawData []struct {
		Timestamp time.Time
		Value     float64
	} `json:"RawData"`
}

type DiskUsagePanelData added in v1.1.7

type DiskUsagePanelData struct {
	RawData []struct {
		Timestamp time.Time
		Value     float64
	} `json:"RawData"`
}

type DiskWritePanelData added in v1.1.7

type DiskWritePanelData struct {
	RawData []struct {
		Timestamp time.Time
		Value     float64
	} `json:"RawData"`
}

type NetworkInBytes added in v1.1.8

type NetworkInBytes struct {
	RawData []struct {
		Timestamp time.Time
		Value     float64
	} `json:"RawData"`
}

type NetworkInPackets added in v1.1.6

type NetworkInPackets struct {
	RawData []struct {
		Timestamp time.Time
		Value     float64
	} `json:"RawData"`
}

type NetworkOutBytes added in v1.2.0

type NetworkOutBytes struct {
	RawData []struct {
		Timestamp time.Time
		Value     float64
	} `json:"RawData"`
}

type NetworkOutPackets added in v1.1.6

type NetworkOutPackets struct {
	RawData []struct {
		Timestamp time.Time
		Value     float64
	} `json:"RawData"`
}

type NetworkResult added in v1.1.1

type NetworkResult struct {
	InboundTraffic  float64 `json:"inboundTraffic"`
	OutboundTraffic float64 `json:"outboundTraffic"`
	DataTransferred float64 `json:"dataTransferred"`
}

type Result

type Result struct {
	CurrentUsage float64 `json:"currentUsage"`
	AverageUsage float64 `json:"averageUsage"`
	MaxUsage     float64 `json:"maxUsage"`
}

Jump to

Keyboard shortcuts

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