exporter

package
v0.0.0-...-4f328aa Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckObjectServerConnection

func CheckObjectServerConnection(CheckObjectServerConnectionEnable bool)

CheckObjectServerConnection makes use of the gopsutil library to get the number of object-server instance that is being run.

func CheckSwiftLogSize

func CheckSwiftLogSize(swiftLog string)

CheckSwiftLogSize Description: this function checks the size of Swift all.log at /var/log/swift/all.log and returns its size. Once the data is retrieved, we will put expose it over Prometheus.

func CheckSwiftService

func CheckSwiftService()

CheckSwiftService is a service check on all Swift / Swift-related services running in a node.

func CountFilesPerSwiftDrive

func CountFilesPerSwiftDrive()

CountFilesPerSwiftDrive counts the number of file in each Swift partition in a Swift Drive.

func ExposePerCPUUsage

func ExposePerCPUUsage(ExposePerCPUUsageEnable bool)

ExposePerCPUUsage Description: this function makes use of shirou/gopsutil to expose cputime metrics and convert them into percentage (out of 1), and expose them out to prometheus.

func ExposePerNICMetric

func ExposePerNICMetric(ExposePerNICMetricEnable bool)

ExposePerNICMetric description: This function makes use of the net library in github.com/shirou/net library to gather network interface card related data such as byte sent, byte receive, packet sent, packet receive, error in, and error out. After these data is exposed, these data will be exposed to prometheus.

func GatherStoragePolicyCommonName

func GatherStoragePolicyCommonName() map[string]string

GatherStoragePolicyCommonName reads throught /etc/swift/swift.conf file to get the storage policy name. Once it gets the policy name, it will put them into a slice and then share with other modules that needs to relate the storage policy name with the policy number.

func GatherStoragePolicyUtilization

func GatherStoragePolicyUtilization(GatherStoragePolicyUtilizationEnable bool)

GatherStoragePolicyUtilization do a "du -s" across all Swift nodes ("/srv/node") and expose actual disk size through the Prometheus.

func GetAPIAddress

func GetAPIAddress(ssnodeConfig string) (apiAddress string, apiPort string, apiHostname string, err error)

GetAPIAddress reads the ssnode.conf file and get the API IP, API Port, and API Hostname inside the file.

func GetUUIDAndFQDN

func GetUUIDAndFQDN(ssnodeConfig string) (UUID string, FQDN string, err error)

GetUUIDAndFQDN runs "hostname -f" and reads the ssnode.conf to get the full FQDN and the UUID of a Swift node.

func GrabNICMTU

func GrabNICMTU()

GrabNICMTU grabs the MTU setting of a NIC card by reading the /sys/class/net file.

func GrabSwiftPartition

func GrabSwiftPartition(replicationProgressFile string, GrabSwiftPartitionEnable bool)

GrabSwiftPartition reads the /opt/ss/var/lib/replication_progress.json file and gets the primary and handoff partition, then expose them to the prometheus.

func HddOrSSD

func HddOrSSD(deviceName string) (driveType string)

HddOrSSD - this function determines if a particular disk is a hard drive or a solid state drive based on the valule stores in /sys/block/<drive>/queue/rotational

func ReadReconFile

func ReadReconFile(ReconFile string, SwiftRole string, ReadReconFileEnable bool)

ReadReconFile parses the .recon files, put them into the struct defined above and expose them out in prometheus. This function takes in 2 argument - ReconFile is the const configured above that reflects the exact location of the .recon file in Swift nodes.

func RunSMARTCTL

func RunSMARTCTL()

RunSMARTCTL module run "smartctl -A <device_label" to get the "reallocated sectors" and offline uncorrectable count that serve as an indicator to see if a drive is failing. Unlike other modules that can be turned on/off, this module runs all the time as drives health is important in the Swift cluster."

func SwiftDiskUsage

func SwiftDiskUsage(SwiftDiskUsageEnable bool)

SwiftDiskUsage makes use of the "github.com/shirou/gopsutil/disk" golang library to grab total disk space, used space, inode total, inode free, and inode used. Once it grab the metrics, it will expose them via Prometheus.

func SwiftDriveIO

