Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

RSS

grack (6) Versions 0.0.7

Sends Grafana graphs to Slack

Berkshelf
Policyfile
Knife
cookbook 'grack', '~> 0.0.7'
cookbook 'grack', '~> 0.0.7', :supermarket
knife cookbook site install grack
knife cookbook site download grack
README
Dependencies
Quality 75%

grack Cookbook

This cookbook provides resources for configuring and managing cron jobs to send Grafana graphs to Slack. Grack in the wild

Steps to get it up and running

  • Create a Data Bag named grack
  • Generate a Grafana API Key
  • Store the key in an encrypted Data Bag Item name grafana in the grack Data Bag with the key api_key.
  • Example:

    {
      "id": "grafana",
      "api_key": "abc123oibTdsYWRTMWtMUnFWR2pGRlpjenRUMWRCMndERmZIV3YiLCJuIjoicmVhZG9ubHkiLCJpZCI6MX0="
    }
    
  • Generate a Slack API Token

  • Store store the token in an encrypted Data Bag Item named slack in the grack Data Bag with the key api_token.

  • Example:

    {
      "id": "slack",
      "api_token": "xoxb-abc12371906-o2HBliCwGgG3R4GS6TPcGzYk"
    }
    
  • Set the following attributes

    • node['grack']['graphs']['name_of_graph']['dashboard']['name'] : Grafana dashboard name
    • node['grack']['graphs']['name_of_graph']['dashboard']['id']: Grafana dashboard id
    • node['grack']['graphs']['name_of_graph']['dashboard']['org_id']: Grafana org ID
    • node['grack']['grafana']['name_of_graph']['dashboard']['variables']: Any Grafana variables the graph depends on
    • node['grack']['graphs']['name_of_graph']['hour']: Hour to send the graph. Default is 0
    • node['grack']['graphs']['name_of_graph']['minute']: Minute to send the graph. Default is 30
    • node['grack']['graphs']['name_of_graph']['panel_id']: Grafana graph panel ID
    • node['grack']['graphs']['name_of_graph']['past_hours']: Number of hours, in the past, to graph. Default is 24
    • node['grack']['graphs']['name_of_graph']['slack_channel']: Slack channel to send graph to
    • node['grack']['graphs']['name_of_graph']['sleep_time']: Amount of seconds to sleep before generating the graph. This is helpful if you're sending a number of graphs during the same minute and would like them sent in the same order each time.
    • node['grack']['grafana']['host']: The FQDN of the Grafana server. Default is localhost
    • Example:

      "grack" => {
        "graphs" => {
          "ireland_production_cpu" => {
            "dashboard" => {
              "name" => "mysql",
              "id" => "abcdefghi",
              "org_id" => 1
            },
            "hour" => 12,
            "minute" => 0,
            "panel_id" => 4,
            "slack_channel" => "ireland_production_status"
          }
        },
        "grafana" => {
          "host" => "foo.bar"
        }
      }
      

Setting defaults

You can set graph_defaults to simplify your config:

  • Example:

    "grack" => {
      "graph_defaults" => {
        "dashboard" => {
          "name" => "mysql",
          "id" => "abcdefghi",
          "org_id" => 1,
        },
        "variables" => {
          "datasource" => "telegraf",
          "environment" => "production"
        },
        "hour" => 12,
        "minute" => 0,
        "slack_channel" => "ireland_production_status"
      },
      "graphs" => {
        "ireland_mysql_connections" => {
          "hour" => "0,12,16,20",
          "panel_id" => 5,
          "sleep_time" => 2
        },
        "ireland_mysql_cpu" => {
          "hour" => "0,16,20",
          "panel_id" => 4
        },
        "ireland_mysql_cpu_for_the_past_7_days" => {
          "panel_id" => 4,
          "past_hours" => 168
        }
      },
      "grafana" => {
        "host" => "foo.bar"
    },
    

Removing cron jobs

To remove an existing cron job, set the graph's delete key to true:

  • node['grack']['graphs'][''name_of_graph'']['delete']: true
  • Example:

    "grack" => {
      "graphs" => {
        "ireland_mysql_connections" => {
          "delete" => true
        }
    

License and Authors

Author: Clif Smith (yo@clif.wtf)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Collaborator Number Metric
            

0.0.7 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.0.7 passed this metric

Foodcritic Metric
            

0.0.7 passed this metric

No Binaries Metric
            

0.0.7 passed this metric

Publish Metric
            

0.0.7 passed this metric

Supported Platforms Metric
            

0.0.7 passed this metric

Testing File Metric
            

0.0.7 passed this metric

Version Tag Metric
            

0.0.7 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number