Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/ec2_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ var ec2InstanceCmd = &cobra.Command{
}

func init() {
ec2InstanceCmd.Flags().StringVarP(&InstanceId, "id", "i", "", "Look for ec2 instance by id")
ec2InstanceCmd.Flags().StringVarP(&InstanceName, "name", "n", "", "Look for ec2 instance by name")
ec2InstanceCmd.Flags().StringVarP(&InstanceId, "id", "i", "", "Search for ec2 instance by id")
ec2InstanceCmd.Flags().StringVarP(&InstanceName, "name", "n", "", "Search for ec2 instance by name")

ec2Cmd.AddCommand(ec2InstanceCmd)
}
20 changes: 16 additions & 4 deletions cmd/s3_buckets.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ var (
var s3BucketCmd = &cobra.Command{
Use: "bucket",
Short: "Checks the size of a single bucket or multiple buckets",
Example: `
check_cloud_aws s3 bucket
OK - 1 Buckets: 0 Critical - 0 Warning - 1 Ok
\_[OK] my-bucket - value: 100MiB | my-bucket=100MB;10240;20480

check_cloud_aws s3 bucket --crit-bucket-size 10
CRITICAL - 1 Buckets: 1 Critical - 0 Warning - 0 Ok
\_[CRITICAL] my-bucket - value: 100MiB | my-bucket=100MB;10240;10

check_cloud_aws s3 bucket --crit-bucket-size 5GB
CRITICAL - 1 Buckets: 1 Critical - 0 Warning - 0 Ok
\_[CRITICAL] my-bucket - value: 100MiB | my-bucket=100MB;10240;10`,
Run: func(cmd *cobra.Command, args []string) {
var (
err error
Expand Down Expand Up @@ -122,11 +134,11 @@ func init() {
s3BucketFlags.StringSliceVarP(&BucketNames, "buckets", "b", nil,
"Name of the S3 bucket. If '--buckets' is empty, all buckets will be evaluated.")
s3BucketFlags.StringVarP(&CriticalBucketSize, "crit-bucket-size", "c", "20Gb",
"Critical threshold for the size of the specified bucket. Alerts if size is greater than critical threshold.\n"+
"Possible values are MB, GB or TB. Without any identifier specified MB is used.")
"Critical threshold for the size of the specified bucket. Alerts if the size is greater than the critical threshold.\n"+
"Possible units are MB, GB or TB (defaults to MB if none is specified).")
s3BucketFlags.StringVarP(&WarningBucketSize, "warn-bucket-size", "w", "10Gb",
"Warning threshold for the size of the specified bucket. Alerts if size is greater than warning threshold.\n"+
"Possible values are MB, GB or TB. Without any identifier specified MB is used.")
"Warning threshold for the size of the specified bucket. Alerts if the size is greater than the warning threshold.\n"+
"Possible units are MB, GB or TB (defaults to MB if none is specified).")

s3BucketFlags.SortFlags = false
}
30 changes: 24 additions & 6 deletions cmd/s3_objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ var (
var s3ObjectCmd = &cobra.Command{
Use: "object",
Short: "Checks the size of objects, stored in a single bucket or multiple buckets",
Example: `
check_cloud_aws s3 object
OK - 2 Objects: 0 Critical - 0 Warning - 2 Ok
\_[my-bucket]:
\_[OK] foo.fs: 100MiB
\_[OK] bar.fs: 100MiB

check_cloud_aws s3 object --prefix file
OK - 3 Objects: 0 Critical - 0 Warning - 3 Ok
\_[my-bucket]:
\_[OK] file_1.fs: 10MiB
\_[OK] file_2.fs: 20MiB
\_[OK] file_3.fs: 30MiB

check_cloud_aws s3 object --crit-object-size 10KB
CRITICAL - 1 Objects: 1 Critical - 0 Warning - 0 Ok
\_[my-bucket]:
\_[CRITICAL] file.fs: 100MiB`,
Run: func(cmd *cobra.Command, args []string) {
var (
err error
Expand Down Expand Up @@ -130,15 +148,15 @@ func init() {
"Name of one or multiple S3 buckets. If '--buckets' is empty, all buckets will be evaluated.")
s3ObjectFlags.StringVar(&ObjectPrefix, "prefix", "",
"Limits the response to keys that begin with the specified prefix, e.G. '--prefix test' filters all objects which starts with 'test'.\n"+
"NOTE: Keep in mind, that objects beneath a directory will be ignored!")
"NOTE: Keep in mind, that objects beneath a directory will be ignored.")
s3ObjectFlags.StringVarP(&CriticalObjectSize, "crit-object-size", "c", "1gb",
"Critical threshold for the size of the object. Alerts if size is greater than critical threshold.\n"+
"Possible values are MB, GB or TB. Without any identifier specified MB is used.")
"Critical threshold for the size of the object. Alerts if the size is greater than the critical threshold.\n"+
"Possible units are MB, GB or TB (defaults to MB if none is specified).")
s3ObjectFlags.StringVarP(&WarningObjectSize, "warn-object-size", "w", "800mb",
"Critical threshold for the size of the object. Alerts if size is greater than warning threshold.\n"+
"Possible values are MB, GB or TB. Without any identifier specified MB is used.")
"Critical threshold for the size of the object. Alerts if the size is greater than the warning threshold.\n"+
"Possible units are MB, GB or TB (defaults to MB if none is specified).")
s3ObjectFlags.BoolVarP(&ShowPerfdata, "perfdata", "p", false,
"Displays perfdata and lists ALL objects in the specified bucket.")
"Displays perfdata and lists all objects in the specified bucket.")

s3ObjectFlags.SortFlags = false
}