Git Product home page Git Product logo

jmxquery's People

Contributors

akki avatar dgildeh avatar sacreman avatar shoelzle avatar tomashley avatar tradel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jmxquery's Issues

RPM installation

I am a fan of this tool and use it frequently. It would be great to have this made available as an RPM pkg for easier and faster installation.

JMXQuery fails silently if the bean path contains "/"

Tomcat and other apps often create a bean for each servlet mount point. If that path contains a "/", JMXQuery will not output anything.

$ java -jar jmxquery.jar -url service:jmx:rmi:///jndi/rmi://localhost:9010/jmxrmi -metrics 'foo=Tomcat:type=DataSource,context=/,host=localhost,class=javax.sql.DataSource,name="jdbc/storage"/numIdle;'
$ java -jar jmxquery.jar -url service:jmx:rmi:///jndi/rmi://localhost:9010/jmxrmi -metrics 'foo=Tomcat:type=ProtocolHandler,port=8080/connectionCount;'
foo=Tomcat:type=ProtocolHandler,port=8080/connectionCount=1

Installs on `python3.5`

But line 152 has a new 3.6 f"" string, so it shouldn't. Error:

(jmx) mdione@demo-hv2:~/src/works/cloudian/jmx$ python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import jmxquery
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mdione/src/works/cloudian/jmx/lib/python3.5/site-packages/jmxquery/__init__.py", line 152
    logger.debug(f"Running command: {command}")
                                             ^
SyntaxError: invalid syntax

recursive loop in JMXConnector

