Skip to content

Instantly share code, notes, and snippets.

@dmytro
Created December 12, 2012 08:00
Show Gist options
  • Select an option

  • Save dmytro/4265948 to your computer and use it in GitHub Desktop.

Select an option

Save dmytro/4265948 to your computer and use it in GitHub Desktop.

Revisions

  1. dmytro revised this gist Dec 12, 2012. 1 changed file with 0 additions and 6 deletions.
    6 changes: 0 additions & 6 deletions check.yml
    Original file line number Diff line number Diff line change
    @@ -1,6 +0,0 @@
    :vb_active_num:
    :namespace: Wizcorp::Couchbase
    :class: BucketStats
    :function: :avg # :avg, :sum, :none
    :operator: :<
    :rag: [1024,1024,1025]
  2. dmytro revised this gist Dec 12, 2012. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions check.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    :vb_active_num:
    :namespace: Wizcorp::Couchbase
    :class: BucketStats
    :function: :avg # :avg, :sum, :none
    :operator: :<
    :rag: [1024,1024,1025]
  3. dmytro created this gist Dec 12, 2012.
    18 changes: 18 additions & 0 deletions rag.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    def rag
    rag = -1

    res = @connection.send(@key[:name]).send(@key[:function].to_sym)
    thresholds = @key[:rag].reverse

    thresholds.each_index do |idx|
    val = thresholds[idx]
    rag = idx if res.send(@key[:operator].to_sym, val)
    end

    {
    :service_description => "#{@bucket}: #{@key[:name]}",
    :host_name => hostname,
    :plugin_output => res,
    :return_code => rag
    }
    end