genericjmx

package
v4.1.0+incompatible Latest Latest
Warning

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

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

Documentation

Overview

Package genericjmx coordinates the various monitors that rely on the GenericJMX Collectd plugin to pull JMX metrics. All of the GenericJMX monitors share the same instance of the coreInstance struct that can be gotten by the Instance func in this package. This ultimately means that all GenericJMX config will be written to one file to make it simpler to control dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	config.MonitorConfig `yaml:",inline" acceptsEndpoints:"true"`

	// Host to connect to -- JMX must be configured for remote access and
	// accessible from the agent
	Host string `yaml:"host" validate:"required"`
	// JMX connection port (NOT the RMI port) on the application.  This
	// correponds to the `com.sun.management.jmxremote.port` Java property that
	// should be set on the JVM when running the application.
	Port uint16 `yaml:"port" validate:"required"`
	Name string `yaml:"name"`

	// This is how the service type is identified in the SignalFx UI so that
	// you can get built-in content for it.  For custom JMX integrations, it
	// can be set to whatever you like and metrics will get the special
	// property `sf_hostHasService` set to this value.
	ServiceName string `yaml:"serviceName"`
	// The JMX connection string.  This is rendered as a Go template and has
	// access to the other values in this config. NOTE: under normal
	// circumstances it is not advised to set this string directly - setting
	// the host and port as specified above is preferred.
	ServiceURL     string `yaml:"serviceURL" default:"service:jmx:rmi:///jndi/rmi://{{.Host}}:{{.Port}}/jmxrmi"`
	InstancePrefix string `yaml:"instancePrefix"`
	Username       string `yaml:"username"`
	Password       string `yaml:"password" neverLog:"true"`
	// Takes in key-values pairs of custom dimensions at the connection level.
	CustomDimensions map[string]string `yaml:"customDimensions"`
	// A list of the MBeans defined in `mBeanDefinitions` to actually collect.
	// If not provided, then all defined MBeans will be collected.
	MBeansToCollect []string `yaml:"mBeansToCollect"`
	// A list of the MBeans to omit. This will come handy in cases where only a
	// few MBeans need to omitted from the default list
	MBeansToOmit []string `yaml:"mBeansToOmit"`
	// Specifies how to map JMX MBean values to metrics.  If using a specific
	// service monitor such as cassandra, kafka, or activemq, they come
	// pre-loaded with a set of mappings, and any that you add in this option
	// will be merged with those.  See
	// [collectd GenericJMX](https://collectd.org/documentation/manpages/collectd-java.5.shtml#genericjmx_plugin)
	// for more details.
	MBeanDefinitions MBeanMap `yaml:"mBeanDefinitions"`
}

Config has configuration that is specific to GenericJMX. This config should be used by a monitors that use the generic JMX collectd plugin.

type JMXMonitorCore

type JMXMonitorCore struct {
	collectd.MonitorCore

	DefaultMBeans MBeanMap
	// contains filtered or unexported fields
}

JMXMonitorCore should be embedded by all monitors that use the collectd GenericJMX plugin. It has most of the logic they will need. The individual monitors mainly just need to provide their set of default mBean definitions.

func NewJMXMonitorCore

func NewJMXMonitorCore(defaultMBeans MBeanMap, defaultServiceName string) *JMXMonitorCore

NewJMXMonitorCore makes a new JMX core as well as the underlying MonitorCore

func (*JMXMonitorCore) Configure

func (m *JMXMonitorCore) Configure(conf *Config) error

Configure configures and runs the plugin in collectd

type MBean

type MBean struct {
	ObjectName     string       `yaml:"objectName"`
	InstancePrefix string       `yaml:"instancePrefix"`
	InstanceFrom   []string     `yaml:"instanceFrom"`
	Values         []MBeanValue `yaml:"values"`
	Dimensions     []string     `yaml:"dimensions"`
}

MBean represents the <MBean> config object in the collectd config for generic jmx.

type MBeanMap

type MBeanMap map[string]MBean

MBeanMap is a map from the service name to the mbean definitions that this service has

var DefaultMBeans MBeanMap

DefaultMBeans are basic JVM memory and threading metrics that are common to all JMX applications

func (MBeanMap) MBeanNames

func (m MBeanMap) MBeanNames() []string

MBeanNames returns a list of the MBean names (the key values of the map)

func (MBeanMap) MergeWith

func (m MBeanMap) MergeWith(m2 MBeanMap) MBeanMap

MergeWith combines the current MBeanMap with the one given as an argument and returns a new map with values from both maps.

type MBeanValue

type MBeanValue struct {
	Type           string   `yaml:"type"`
	Table          bool     `yaml:"table"`
	InstancePrefix string   `yaml:"instancePrefix"`
	InstanceFrom   []string `yaml:"instanceFrom"`
	Attribute      string   `yaml:"attribute"`
}

MBeanValue specifies a particular value to pull from the MBean.

type Monitor

type Monitor struct {
	*JMXMonitorCore
}

Monitor is the main type that represents the monitor

Jump to

Keyboard shortcuts

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