getAttributes(foundKey, cData.get(attribute.getAttributeKey())).
cData.get(attribute.getAttributeKey() is null which causes a recursive loop.

I think JMXConnector.java needs

if (value instanceof CompositeData) {
CompositeData cData = (CompositeData) value;
// If attribute has key specified, only get that otherwise get all keys
if (attribute.getAttributeKey() != null) {
try {

                JMXMetric foundKey = new JMXMetric(attribute.getmBeanName(),
                                            attribute.getAttribute(),
                                            attribute.getAttributeKey());
                foundKey.setAttributeType(cData.get(attribute.getAttributeKey()));
                foundKey.setmetricName(attribute.getmetricName());
                foundKey.setmetricLabels(attribute.getmetricLabels()); 
                Object oValue = cData.get(attribute.getAttributeKey());  // add this
                if (oValue == null) oValue = "";                 // add this

// or perhaps if (oValue == null) oValue = "Missing" ;
attributes.addAll(getAttributes(foundKey, oValue)); // change this
<<

                 // attributes.addAll(getAttributes(foundKey, cData.get(attribute.getAttributeKey()))); 
            
            } catch (InvalidKeyException e) {
                // Key doesn't exist so don't add to list
            }    

Getting error with Cassandra version 3.11.3

Hi

i using the following code to test Cassandra JMX query but getting error jsondecode error

My cassandra default install and setup from official web site

my java version, centos 7, python 3.6.6

(py3.6.6rc1) [hadn@localhost ~]$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

[hadn@localhost ~]$ uname -r
3.10.0-514.el7.x86_64
[hadn@localhost ~]$ uname -a
Linux localhost.localdomain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux`

[hadn@localhost ~]$ python
Python 3.6.6rc1 (default, Aug 10 2018, 09:40:06)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.

from jmxquery import JMXConnection, JMXQuery

jmx = JMXConnection("service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi",jmx_username="admin", jmx_password="admin")

wowza_object = jmx.query([JMXQuery(":")])
with open("to_string.txt", "w") as f:
for i in wowza_object:
#print(i.to_string())
f.write(i.to_string() + "\n")

with open("to_query_string.txt", "w") as f:
for i in wowza_object:
#print(i.to_query_string())
f.write(i.to_query_string() + "\n")
print(i.to_query_string())

[hadn@localhost ~]$ rpm -qi cassandra Name : cassandra Version : 3.11.3 Release : 1 Architecture: noarch Install Date: Fri 10 Aug 2018 09:30:57 AM EDT Group : Development/Libraries Size : 39319216 License : Apache Software License 2.0 Signature : RSA/SHA256, Wed 25 Jul 2018 02:59:43 AM EDT, Key ID a278b781fe4b2bda Source RPM : cassandra-3.11.3-1.src.rpm Build Date : Wed 25 Jul 2018 02:16:54 AM EDT Build Host : 1e1e3559cbdd Relocations : (not relocatable) URL : http://cassandra.apache.org/ Summary : Cassandra is a highly scalable, eventually consistent, distributed, structured key-value store. Description : Cassandra is a distributed (peer-to-peer) system for the management and storage of structured data.

(py3.6.6rc1) [hadn@localhost ~]$ python jconsole_cassandra.py Traceback (most recent call last): File "jconsole_cassandra.py", line 5, in <module> wowza_object = jmx.query([JMXQuery("*:*")]) File "/home/hadn/py3.6.6rc1/lib/python3.6/site-packages/jmxquery/__init__.py", line 209, in query return self.__run_jar(queries) File "/home/hadn/py3.6.6rc1/lib/python3.6/site-packages/jmxquery/__init__.py", line 170, in __run_jar metrics = self.__load_from_json(jsonOutput) File "/home/hadn/py3.6.6rc1/lib/python3.6/site-packages/jmxquery/__init__.py", line 180, in __load_from_json jsonMetrics = json.loads(jsonOutput) File "/home/hadn/.pyenv/versions/3.6.6rc1/lib/python3.6/json/__init__.py", line 354, in loads return _default_decoder.decode(s) File "/home/hadn/.pyenv/versions/3.6.6rc1/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/hadn/.pyenv/versions/3.6.6rc1/lib/python3.6/json/decoder.py", line 355, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting ',' delimiter: line 467 column 177 (char 89736)

PyPI package out of date

Recent commits to the project have included support for older versions of Python 3 by removing f-strings. Is it possible to bundle a new version of the package with these changes and push to PyPI for easier installation?

Thank you.

Invoke simple methods using JMX

I would like to invoke simple methods using Python. I can do this change, but I would like your approval because as far as I was able to understand the purpose of this project is different. Maybe I should clone this project or create a new one with a different purpose, but I would like to try this direction as well. Thank you for your support!!

Tibor

new code to support loop querying data

Ive got some code which allows JMXQuery to loop for example adding -count 20 -every 30
says loop 20 times, and sleep for 30 seconds between issuing the query.

It generates
Date:2019/09/16 Time:15:21:22.573 Seconds from start:0 loop:0

com.bea:Name=colin,Type=CdiContainer/Policy (String) = Enabled
com.bea:Name=colin,Type=CdiContainer/DynamicallyCreated (Boolean) = false
com.bea:Name=colin,Type=CdiContainer/Parent (ObjectName) = com.bea:Name=colin,Type=Domain
...
Date:2019/09/16 Time:15:21:52.573 Seconds from start:30 loop:1
....

it adds the data to the json file, so now post processing can create tabular data which can be displayed in a spread sheet.
I see this extentions being used as
-count 999999 -every 1800 - so I get out a chart of stats every half an hour

Support authenticated JMX connections

Some app servers, like JBoss, require authenticated connections by default. We need to extend the plugin to support authentication (and probably SSL too).

can not loads json

{"mBeanName" : "java.lang:type=Runtime", "attribute" : "ClassPath", "attributeType" : "String", "value" : "C:\xxx"},
error by "C:\xxx"

Kafka.producer metrics

Hi,
I'm trying to pull kafka.producer metrics and here is my jmxQuery list of producer metrics

jmxQuery = [
# UnderReplicatedPartitions
JMXQuery("kafka.producer:type=producer-metrics,name=confluent-metrics-reporter",
metric_name="kafka_producer_producer-metrics_confluent-metrics-reporter_{attribute}"),
]

But this doesn't give me any output. How can I get kafka.producer metrics using your jmxquery. I see that it has all the kafka.producer beans in it.

Thanks
Prateek

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.