Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Perf Counters #39

Open
3Chris opened this issue Jan 15, 2018 · 10 comments
Open

Dynamic Perf Counters #39

3Chris opened this issue Jan 15, 2018 · 10 comments

Comments

@3Chris
Copy link

3Chris commented Jan 15, 2018

Hello,

Would it be possible to get all Perf Counters by one query without know the perf value exactly?

For now it is working with that query:

check_http_json.rb -u 'xx' -E 'ActiveCount' -w 5 -c 10 --element_regex_global -p value§jboss.as:data-source=productx,statistics=pool,subsystem=datasources§ActiveCount?value§jboss.as:data-source=producty,statistics=pool,subsystem=datasources§ActiveCount?value§jboss.as:data-source=db2-productz,statistics=pool,subsystem=datasources§ActiveCount -d § --perf_splitter=?

But I do not really always know the names of the products like 'productx', 'producty' etc. so I need to get the value for all products as perf counters.

Json:

{
  "timestamp": 1515998720,
  "status": 200,
  "request": {
    "mbean": "jboss.as:data-source=*,statistics=pool,subsystem=datasources",
    "attribute": "ActiveCount",
    "type": "read"
  },
  "value": {
    "jboss.as:data-source=productx,statistics=pool,subsystem=datasources": {
      "ActiveCount": 0
    },
    "jboss.as:data-source=producty,statistics=pool,subsystem=datasources": {
      "ActiveCount": 0
    },
    "jboss.as:data-source=db2-productz,statistics=pool,subsystem=datasources": {
      "ActiveCount": 0
    }
  }
}
@3Chris
Copy link
Author

3Chris commented Jan 15, 2018

I am not a ruby programmer but probably something like that could be the solution:

json_flat.each {|key, value| puts "#{key} is #{value}" }

For example to get every perf counter with:
check_http_json.rb -u 'xx' -E 'ActiveCount' -w 5 -c 10 --element_regex_global -p all

@3Chris
Copy link
Author

3Chris commented Jan 18, 2018

I think I got it. It would be great, if you will integrate it in your work:

Example Request:
check_http_json.rb -u 'xx' -E 'ActiveCount' -w 5 -c 10 --element_regex_global -p all

Code:

        json_flat.each {|key, value|}.each do |key,value|
		if key =~ /^value/
			key += "'#{key}'"
			p.push ("%s=%s" % [ key.insert(0,'\'') , value ])
		end
	end

@phrawzty
Copy link
Owner

Hi there,

Thanks for your patience on a reply (stuff came up in the real world, heh). I like your suggestion and will definitely take a look at it within the next few days.

Cheers!

@3Chris
Copy link
Author

3Chris commented Jan 30, 2018

Would be awesome! Thank you.

@3Chris
Copy link
Author

3Chris commented Feb 16, 2018

Hello there,

I have optimized it a little bit. Probably it is helpful for your implementation. For best integration in graphing software like graphite I am replacing all special characters with "_".

"^value" could be replaced by a script argument which defines the needed performance values.

json_flat.each {|key, value|}.each do |key,value|
       if key =~ /^value/
             p.push ("%s=%s" % [ key.gsub(/[^0-9A-Za-z]/, '_') , value ])
       end
end

@phrawzty
Copy link
Owner

Hello,

Thanks for your continued interest in this feature. To be honest I'm not entirely sure what you're trying to do. Could you please propose a use case with an example? Also, it'd really help if you could prepare a pull request with the code modifications that you're interested in making. I'd be glad to help you with this process if you like.

@3Chris
Copy link
Author

3Chris commented Mar 1, 2018

Hello,

The use case is to get all needed values from the json output to the performance counters, without knowing their names.

Unfortunately I am not able to create a Pull Requests...

@phrawzty
Copy link
Owner

phrawzty commented Mar 8, 2018

Unfortunately I am not able to create a Pull Requests...

In that you don't know how, or are somehow restricted from doing so? I'm curious now, heh.

@3Chris
Copy link
Author

3Chris commented Mar 9, 2018

I have never done an pull request... and Im confused at handling with it :(
Would it be ok for you, if I provide my code with https://pastebin.com/ ?

@cadirol
Copy link

cadirol commented Oct 10, 2018

Hy all
I would really like this improvement as well!! The plugin itself is awesome!! Thank you phrwazty for your work!!
Should i create a pull request? Its not a big deal for me
BR cadirol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants