Package org.jmxtrans.embedded.output
Class CsvWriter
java.lang.Object
org.jmxtrans.embedded.output.AbstractOutputWriter
org.jmxtrans.embedded.output.CsvWriter
- All Implemented Interfaces:
OutputWriter
public class CsvWriter extends AbstractOutputWriter implements OutputWriter
This output writer can ONLY be used on a per query basis, not in a global
output writer configuration because this aggregates all of the different
attributes returned by the query into a single line in a csv file, using the
QueryResult.getName() as the value of the
header.
The query can contain multiple MBeans by pattern matched ObjectName
Example query configuration:
"queries": [
{
"outputWriters": [
{
"@class": "org.jmxtrans.embedded.output.CsvWriter",
"settings": {
"outputFile": "log/jmxlog.csv"
}
}
],
"objectName": "java.lang:type=Memory",
"resultAlias": "jvm.memory",
"attributes": [
{
"name": "HeapMemoryUsage",
"keys": ["committed", "used"]
},
{
"name": "NonHeapMemoryUsage",
"keys": ["committed", "used"]
}
]
}
]
See embedded-jmxtrans configuration for more details.- Author:
- Ryan Larson
-
Field Summary
Fields 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 CsvWriter() -
Method Summary
Modifier and Type Method Description voidstart()No-op implementationvoidstop()No-op implementationvoidwrite(Iterable<QueryResult> results)Write all the given QueryResult to the target system.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
-
Constructor Details
-
CsvWriter
public CsvWriter()
-
-
Method Details
-
start
public void start()Description copied from class:AbstractOutputWriterNo-op implementation- Specified by:
startin interfaceOutputWriter- Overrides:
startin classAbstractOutputWriter
-
stop
Description copied from class:AbstractOutputWriterNo-op implementation- Specified by:
stopin interfaceOutputWriter- Overrides:
stopin classAbstractOutputWriter- Throws:
IOException
-
write
Description copied from interface:OutputWriterWrite all the given QueryResult to the target system.- Specified by:
writein interfaceOutputWriter- Specified by:
writein classAbstractOutputWriter
-