Full namespace name:
clojure.java.jmx OverviewJMX support for Clojure Usage (require '[clojure.java.jmx :as jmx]) What beans do I have? (jmx/mbean-names "*:*") -> #<HashSet [java.lang:type=MemoryPool,name=CMS Old Gen, java.lang:type=Memory, ...] What attributes does a bean have? (jmx/attribute-names "java.lang:type=Memory") -> (:Verbose :ObjectPendingFinalizationCount :HeapMemoryUsage :NonHeapMemoryUsage) What is the value of an attribute? (jmx/read "java.lang:type=Memory" :ObjectPendingFinalizationCount) -> 0 (jmx/read "java.lang:type=Memory" [:HeapMemoryUsage :NonHeapMemoryUsage]) -> {:NonHeapMemoryUsage {:used 16674024, :max 138412032, :init 24317952, :committed 24317952}, :HeapMemoryUsage {:used 18619064, :max 85393408, :init 0, :committed 83230720}} Can't I just have *all* the attributes in a Clojure map? (jmx/mbean "java.lang:type=Memory") -> {:NonHeapMemoryUsage {:used 16674024, :max 138412032, :init 24317952, :committed 24317952}, :HeapMemoryUsage {:used 18619064, :max 85393408, :init 0, :committed 83230720}, :ObjectPendingFinalizationCount 0, :Verbose false} Can I find and invoke an operation? (jmx/operation-names "java.lang:type=Memory") -> (:gc) (jmx/invoke "java.lang:type=Memory" :gc) -> nil What about some other process? Just run *any* of the above code inside a with-connection: (jmx/with-connection {:host "localhost", :port 3000} (jmx/mbean "java.lang:type=Memory")) -> {:ObjectPendingFinalizationCount 0, :HeapMemoryUsage ... etc.} Can I serve my own beans? Sure, just drop a Clojure ref into an instance of clojure.java.jmx.Bean, and the bean will expose read-only attributes for every key/value pair in the ref: (jmx/register-mbean (create-bean (ref {:string-attribute "a-string"})) "my.namespace:name=Value")
Known implementations:
clojure.lang.Associative, java.lang.Boolean, javax.management.openmbean.CompositeData, javax.management.openmbean.TabularData, nil, ObjectUsage: (objects->data _)
Convert JMX object model into data. Handles CompositeData, TabularData, maps, and atoms.Source Types
Fields:
[state-ref]Protocols:
Interfaces:
javax.management.DynamicMBeanUsage: (->Bean state-ref)
Positional factory function for class clojure.java.jmx.Bean.Source
Usage: (attribute-names n)
All attribute names available on an MBean.Source
Usage: (create-bean state-ref)
Expose a reference as a JMX bean. state-ref should be a Clojure reference (ref, atom, agent) containing a map. Using an agent for the state-ref is not recommended when the bean may be modified with the setAttribute(s) methods. The setAttribute(s) methods will block on the agent to complete all submitted actions (via await).Source
Usage: (invoke n op & args)
Invoke an operation an an MBean. See also: invoke-signatureSource
Usage: (invoke-signature n op signature & args)
Invoke an operation an an MBean. You must also supply the signature of the operation. This is useful in cases where the operation is overloaded. Otherwise you should use the 'invoke' operation which will determine the signature for you. The signature parameter is a sequence of strings that describes the method parameter types in order.Source
Usage: (mbean n)
Like clojure.core/bean, but for JMX beans. Returns a read-only map of a JMX bean's attributes. If an attribute it not supported, value is set to the exception thrown.Source
Usage: (mbean-names n)
Finds all MBeans matching a name on the current *connection*.Source
Usage: (operation-names n)
All operation names available on an MBean.Source
Read one or more mbean properties.Source
Usage: (readable? n attr)
Is attribute readable?Source
Usage: (register-mbean mbean mbean-name)
Register an mbean with the current *connection*.Source
Usage: (unregister-mbean mbean-name)
Unregister mbean named mbean-name with the current *connection*.Source
Usage: (with-connection opts & body)
Execute body with a JMX connection created based on opts. opts can include [default]: :protocol The protocol to use [rmi:///jndi/rmi] :host The host to connect to [localhost] :port The port to connect to [3000] :jndi-path The jndi-path to use [jmxuri] :url The full url (as a String) to use instead of generating a rmi url from the above options [nil] :environment A map representing the environment used for the connection. See JMXConnectorFactory/connect for details [{}]Source
Usage: (write! n attr value)
Write an attribute value.Source
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4