utils

package
v0.0.0-...-3f388d4 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

-------------------------------------------------------------------------

*
* command_executor.go
*    command line executor
*
*
* Copyright (c) 2021, Alibaba Group Holding Limited
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* IDENTIFICATION
*           common/polardb_pg/utils/command_executor.go
*-------------------------------------------------------------------------

-------------------------------------------------------------------------

*
* delta_calculator.go
*    delta metric calculator
*
*
* Copyright (c) 2021, Alibaba Group Holding Limited
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* IDENTIFICATION
*           common/polardb_pg/utils/delta_calculator.go
*-------------------------------------------------------------------------

-------------------------------------------------------------------------

*
* disk_usage_collector.go
*    async disk usage collect wrapper
*
*
* Copyright (c) 2021, Alibaba Group Holding Limited
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* IDENTIFICATION
*           common/polardb_pg/utils/disk_usage_collector.go
*-------------------------------------------------------------------------

-------------------------------------------------------------------------

*
* ssh_client.go
*    SSH client
*
*
* Copyright (c) 2021, Alibaba Group Holding Limited
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* IDENTIFICATION
*           common/polardb_pg/utils/ssh_client.go
*-------------------------------------------------------------------------

Index

Constants

View Source
const (
	SSHPort           = 22
	PublicKeyFileName = "/root/.ssh/id_rsa"
	Password          = "12345678"
)

Variables

This section is empty.

Functions

func PublicKeyFile

func PublicKeyFile(file string) ssh.AuthMethod

Types

type CommandExecutor

type CommandExecutor struct {
}

func NewCommandExecutor

func NewCommandExecutor() *CommandExecutor

func (*CommandExecutor) Close

func (c *CommandExecutor) Close() error

func (*CommandExecutor) ExecCommand

func (c *CommandExecutor) ExecCommand(cmd string) (string, error)

func (*CommandExecutor) Init

func (c *CommandExecutor) Init() error

type DeltaCalculator

type DeltaCalculator struct {
	// contains filtered or unexported fields
}

func NewDeltaCalculator

func NewDeltaCalculator() *DeltaCalculator

func (*DeltaCalculator) CalDeltaData

func (c *DeltaCalculator) CalDeltaData(deltaname string, out map[string]interface{}, value float64)

func (*DeltaCalculator) CalRateData

func (c *DeltaCalculator) CalRateData(deltaname string, out map[string]interface{}, value float64)

func (*DeltaCalculator) CalRateDataWithNano

func (c *DeltaCalculator) CalRateDataWithNano(deltaname string, out map[string]interface{}, value float64)

func (*DeltaCalculator) Init

func (c *DeltaCalculator) Init() error

func (*DeltaCalculator) Stop

func (c *DeltaCalculator) Stop() error

type DiskUsageCollector

type DiskUsageCollector struct {
	// contains filtered or unexported fields
}

func NewDiskUsageCollector

func NewDiskUsageCollector() *DiskUsageCollector

func (*DiskUsageCollector) Close

func (c *DiskUsageCollector) Close() error

func (*DiskUsageCollector) Collect

func (c *DiskUsageCollector) Collect(dirname string) (int64, error)

func (*DiskUsageCollector) Init

func (c *DiskUsageCollector) Init(m map[string]interface{}) error

type ImportedCollector

type ImportedCollector struct {
	// contains filtered or unexported fields
}

type PreValue

type PreValue struct {
	LastTime int64
	Value    float64
}

type SSHClient

type SSHClient struct {
	// contains filtered or unexported fields
}

func NewSSHClient

func NewSSHClient(hostname string, username string) *SSHClient

func (*SSHClient) Close

func (c *SSHClient) Close() error

func (*SSHClient) Connect

func (c *SSHClient) Connect() error

func (*SSHClient) ExecCommand

func (c *SSHClient) ExecCommand(cmd string) (string, error)

func (*SSHClient) Host

func (c *SSHClient) Host() string

Jump to

Keyboard shortcuts

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