This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns reducers.blog1 | |
[:require [clojure.core.reducers :as r] | |
[clojure.string :as string]]) | |
;; The Families in the Village | |
(def village | |
[ | |
{:home :north :family "smith" :name "sue" :age 37 :sex :f :role :parent} | |
{:home :north :family "smith" :name "stan" :age 35 :sex :m :role :parent} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# riemann feeds | |
# jmxbeanconfigOperatingSystem | |
# Some normalisation stuff | |
bytes2GB = (1024 * 1024 * 1024).to_f | |
bytes_2_gigabytes = ->(b) { b.to_f / bytes2GB } | |
{ bean_name: 'java.lang:type=OperatingSystem', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# riemann feeds | |
# jmxbeanconfigNameNodeActivity | |
{ bean_name: 'Hadoop:service=NameNode,name=NameNodeActivity', | |
event_defaults: { tags: ['Activity', 'Files'] }, | |
attributes: {include: ['files_created', 'files_deleted']}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# riemann feeds | |
# ./etc/feedspecNameNode.rb | |
config_home = './etc' | |
# Usual configuration | |
credentials_jmx_path = "#{config_home}/credentialsJMX.yaml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/jruby | |
# riemann feeds | |
# A simple JMX feed monitoring the Hadoop YARN NameNode | |
require 'riemann-feeds' # bootstrap rieeman feeds | |
#$DEBUG = true # force diags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def each_event | |
beanInst = find_jmx_bean_or_croak('Hadoop:service=NameNode,name=NameNodeActivity') | |
yield({host: '10.16.0.48', service: 'NameNode', status: 'ok', tags: ["YARN", "NameNode", "Activity", "Files"], metric: beanInst.files_created, description: 'files_created'}) | |
yield({host: '10.16.0.48', service: 'NameNode', status: 'ok', tags: ["YARN", "NameNode", "Activity", "Files"], metric: beanInst.files_deleted, description: 'files_deleted'}) | |
beanInst = find_jmx_bean_or_croak('java.lang:type=OperatingSystem') | |
(r = map_free_physical_memory_size_568369({host: '10.16.0.48', service: 'NameNode', status: 'ok', tags: ["YARN", "NameNode", "OS", "FreeMem"], metric: metric_free_physical_memory_size_710285(beanInst.free_physical_memory_size), description: 'free_physical_memory_size'})) && select_free_physical_memory_size_237256(r) && yield(r) | |
yield({host: '10.16.0.48', service: 'NameNode', status: 'ok', tags: ["YARN", "NameNode", "OS"], metric: beanInst.free_swap_space_size, description: 'free_swap_space_s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/jruby | |
# riemann feeds | |
# A simple JMX feed monitoring the Hadoop YARN NameNode | |
require 'riemann-feeds' # bootstrap rieeman feeds | |
#$DEBUG = true # force diags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def each_event | |
beanInst = find_jmx_bean_or_croak('Hadoop:service=NameNode,name=NameNodeActivity') | |
yield({host: '10.16.0.48', service: 'NameNode', status: 'ok', tags: ["YARN", "NameNode"], metric: beanInst.create_file_ops, description: 'create_file_ops'}) | |
yield({host: '10.16.0.48', service: 'NameNode', status: 'ok', tags: ["YARN", "NameNode"], metric: beanInst.files_created, description: 'files_created'}) | |
yield({host: '10.16.0.48', service: 'NameNode', status: 'ok', tags: ["YARN", "NameNode"], metric: beanInst.files_appended, description: 'files_appended'}) | |
yield({host: '10.16.0.48', service: 'NameNode', status: 'ok', tags: ["YARN", "NameNode"], metric: beanInst.get_block_locations, description: 'get_block_locations'}) | |
yield({host: '10.16.0.48', service: 'NameNode', status: 'ok', tags: ["YARN", "NameNode"], metric: beanInst.files_renamed, description: 'files_renamed'}) | |
yield({host: '10.16.0.48', service: 'NameNode', status: 'ok', tags: ["YARN", "NameNode"], metric: beanInst.get_listing_ops, desc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/jruby | |
# riemann feeds | |
# A simple JMX feed monitoring the Hadoop YARN NameNode | |
require 'riemann-feeds' # bootstrap reieman feeds | |
#$DEBUG = true # force diags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns contracts-examples.blog_make_inline_functions1 | |
(:require [clojure.core.contracts :as ccc])) | |
;; Generate output contract - note the signature accepts anything | |
;; Require my modification to clojure.core.contracts | |
(def aspect-spit-a-number | |
(ccc/contract aspect-spit-a-number-cx | |
"enforce a number as the return value" | |
[& any] |
NewerOlder