cloudwatch

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

README

cloudwatch GoDoc

Usage

local cloudwatch = require("cloudwatch")

local clw_client, err = cloudwatch.new()
if err then error(err) end

local filter = {
    log_group_name = "group-name",
--  filter_patern = "",
    start_time = 1557948000,
    end_time = 1557948200,
}
local timeout_sec = 100
local err = clw_client:download("download.log", filter, timeout_sec)
if err then error(err) end

local query = {
    namespace = "AWS/RDS",
    metric = "CPUUtilization",
    dimension_name = "DBInstanceIdentifier",
    dimension_value = "hostname",
    stat = "Average",
    period = 60,
}
local result, err = clw_client:get_metric_data({start_time=1557948000, end_time=1557948200, queries={cpu=query}})
if err then error(err) end
print(inspect(result))
--[[
{
  cpu = {
    1569880560 = 5.72916666666667,
    1569880620 = 4.29166666666667,
    1569880680 = 4.29583333308498,
    1569880740 = 6.44166666641831,
    1569880800 = 9.30833333358169,
    1569880860 = 5.72500000024835,
    1569880920 = 4.29583333308498,
    1569880980 = 4.29583333308498,
    1569881040 = 5.72500000024835
  },
}
--]]

Documentation

Overview

Package cloudwatch implements cloudwatch client api functionality for lua.

Package cloudwatch implements cloudwatch client api functionality for lua.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(L *lua.LState) int

Download lua clw:download(filename, filter={}, timeout) error filter table:

{
  log_group_name="/aws/rds/instance/name/rds",
  filter_patern="",
  start_time=timestamp,
  end_time=timestamp,
}

func GetMetricData

func GetMetricData(L *lua.LState) int

GetMetricData lua clw:get_metric_data({start_time=1, end_time=1, queries={}}) result, error

func Loader

func Loader(L *lua.LState) int

Loader is the module loader function.

func New

func New(L *lua.LState) int

New lua new(profile, region) returns (clw_ud, err)

func Preload

func Preload(L *lua.LState)

Preload adds cloudwatch to the given Lua state's package.preload table. After it has been preloaded, it can be loaded using require:

local cloudwatch = require("cloudwatch")

Types

This section is empty.

Jump to

Keyboard shortcuts

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