Documentation ¶
Overview ¶
Package mqmetric contains a set of routines common to several commands used to export MQ metrics to different backend storage mechanisms including Prometheus and InfluxDB.
Package mqmetric contains a set of routines common to several commands used to export MQ metrics to different backend storage mechanisms including Prometheus and InfluxDB.
Package mqmetric contains a set of routines common to several commands used to export MQ metrics to different backend storage mechanisms including Prometheus and InfluxDB.
Index ¶
- Constants
- func ChannelInitAttributes()
- func ChannelNormalise(attr *StatusAttribute, v int64) float64
- func CollectChannelStatus(patterns string) error
- func DiscoverAndSubscribe(queueList string, checkQueueList bool, metaPrefix string) error
- func EndConnection()
- func InitConnection(qMgrName string, replyQ string, cc *ConnectionConfig) error
- func InquireChannels(patterns string) ([]string, error)
- func Normalise(elem *MonElement, key string, value int64) float64
- func ProcessPublications() error
- func ReadPatterns(f string) (string, error)
- func VerifyPatterns(patternList string) error
- type AllMetrics
- type ConnectionConfig
- type MonClass
- type MonElement
- type MonType
- type StatusAttribute
- type StatusSet
- type StatusValue
Constants ¶
const ( ATTR_CHL_NAME = "name" ATTR_CHL_CONNNAME = "connname" ATTR_CHL_JOBNAME = "jobname" ATTR_CHL_RQMNAME = "rqmname" ATTR_CHL_MESSAGES = "messages" ATTR_CHL_STATUS = "status" ATTR_CHL_STATUS_SQUASH = ATTR_CHL_STATUS + "_squash" ATTR_CHL_TYPE = "type" ATTR_CHL_INSTANCE_TYPE = "instance_type" SQUASH_CHL_STATUS_STOPPED = 0 SQUASH_CHL_STATUS_TRANSITION = 1 SQUASH_CHL_STATUS_RUNNING = 2 )
const QMgrMapKey = "@self"
QMgrMapKey can never be a real object name and is therefore useful in maps that may contain only this single entry
Variables ¶
This section is empty.
Functions ¶
func ChannelInitAttributes ¶
func ChannelInitAttributes()
Unlike the statistics produced via a topic, there is no discovery of the attributes available in object STATUS queries. There is also no discovery of descriptions for them. So this function hardcodes the attributes we are going to look for and gives the associated descriptive text. The elements can be expanded later; just trying to give a starting point for now.
func ChannelNormalise ¶
func ChannelNormalise(attr *StatusAttribute, v int64) float64
Return a standardised value. If the attribute indicates that something special has to be done, then do that. Otherwise just make sure it's a non-negative value of the correct datatype
func CollectChannelStatus ¶
func DiscoverAndSubscribe ¶
DiscoverAndSubscribe does all the work of finding the different resources available from a queue manager and issuing the MQSUB calls to collect the data
func EndConnection ¶
func EndConnection()
EndConnection tidies up by closing the queues and disconnecting.
func InitConnection ¶
func InitConnection(qMgrName string, replyQ string, cc *ConnectionConfig) error
InitConnection connects to the queue manager, and then opens both the command queue and a dynamic reply queue to be used for all responses including the publications
func InquireChannels ¶
If we need to list the channels that match a pattern. Not needed for the status queries as they (unlike the pub/sub resource stats) accept patterns in the
func Normalise ¶
func Normalise(elem *MonElement, key string, value int64) float64
Normalise converts the value returned from MQ into the correct units such as converting MB to bytes.
func ProcessPublications ¶
func ProcessPublications() error
ProcessPublications has to read all of the messages since the last scrape and update the values for every relevant gauge.
Because the generation of the messages by the qmgr, and being told to read them by the main loop, may not have identical frequencies, there may be cases where multiple pieces of data have to be collated for the same gauge. Conversely, there may be times when this is called but there are no metrics to update.
func ReadPatterns ¶
ReadPatterns is called during the initial configuration step to read a file containing object name patterns if they are not explicitly given on the command line.
func VerifyPatterns ¶
Types ¶
type AllMetrics ¶
The AllMetrics structure is the top of the tree, holding the set of classes.
var Metrics AllMetrics
Metrics is the global variable for the tree of data
type ConnectionConfig ¶
type MonClass ¶
type MonClass struct { Parent *AllMetrics Name string Description string Types map[int]*MonType // contains filtered or unexported fields }
MonClass described the "classes" of data generated by MQ, such as DISK and CPU
type MonElement ¶
type MonElement struct { Parent *MonType Description string // An English phrase describing the element MetricName string // Reformatted description suitable as label Datatype int32 Values map[string]int64 }
MonElement describes the real metric element generated by MQ
type MonType ¶
type MonType struct { Parent *MonClass Name string Description string ObjectTopic string // topic for actual data responses Elements map[int]*MonElement // contains filtered or unexported fields }
MonType describes the "types" of data generated by MQ. Each class generates one or more type of data such as OPENCLOSE (from STATMQI class) or LOG (from DISK class)
type StatusAttribute ¶
type StatusAttribute struct { Description string MetricName string Values map[string]*StatusValue // contains filtered or unexported fields }
type StatusSet ¶
type StatusSet struct {
Attributes map[string]*StatusAttribute
}
var ChannelStatus StatusSet
type StatusValue ¶
All we care about for attributes are ints and strings. Other complex PCF datatypes are not currently going to be returned through this mechanism