func SwiftDriveIO(SwiftDriveIOEnable bool)

SwiftDriveIO uses gopsutil library from "github.com/shirou/gopsutil/disk" to grab various disk-io related metrics and expose them via Prometheus.

Types

type AccountSwiftRole

type AccountSwiftRole struct {
	AccountReplicator   ReplicationStats `json:"replication_stats"`
	AccountAuditsPassed float64          `json:"account_audits_passed"`
	AccountAuditsFailed float64          `json:"account_audits_failed"`
	PassCompleted       float64          `json:"account_auditor_pass_completed"`
	ReplicationTime     float64          `json:"replication_time"`
}

AccountContainerSwiftRole defines the data structure for account role in Swift cluster This is also needed as unmarshal requires the exact name in the JSON object for it to work"

type ContainerShardingStats

type ContainerShardingStats struct {
	Attempted   float64         `json:"attempted"`
	Deferred    float64         `json:"deffered"`
	Diff        float64         `json:"diff"`
	DiffCapped  float64         `json:"diff_capped"`
	Empty       float64         `json:"empty"`
	Failure     float64         `json:"failure"`
	Hashmatch   float64         `json:"hashmatch"`
	NoChange    float64         `json:"no_change"`
	RemoteMerge float64         `json:"remote_merge"`
	Remove      float64         `json:"remove"`
	Rsync       float64         `json:"rsync"`
	Sharding    ShardingElement `json:"sharding"`
}

ContainerShardingStats struct holds the data read the container sharding from ReadConfFile.

type ContainerSwiftRole

type ContainerSwiftRole struct {
	ContainerAuditsPassed         float64                `json:"container_audits_passed"`
	ContainerAuditsFailed         float64                `json:"container_audits_failed"`
	ContainerAuditorPassCompleted float64                `json:"container_auditor_pass_completed"`
	ContainerReplicator           ReplicationStats       `json:"replication_stats"`
	ReplicationTime               float64                `json:"replication_time"`
	ShardingLast                  float64                `json:"sharding_last"`
	ShardingStats                 ContainerShardingStats `json:"sharding_stats"`
}

ContainerSwfiftRole defines the data structure for container role in a Swift cluster.

type NodeSwiftSetting

type NodeSwiftSetting struct {
	Formpost         formpostParameter       `json:"formpost"`
	SLO              sloParameter            `json:"slo"`
	Swift            swiftParameter          `json:"swift"`
	Swift3           swift3Parameter         `json:"swift3"`
	SwiftStackAuth   swiftstackAuthParameter `json:"swiftstack_auth"`
	SwiftStackAuthen swiftstackAuthen        `json:"swiftstack_authen"`
	TempURL          tempURLParameter        `json:"tempurl"`
}

NodeSwiftSetting struct holds the Swift cluster parameter data from the discovery API call to the cluster.

func GetSwiftEnvironmentParameters

func GetSwiftEnvironmentParameters() (swiftEnvironmentParameters NodeSwiftSetting)

GetSwiftEnvironmentParameters - this function runs a curl call to http://<node_ipaddress>/info to get the node parameter of the system. Environment variables like Swift version, S3 version...etc will be expose and reference in other modules in the script.

type ObjectAuditorStats

type ObjectAuditorStats struct {
	AuditTime     float64 `json:"audit_time"`
	ByteProcessed float64 `json:"bytes_processed"`
	Errors        float64 `json:"errors"`
	Passes        float64 `json:"passes"`
	Quarantined   float64 `json:"quarantined"`
}

ObjectAuditorStats contains parts of the sub-list of account/container metrics that you can find in a *.recon file.

type ObjectSwiftRole

