You'll need to run this on the Server in Orgmapper, eg:
/opt/opscode/bin/orgmapper
orgmapper>> eval(::File.read("/path/to/code.rb"))| LoadPlugin java | |
| <Plugin "java"> | |
| # required JVM argument is the classpath | |
| JVMARG "-Djava.class.path=/usr/share/collectd/java/collectd-api.jar:/usr/share/collectd/java/generic-jmx.jar" | |
| LoadPlugin "org.collectd.java.GenericJMX" | |
| <Plugin "GenericJMX"> | |
| ################ | |
| # MBean blocks # | |
| ################ |
| #! /usr/bin/env ruby | |
| require 'json' | |
| require 'date' | |
| require 'optparse' | |
| require 'pp' | |
| require 'net/http' | |
| config_file = nil | |
| debug = false |
| Hi Sensuite: | |
| I'd like each node to check our graphite server to determine if its CPU steal percent merited a warning. Of course, when I tried it, that generated a thundering herd when the sensu server published a check request. I was doing this because the check_cpu.rb plugin has steal/usage that are 10x what we get from collectd (or what I observe w/ top). | |
| I can re-implement as a standalone check with some sort of randomization around the interval, but I prefer most checks regarding node health to come from the server. | |
| From https://github.com/sensu/sensu/blob/master/lib/sensu/client.rb#L221 it looks like one could add a random splay to `scheduling_delay` without too much hackery, but that may be undesirable. | |
| So this brings me to the following questions: | |
| * Is there a current method to splay the client scheduling of checks? |
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'json' | |
| event = JSON.parse(STDIN.read) | |
| puts event.to_json |
| #/usr/bin/env ruby -r chef | |
| o = Ohai::System.new; o.load_plugins; @data = Mash.new; o.run_plugins.each { |plugin| @data = Chef::Mixin::DeepMerge.deep_merge(@data, plugin.data) }; File.open('/tmp/ohai.json', 'w') { |f| f.write(JSON.pretty_generate(@data)) }” |
| # Orgmapper snippet to output all nodes with client versions in all organizations to a JSON file | |
| # To Use: | |
| # 1) Start orgmapper | |
| # 2) Load the script | |
| # eval(::File.read("/path/to/orgmapper_all_client_versions.rb")) | |
| # 3) output will be printed to the screen and also written to JSON_OUTPUT_FILE | |
| JSON_OUTPUT_FILE = 'chef_versions.json' |
| --- | |
| :update_sources: true | |
| :verbose: true | |
| :backtrace: false | |
| :bulk_threshold: 1000 | |
| install: "--user" | |
| update: "--user" |
| puts YAML.dump({ 'instances' => @immutable_array_of_mashes.map { |item| item.to_hash }}) | |
| --- | |
| instances: | |
| - m: m | |
| - b: b | |
| - top: !ruby/hash:Chef::Node::ImmutableMash | |
| second_level: some value | |
| top_level_2: !ruby/array:Chef::Node::ImmutableArray | |
| - array | |
| - of |
| current_dir = File.dirname(__FILE__) | |
| # might be interesting as Dir.pwd | |
| my_cookbook = File.expand_path("..", current_dir) | |
| log_level :info | |
| log_location STDOUT | |
| # Need this to create myself as local non-privileged chef client node: | |
| node_name 'workstation_macpro' | |
| # use 'berks vendor' and this cookbook path: |