-
Notifications
You must be signed in to change notification settings - Fork 0
Expression Language
EmbeddedJmxTrans uses an expression language based on property placeholders (e.g. "${graphite.host:2003}
", ObjectName properties (e.g. "%name%
") and basic functions (e.g. "#canonical_hostname#
").
EmbeddedJmxTrans supports property placeholders with the {prop-name[:default-value]}
syntax.
The default-value
is optional. An exception is raised if no default value is defined and the property placeholder is not found.
Environment variables are looked-up in the following order:
- JVM system properties (
System.getProperty("graphite.host")
) - JVM environment variables (
System.getenv("graphite.host")
) - JVM environment variables after a "to-upper-case + dot-to-underscore" transformation (
System.getenv("GRAPHITE_HOST")
)
Query resultAlias
support usage of ObjectName properties with the %myproperty%
syntax.
ObjectName property values are escaped with the following rules:
- If a value of a property is escaped with double quotes (see
ObjectName.quote(value)
), the double quotes are removed from the EmbeddedJmxTrans resolved value (e.g. if"mydatasource"
->mydatasource
). - Non alpha-numeric letters are replaced by underscore:
'_'
(e.g.jdbc/my-datasource
->jdbc_my_datasource
).
Sample of ObjectName property usage in query resultAlias
Configuration:
{
"objectName": "Catalina:type=Resource,resourcetype=Context,path=/,host=localhost,class=javax.sql.DataSource,name=*",
"resultAlias": "tomcat.datasource.%host%.%path%.%name%",
"attribute": "numActive"
}
Will match ObjectName:
Catalina:type=Resource,resourcetype=Context,path=/,host=localhost,class=javax.sql.DataSource,name="jdbc/my-datasource"
And resultAlias
will be:
tomcat.datasource.localhost._.jdbc_my_datasource
EmbeddedJmxTrans supports basic functions with "#
" based expressions like "#my_function#
".
List of out-of-the-box functions:
Function | Description |
---|---|
#hostname# |
Value of InetAddress.getLocalHost().getHostName() |
#reversed_hostname# |
Same as #hostname# in the reverse order (e.g. server1.mycompany.com -> com.mycompany.server1 ) |
#escaped_hostname# |
same as #hostname# with "." replaced by "_" (e.g. server1.mycompany.com -> server1_mycompany_com ) |
#canonical_hostname# |
Value of InetAddress.getLocalHost().getCanonicalHostName() |
#reversed_canonical_hostname# |
same as #canonical_hostname# in the reverse order (e.g. server1.mycompany.com -> com.mycompany.server1 ) |
#escaped_canonical_hostname# |
same as #canonical_hostname# with "." replaced by "_" (e.g. server1.mycompany.com -> server1_mycompany_com ) |
#hostaddress# |
Value of InetAddress.getLocalHost().getHostAddress() |
#escaped_hostaddress# |
same as #hostaddress# with "." replaced by "_" |
- Configuration
- ... Expression Language
- ... Configuration Sample
- Output Writers
- ... Graphite Writer
- ... Graphite Pickle Writer
- ... Librato Writer
- ... SLF4J Writer
- ... Console Writer
- Integration
- ... Maven Setup
- ... Spring Integration
- ... Plain Java Servlet Integration
- Configuration Templates
- ... Tomcat
- ... JVM
- Internals
- ... Implementation Decisions
- ... Health Monitoring
- Latest javadocs
- Forum (Google Groups)
- Downloads
- Samples
- ... [Cocktail Web App] (https://github.com/jmxtrans/embedded-jmxtrans-samples/tree/master/embedded-jmxtrans-webapp-coktail)
- License
- Release Notes