type ObjectSwiftRole struct {
	AsyncPending             float64                       `json:"async_pending"`
	ExpiredLastPass          float64                       `json:"expired_last_pass"`
	ObjectReplicatorStats    ReplicationStats              `json:"replication_stats"`
	ObjectAuditorStatsALL    ObjectAuditorStats            `json:"object_auditor_stats_ALL"`
	ObjectAuditorStatsZBF    ObjectAuditorStats            `json:"object_auditor_stats_ZBF"`
	ObjectExpirationPass     float64                       `json:"object_expiration_pass"`
	ObjectReconstructionLast float64                       `json:"object_reconstruction_last"`
	ObjectReconstructionTime float64                       `json:"object_reconstruction_time"`
	ObjectReplicationPerDisk map[string]ReplicationPerDisk `json:"object_replication_per_disk"`
	ObjectUpdaterSweep       float64                       `json:"object_updater_sweep"`
	ObjectReplicationLast    float64                       `json:"replication_last"`
	ObjectReplicationTime    float64                       `json:"object_replication_time"`
}

ObjectSwiftRole is a struct created to hold the values that you can find in object.recon files.

type PartCounts

type PartCounts struct {
	Primary float64 `json:"primary"`
	Handoff float64 `json:"handoff"`
}

PartCounts is a struct that is a sub structure to hold that actual part counts used by SwiftPartition

type Replication216Stats

type Replication216Stats struct {
	Attempted   float64 `json:"attempted"`
	Failure     float64 `json:"failure"`
	Hashmatch   float64 `json:"hashmatch"`
	Remove      float64 `json:"remove"`
	Rsync       float64 `json:"rsync"`
	Success     float64 `json:"success"`
	SuffixCount float64 `json:"suffix_count"`
	SuffixHash  float64 `json:"suffix_hash"`
	SuffixSync  float64 `json:"suffix_sync"`
}

Replication216Stats struct holds the Swift replication status data prior to v2.16

type ReplicationPerDisk

type ReplicationPerDisk struct {
	ObjectReplicationLast float64             `json:"replication_last"`
	ObjectReplicatorStats Replication216Stats `json:"replication_stats"`
	ReplicationTime       float64             `json:"replication_time"`
}

ReplicationPerDisk struct holds the data obtained from object replication worker in object.json file.

type ReplicationStats

type ReplicationStats struct {
	Attempted       float64 `json:"attempted"`
	Diff            float64 `json:"diff"`
	DiffCapped      float64 `json:"diff_capped"`
	Failure         float64 `json:"failure"`
	Hashmatch       float64 `json:"hashmatch"`
	NoChange        float64 `json:"no_change"`
	RemoteMerge     float64 `json:"remote_merge"`
	ReplicationTime float64 `json:"replication_time"`
	Rsync           float64 `json:"rsync"`
	Success         float64 `json:"success"`
	Time            float64 `json:"time"`
	TsRepl          float64 `json:"ts_repl"`
	StartTime       float64 `json:"start"`
}

ReplicationStats is a struct that holds a list of replication metrics that you can read from *.recon files.

type ShardingElement

type ShardingElement struct {
	AuditRoot          ShardingStats `json:"audit_root"`
	AuditShard         ShardingStats `json:"audit_shard"`
	Cleaved            ShardingStats `json:"cleaved"`
	Created            ShardingStats `json:"created"`
	Misplaced          ShardingStats `json:"misplaced"`
	Scanned            ShardingStats `json:"scanned"`
	ShardingCandidates ShardingStats `json:"sharding_candidates"`
	Visited            ShardingStats `json:"visitred"`
}

ContainerShardingStats struct holds the sub set of data read the container sharding from ReadConfFile.

type ShardingStats

type ShardingStats struct {
	Attempted float64 `json:"attempted"`
	Success   float64 `json:"success"`
	Failure   float64 `json:"failure"`
	Found     float64 `json:"found"`
	Placed    float64 `json:"placed"`
	Unplaced  float64 `json:"unplaced"`
	MaxTime   float64 `json:"max_time"`
	MinTime   float64 `json:"min_time"`
	Top       float64 `json:"top"`
	Skipped   float64 `json:"skipped"`
	Completed float64 `json:"completed"`
}

ShardingStats holds subset of data from ShardingElement.

type SwiftPartition

type SwiftPartition struct {
	AccountPartCount   PartCounts `json:"accounts"`
	ContainerPartCount PartCounts `json:"containers"`
	ObjectPartCount    PartCounts `json:"objects"`
}

SwiftPartition is a struct that holds the partition count (both primary and handoff) for account/container and object servers.

Jump to

Keyboard shortcuts

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