Documentation ¶
Index ¶
- func New(base mb.BaseMetricSet) (mb.MetricSet, error)
- type Attribute
- type AttributeMapping
- type Entry
- type JMXMapping
- type JolokiaHTTPGetFetcher
- func (pc *JolokiaHTTPGetFetcher) BuildRequestsAndMappings(configMappings []JMXMapping) ([]*JolokiaHTTPRequest, AttributeMapping, error)
- func (pc *JolokiaHTTPGetFetcher) EventMapping(content []byte, mapping AttributeMapping) ([]common.MapStr, error)
- func (pc *JolokiaHTTPGetFetcher) Fetch(m *MetricSet) ([]common.MapStr, error)
- type JolokiaHTTPPostFetcher
- func (pc *JolokiaHTTPPostFetcher) BuildRequestsAndMappings(configMappings []JMXMapping) ([]*JolokiaHTTPRequest, AttributeMapping, error)
- func (pc *JolokiaHTTPPostFetcher) EventMapping(content []byte, mapping AttributeMapping) ([]common.MapStr, error)
- func (pc *JolokiaHTTPPostFetcher) Fetch(m *MetricSet) ([]common.MapStr, error)
- type JolokiaHTTPRequest
- type JolokiaHTTPRequestFetcher
- type MBeanName
- type MetricSet
- type RequestBlock
- type Target
- type TargetBlock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AttributeMapping ¶
type AttributeMapping map[attributeMappingKey]Attribute
AttributeMapping contains the mapping information between attributes in Jolokia responses and fields in metricbeat events
type Entry ¶
type Entry struct { Request struct { Mbean string `json:"mbean"` Attribute interface{} `json:"attribute"` } Value interface{} }
type JMXMapping ¶
type JolokiaHTTPGetFetcher ¶
type JolokiaHTTPGetFetcher struct { }
JolokiaHTTPGetFetcher constructs and executes an HTTP GET request which will read MBean information from Jolokia
func (*JolokiaHTTPGetFetcher) BuildRequestsAndMappings ¶
func (pc *JolokiaHTTPGetFetcher) BuildRequestsAndMappings(configMappings []JMXMapping) ([]*JolokiaHTTPRequest, AttributeMapping, error)
BuildRequestsAndMappings generates HTTP GET request such as URI,Body.
func (*JolokiaHTTPGetFetcher) EventMapping ¶
func (pc *JolokiaHTTPGetFetcher) EventMapping(content []byte, mapping AttributeMapping) ([]common.MapStr, error)
EventMapping maps a Jolokia response from a GET request is to one or more Metricbeat events
type JolokiaHTTPPostFetcher ¶
type JolokiaHTTPPostFetcher struct { }
JolokiaHTTPPostFetcher constructs and executes an HTTP GET request which will read MBean information from Jolokia
func (*JolokiaHTTPPostFetcher) BuildRequestsAndMappings ¶
func (pc *JolokiaHTTPPostFetcher) BuildRequestsAndMappings(configMappings []JMXMapping) ([]*JolokiaHTTPRequest, AttributeMapping, error)
BuildRequestsAndMappings generates HTTP POST request such as URI,Body.
func (*JolokiaHTTPPostFetcher) EventMapping ¶
func (pc *JolokiaHTTPPostFetcher) EventMapping(content []byte, mapping AttributeMapping) ([]common.MapStr, error)
EventMapping maps a Jolokia response from a POST request is to one or more Metricbeat events
type JolokiaHTTPRequest ¶
type JolokiaHTTPRequest struct { // HttpMethod can be either "GET" or "POST" HTTPMethod string // URI which will be used to query Jolokia URI string // Request body which is only filled if the http method is "POST" Body []byte }
JolokiaHTTPRequest is a small struct which contains all request information needed to construct a reqest helper.HTTP object which will be sent to Jolokia. It is just an intermediary structure which can be easily tested as helper.HTTP fields are all private.
type JolokiaHTTPRequestFetcher ¶
type JolokiaHTTPRequestFetcher interface { // BuildRequestsAndMappings builds the request information and mappings needed to fetch information from Jolokia server BuildRequestsAndMappings(configMappings []JMXMapping) ([]*JolokiaHTTPRequest, AttributeMapping, error) // Fetches the information from Jolokia server regarding MBeans Fetch(m *MetricSet) ([]common.MapStr, error) EventMapping(content []byte, mapping AttributeMapping) ([]common.MapStr, error) }
JolokiaHTTPRequestFetcher is an interface which describes the behaviour of the builder which generates,fetches the HTTP request, which is sent to Jolokia and then parses and maps the response to Metricbeat events.
func NewJolokiaHTTPRequestFetcher ¶
func NewJolokiaHTTPRequestFetcher(httpMethod string) JolokiaHTTPRequestFetcher
NewJolokiaHTTPRequestFetcher is a factory method which creates and returns an implementation class of JolokiaHTTPRequestFetcher interface. HTTP GET and POST are currently supported.
type MBeanName ¶
MBeanName is an internal struct used to store the information by the parsed `mbean` (bean name) configuration field in `jmx.mappings`.
func ParseMBeanName ¶
ParseMBeanName is a factory function which parses a Managed Bean name string identified by mBeanName and returns a new MBean object which contains all the information, i.e. domain and properties of the MBean.
The Mbean string has to abide by the rules which are imposed by Java. For more info: https://docs.oracle.com/javase/8/docs/api/javax/management/ObjectName.html#getCanonicalName--
func (*MBeanName) Canonicalize ¶
Canonicalize Returns the canonical form of the name; that is, a string representation where the properties are sorted in lexical order. The canonical form of the name is a String consisting of the domain part, a colon (:), the canonical key property list, and a pattern indication.
For more information refer to Java 8 [getCanonicalName()](https://docs.oracle.com/javase/8/docs/api/javax/management/ObjectName.html#getCanonicalName--) method.
Set "escape" parameter to true if you want to use the canonicalized name for a Jolokia HTTP GET request, false otherwise.
type MetricSet ¶
type MetricSet struct { mb.BaseMetricSet // contains filtered or unexported fields }
MetricSet type defines all fields of the MetricSet
func (*MetricSet) Fetch ¶
func (m *MetricSet) Fetch(reporter mb.ReporterV2) error
Fetch methods implements the data gathering and data conversion to the right format. It publishes the event which is then forwarded to the output. In case of an error set the Error field of mb.Event or simply call report.Error().
type RequestBlock ¶
type RequestBlock struct { Type string `json:"type"` MBean string `json:"mbean"` Attribute []string `json:"attribute"` Config map[string]interface{} `json:"config"` Target *TargetBlock `json:"target,omitempty"` }
RequestBlock is used to build the request blocks of the following format:
[
{ "type":"read", "mbean":"java.lang:type=Runtime", "attribute":[ "Uptime" ] }, { "type":"read", "mbean":"java.lang:type=GarbageCollector,name=ConcurrentMarkSweep", "attribute":[ "CollectionTime", "CollectionCount" ], "target":{ "url":"service:jmx:rmi:///jndi/rmi://targethost:9999/jmxrmi", "user":"jolokia", "password":"s!cr!t" } }
]
type TargetBlock ¶
type TargetBlock struct { URL string `json:"url"` User string `json:"user,omitempty"` Password string `json:"password,omitempty"` }
TargetBlock is used to build the target blocks of the following format into RequestBlock.
"target":{ "url":"service:jmx:rmi:///jndi/rmi://targethost:9999/jmxrmi", "user":"jolokia", "password":"s!cr!t" }