Package org.jmxtrans.embedded.output
Class CopperEggWriter
java.lang.Object
org.jmxtrans.embedded.output.AbstractOutputWriter
org.jmxtrans.embedded.output.CopperEggWriter
- All Implemented Interfaces:
OutputWriter
public class CopperEggWriter extends AbstractOutputWriter implements OutputWriter
CopperEgg Metrics implementation of the OutputWriter.
This implementation uses v2 of the CopperEgg API
Settings:
- "
url": CopperEgg API server URL. Optional, default value:DEFAULT_COPPEREGG_API_URL. - "
user": CopperEgg user. Mandatory - "
token": CopperEgg APIKEY. Mandatory - "
coppereggApiTimeoutInMillis": read timeout of the calls to CopperEgg HTTP API. Optional, default value:DEFAULT_COPPEREGG_API_TIMEOUT_IN_MILLIS. - "
enabled": flag to enable/disable the writer. Optional, default value: {$code true}. - "
source": CopperEgg . Optional, default value:DEFAULT_SOURCE(the hostname of the server).
- Author:
- Cyrille Le Clerc CopperEggWriter.java was derived from LibratoWriter.java, Scott Johnson
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_COPPEREGG_API_TIMEOUT_IN_MILLISstatic StringDEFAULT_COPPEREGG_API_URLstatic StringDEFAULT_SOURCEstatic StringMETRIC_TYPE_COUNTERstatic StringMETRIC_TYPE_GAUGEstatic StringSETTING_COPPEREGG_API_TIMEOUT_IN_MILLISstatic StringSETTING_SOURCEFields 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 CopperEggWriter() -
Method Summary
Modifier and Type Method Description StringconvertStreamToString(InputStream is)intcue_getExceptionCounter()voidcue_serialize(Iterable<QueryResult> counters, OutputStream out)voidensure_metric_groups()If metric group doesn't exist, create it If it does exist, update it.StringgroupFind(String findName, String findIndex, Integer ExpectInt)voidone_set(String mg_name, List<QueryResult> counters)voidread_config(InputStream in)read_config() The copperegg_config.json file contains a specification for the metric groups and dashboards to be created / or updated.StringSend_Commmand(String command, String msgtype, String payload, Integer ExpectInt)voidsend_metrics(String mg_name, List<QueryResult> counters)voidsort_n_send(String mg_name, List<QueryResult> mg_counters)voidstart()Load settingsvoidwrite(Iterable<QueryResult> results)Export collected metrics to CopperEggStringwrite_tostring(com.fasterxml.jackson.databind.JsonNode json)Methods inherited from class org.jmxtrans.embedded.output.AbstractOutputWriter
equals, getBooleanSetting, getIntSetting, getIntSetting, getLongSetting, getSettings, getStrategy, getStringSetting, getStringSetting, hashCode, isEnabled, setEnabled, setSettings, setStrategy, stop, 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, stop
-
Field Details
-
METRIC_TYPE_GAUGE
- See Also:
- Constant Field Values
-
METRIC_TYPE_COUNTER
- See Also:
- Constant Field Values
-
DEFAULT_COPPEREGG_API_URL
- See Also:
- Constant Field Values
-
SETTING_COPPEREGG_API_TIMEOUT_IN_MILLIS
- See Also:
- Constant Field Values
-
DEFAULT_COPPEREGG_API_TIMEOUT_IN_MILLIS
public static final int DEFAULT_COPPEREGG_API_TIMEOUT_IN_MILLIS- See Also:
- Constant Field Values
-
SETTING_SOURCE
- See Also:
- Constant Field Values
-
DEFAULT_SOURCE
- See Also:
- Constant Field Values
-
-
Constructor Details
-
CopperEggWriter
public CopperEggWriter()
-
-
Method Details
-
start
public void start()Load settings- Specified by:
startin interfaceOutputWriter- Overrides:
startin classAbstractOutputWriter
-
write
Export collected metrics to CopperEgg- Specified by:
writein interfaceOutputWriter- Specified by:
writein classAbstractOutputWriter
-
sort_n_send
-
send_metrics
-
one_set
-
cue_serialize
public void cue_serialize(@Nonnull Iterable<QueryResult> counters, @Nonnull OutputStream out) throws IOException- Throws:
IOException
-
cue_getExceptionCounter
public int cue_getExceptionCounter() -
ensure_metric_groups
public void ensure_metric_groups()If metric group doesn't exist, create it If it does exist, update it. -
convertStreamToString
- Throws:
IOException
-
read_config
read_config() The copperegg_config.json file contains a specification for the metric groups and dashboards to be created / or updated. Mandatory- Throws:
Exception
-
groupFind
- Throws:
Exception
-
write_tostring
-
Send_Commmand
-