Package org.jmxtrans.embedded.output
Class GraphiteWriter
java.lang.Object
org.jmxtrans.embedded.output.AbstractOutputWriter
org.jmxtrans.embedded.output.GraphiteWriter
- All Implemented Interfaces:
OutputWriter
public class GraphiteWriter extends AbstractOutputWriter implements OutputWriter
Graphite implementation of the OutputWriter.
This implementation uses
Carbon Plan Text protocol over TCP/IP.
Settings:
- "host": hostname or ip address of the Graphite server. Mandatory
- "port": listen port for the TCP Plain Text Protocol of the Graphite server. Optional, default value: 2003.
- "namePrefix": prefix append to the metrics name. Optional, default value: "servers.#hostname#.".
- "enabled": flag to enable/disable the writer. Optional, default value: {$code true}.
- "graphite.socketConnectTimeoutInMillis": timeout for the socketConnect in millis.
Optional, default value:
SocketWriterPoolFactory.DEFAULT_SOCKET_CONNECT_TIMEOUT_IN_MILLIS - "socketFactory": name of a custom javax.net.SocketFactory to customize the SocketFactory used to connect to the Graphite server
- "protocol": "TCP" or "UDP". Optional, the default value is "TCP"
- "useTls": for "TCP", boolean to use TLS/SSL. Optional, default is "false"
- "tls.insecure": please don't. For TLS/SSL, disable x509 certificate checks. Optional, default is "false"
- "tls.keyStore": path to the given JKS key store. Can be a classpath resource ("classpath:com/example/keystore.jks") of file system related. Optional, if {code null}, then the JVM key store is used.
- "tls.keyStorePassword": password to open the key store.
- "tls.trustStore": path to the given JKS trust store. Can be a classpath resource ("classpath:com/example/truststore.jks") of file system related. Optional, if {code null}, then the JVM key store is used.
- "tls.trustStorePassword": password to open the trust store.
- Author:
- Cyrille Le Clerc, Patrick Brühlmann
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_GRAPHITE_SERVER_PORTstatic StringDEFAULT_NAME_PREFIXFields inherited from class org.jmxtrans.embedded.output.AbstractOutputWriter
SETTING_HOST, SETTING_NAME_PREFIX, SETTING_PORT, SETTING_PROTOCOL, SETTING_PROXY_HOST, SETTING_PROXY_PORT, SETTING_SOCKET_FACTORY, SETTING_TLS_INSECURE, SETTING_TLS_KEY_STORE, SETTING_TLS_KEY_STORE_PASSWORD, SETTING_TLS_TRUST_STORE, SETTING_TLS_TRUST_STORE_PASSWORD, SETTING_TOKEN, SETTING_URL, SETTING_USE_TLS, SETTING_USERNAME -
Constructor Summary
Constructors Constructor Description GraphiteWriter() -
Method Summary
Modifier and Type Method Description voidstart()Load settings, initialize theSocketWriterpool and test the connection to the graphite server.voidstop()Close theSocketWriterpool.voidwrite(Iterable<QueryResult> results)Send given metrics to the Graphite server.Methods inherited from class org.jmxtrans.embedded.output.AbstractOutputWriter
equals, getBooleanSetting, getIntSetting, getIntSetting, getLongSetting, getSettings, getStrategy, getStringSetting, getStringSetting, hashCode, isEnabled, setEnabled, setSettings, setStrategy, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jmxtrans.embedded.output.OutputWriter
getSettings, isEnabled, setEnabled, setSettings
-
Field Details
-
DEFAULT_GRAPHITE_SERVER_PORT
public static final int DEFAULT_GRAPHITE_SERVER_PORT- See Also:
- Constant Field Values
-
DEFAULT_NAME_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Details
-
GraphiteWriter
public GraphiteWriter()
-
-
Method Details
-
start
public void start()Load settings, initialize theSocketWriterpool and test the connection to the graphite server. ALogger.warn(String)message is emitted if the connection to the graphite server fails.- Specified by:
startin interfaceOutputWriter- Overrides:
startin classAbstractOutputWriter
-
write
Send given metrics to the Graphite server.- Specified by:
writein interfaceOutputWriter- Specified by:
writein classAbstractOutputWriter
-
stop
Close theSocketWriterpool.- Specified by:
stopin interfaceOutputWriter- Overrides:
stopin classAbstractOutputWriter- Throws:
Exception
-