utils

package
v0.0.0-...-4490b9b Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginMetrics = "plugin-metrics"
)

Variables

View Source
var PanicLogger = logger.New("Panic Error", "Panic Error Log")

Functions

func AddProcess

func AddProcess(context MotadataMap, processName MotadataString, processCommand MotadataString, objects MotadataMap)

func AddStatusField

func AddStatusField(context MotadataMap)

func AppendObject

func AppendObject(metrics MotadataMap) (result []MotadataMap)

func AssertCloudDiscoveryTestResult

func AssertCloudDiscoveryTestResult(result MotadataMap, objectLocationKey string, downInstanceDiscovery bool, assertions *assert.Assertions)

func AssertInvalidCloudDiscoveryTestResult

func AssertInvalidCloudDiscoveryTestResult(result MotadataMap, errorCode string, assertions *assert.Assertions)

func AssertInvalidMetricPluginTestResult

func AssertInvalidMetricPluginTestResult(result MotadataMap, errorCode string, assertions *assert.Assertions)

func AssertInvalidMetricPluginTestResultErrors

func AssertInvalidMetricPluginTestResultErrors(result MotadataMap, errorCode MotadataStringList, assertions *assert.Assertions)

func AssertInvalidMultipleErrorsTestResult

func AssertInvalidMultipleErrorsTestResult(eventType MotadataString, result MotadataMap, errorCodes MotadataStringList, assertions *assert.Assertions)

AssertInvalidMultipleErrorsTestResult for testing function result with multiple errors

func AssertInvalidNodeDiscoveryMultipleCredentialsTestResult

func AssertInvalidNodeDiscoveryMultipleCredentialsTestResult(result MotadataMap, errorCode string, assertions *assert.Assertions)

func AssertInvalidNodeDiscoveryTestResult

func AssertInvalidNodeDiscoveryTestResult(result MotadataMap, errorCode string, numberOfErrors int, assertions *assert.Assertions)

func AssertNodeDiscoveryMultipleCredentialsTestResult

func AssertNodeDiscoveryMultipleCredentialsTestResult(result MotadataMap, props MotadataStringList, assertions *assert.Assertions)

func AssertNodeDiscoveryTestResult

func AssertNodeDiscoveryTestResult(result MotadataMap, props MotadataStringList, assertions *assert.Assertions)

func AssertOffice365DiscoveryTestResult

func AssertOffice365DiscoveryTestResult(result MotadataMap, assertions *assert.Assertions)

func AssertRunbookPluginTestResult

func AssertRunbookPluginTestResult(result MotadataMap, t *testing.T, success bool, errorCode string)

func AssertSystemProcessDiscoveryTestResult

func AssertSystemProcessDiscoveryTestResult(result MotadataMap, props MotadataStringList, assertions *assert.Assertions)

func BeforeTest

func BeforeTest(context MotadataMap) MotadataMap

func BuildCloudWatchMetricQuery

func BuildCloudWatchMetricQuery(params []interface{}, dimensions []*cloudwatch.Dimension) *cloudwatch.MetricDataQuery

func ConvertToMACAddress

func ConvertToMACAddress(macPattern *regexp.Regexp, macPattern2Digit *regexp.Regexp, macPattern4Digit *regexp.Regexp, value MotadataString, macScanner bool) MotadataString

func ExecuteBinary

func ExecuteBinary(command MotadataString, arguments MotadataStringList, timeout MotadataINT) (MotadataString, error)

func FormatIP

func FormatIP(tokens interface{}) (ip MotadataString)

func GenerateBlockingSession

func GenerateBlockingSession(driver MotadataString, dataSource MotadataString, tableName MotadataString, logger *logger.Logger)

func GetAWSPluginErrors

func GetAWSPluginErrors(errors []MotadataStringMap, err error, context MotadataMap) []MotadataStringMap

func GetAzureMetricValue

func GetAzureMetricValue(params []MotadataString, client insights.MetricsClient, cloudMetricBatches MotadataMap) error

