From f8ebefd10096e4121ce71e3f01da6e9f90101e75 Mon Sep 17 00:00:00 2001 From: Jonathan Shook Date: Wed, 15 Jul 2020 11:44:43 -0500 Subject: [PATCH] add more JMX docs --- driver-jmx/src/main/resources/jmx.md | 35 ++++++++++++++++++- .../test/resources/activities/jmx-test-1.yaml | 2 ++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/driver-jmx/src/main/resources/jmx.md b/driver-jmx/src/main/resources/jmx.md index c5db06e0d..95b5f17a4 100644 --- a/driver-jmx/src/main/resources/jmx.md +++ b/driver-jmx/src/main/resources/jmx.md @@ -54,6 +54,25 @@ statements: object: org.apache.cassandra.metrics:type=Compaction,name=PendingTasks ``` +## printvar + +If you want to simply read a value from a metric and print it out on stdout, you can do it with +the `printvar` command. This is identical to the readvar command except that it puts the resulting +variable (after any as_name and as_type options are applied) on the console. + +``` +statements: + - read1: printvar=Value as_type=int as_name=pending_tasks + url: service:jmx:rmi:///jndi/rmi://dsehost:7199/jmxrmi + object: org.apache.cassandra.metrics:type=Compaction,name=PendingTasks +``` + +This will produce an output like this: +``` +# read JMX attribute ' Value' as class java.lang.Integer as_type=int as_name=pending_tasks +pending_tasks=0 +``` + ## explain If you want to see the details about a managed object, you can use the explain command: @@ -68,4 +87,18 @@ statements: This will use the MBeanInfo to interrogate the named management bean and provide a summary of it's available attriburtes, operations, notifications, and constructors to stdout. -This is not meant for bulk testing, but more for explaining and documenting JMX beans. \ No newline at end of file +This is not meant for bulk testing, but more for explaining and documenting JMX beans. + +The above example will produce an output like this: + +``` +### MBeanInfo for 'org.apache.cassandra.metrics:type=Compaction,name=PendingTasks' +# classname: org.apache.cassandra.metrics.CassandraMetricsRegistry$JmxGauge +# Information on the management interface of the MBean +## attributes: +# Attribute exposed for management +- 'Value' type=java.lang.Objectreadable=true writable=false is_is=false +## operations: +# Operation exposed for management +- objectName() -> javax.management.ObjectName impact=UNKNOWN +``` diff --git a/driver-jmx/src/test/resources/activities/jmx-test-1.yaml b/driver-jmx/src/test/resources/activities/jmx-test-1.yaml index 1fe50283c..1a54cc775 100644 --- a/driver-jmx/src/test/resources/activities/jmx-test-1.yaml +++ b/driver-jmx/src/test/resources/activities/jmx-test-1.yaml @@ -8,3 +8,5 @@ statements: as_name: pending_tasks +#op=url=service:jmx:rmi:///jndi/rmi://dsehost:7199/jmxrmi object=org.apache.cassandra.metrics:type=Compaction,name=PendingTasks readvar=Value as_type=int as_name=pending_tasks +