func GetAzurePluginErrors

func GetAzurePluginErrors(errors []MotadataStringMap, err error, context MotadataMap) []MotadataStringMap

func GetAzureStorageQueueURL

func GetAzureStorageQueueURL(resource string, context MotadataMap) string

func GetAzureStorageTableURL

func GetAzureStorageTableURL(resource string, context MotadataMap) string

func GetCloudObjectName

func GetCloudObjectName(context MotadataMap, key string) MotadataString

func GetCloudWatchMetricValue

func GetCloudWatchMetricValue(pluginName MotadataString, cloudWatchClient *cloudwatch.CloudWatch, params []interface{}) (MotadataFloat64, error)

func GetContext

func GetContext(contexts MotadataMap, keys MotadataStringList) (result MotadataMap)

func GetEnvironmentType

func GetEnvironmentType() (result string)

func GetHyperVVMState

func GetHyperVVMState(value int) MotadataString

func GetLinuxDiscoveryNodes

func GetLinuxDiscoveryNodes(context MotadataMap) []MotadataMap

func GetLinuxNodes

func GetLinuxNodes(context MotadataMap) []MotadataMap

func GetLinuxProcessPluginNodes

func GetLinuxProcessPluginNodes(context map[string]interface{}) []MotadataMap

func GetMetricNames

func GetMetricNames(group string, groups MotadataMap, scalarMetricGroup bool) MotadataStringList

func GetSolarisCPUCoreMetrics

func GetSolarisCPUCoreMetrics(output MotadataString) MotadataMap

func GetSolarisNodes

func GetSolarisNodes(context map[string]interface{}) []MotadataMap

func GetSystemTags

func GetSystemTags(tags MotadataStringList, context MotadataMap) (systemTags MotadataStringList)

func IsASCII

func IsASCII(value string) bool

func IsOpened

func IsOpened(port MotadataUINT16, target MotadataString) bool

func IsValidCharacter

func IsValidCharacter(value string) bool

func IsValidResult

func IsValidResult(metrics MotadataMap, correlationMetric string) bool

func LoadMetricGroups

func LoadMetricGroups(file string) MotadataMap

func MotadataStringSliceToMACAddress

func MotadataStringSliceToMACAddress(tokens []MotadataString) MotadataString

func RemoveSensitiveFields

func RemoveSensitiveFields(context MotadataMap) MotadataMap

func ReplaceSpecialCharacters

func ReplaceSpecialCharacters(instance MotadataString) MotadataString

func ReplaceVariables

func ReplaceVariables(command MotadataString, variables MotadataMap) MotadataString

func SetCloudWatchMetrics

func SetCloudWatchMetrics(pluginName MotadataString, metricMappers MotadataMap, queries []*cloudwatch.MetricDataQuery, cloudWatchClient *cloudwatch.CloudWatch, timeDiff int64, cloudMetricBatches MotadataMap, lastPollTime int64) error

func SetEnvironmentType

func SetEnvironmentType(env string)

func SetProcessStatusMetrics

func SetProcessStatusMetrics(objects MotadataMap, context MotadataMap, metrics MotadataMap)

func SetupCleanupRoutine

func SetupCleanupRoutine(responses chan<- MotadataMap, response MotadataMap, requestType MotadataString)

func StringSliceToMACAddress

func StringSliceToMACAddress(tokens interface{}) (macAddress MotadataString)

func Timestamp

func Timestamp(value time.Time) MotadataString

func ValidAWSInstance

func ValidAWSInstance(systemTags map[string]string, userTags []interface{}) bool

func ValidAzureInstance

func ValidAzureInstance(systemTags map[string]*string, userTags []interface{}) bool

Types

type AzureSession

type AzureSession struct {
	Authorizer autorest.Authorizer
}

func GetAzureSession

func GetAzureSession(context MotadataMap) (*AzureSession, error)

Jump to

Keyboard shortcuts

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