Giter VIP home page Giter VIP logo

grafana's Introduction

Grafana Cookbook

Cookbook Version CI State OpenCollective OpenCollective License

Description

This cookbook provides a complete installation and configuration of Grafana. This includes the ability to manage dashboards, datasources, organizations, plugins and users with Chef via Custom Resources.

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

  • Chef Infra 16+

Platforms

This cookbook officially supports and is tested against the following platforms:

  • Ubuntu >= 16.04
  • Debian >= 8
  • CentOS/Redhat >= 6

PRs are welcome to add support for additional platforms.

Resources

Note on default session cookie name change

The default cookie name changed from Grafana 5.4.5 to 6.0.0. The name change was from grafana_sess to grafana_session. This cookbook now defaults to grafana_session. This can be a breaking change, so please be aware of this.

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

grafana's People

Contributors

atward avatar axelrtgs avatar bmhughes avatar damacus avatar dschlenk avatar eheydrick avatar gcrum-bc avatar gumdelli avatar hrak avatar jonathantron avatar kamaradclimber avatar kitchen-porter avatar kormotodor avatar lanyonm avatar mattp0 avatar mbaitelman avatar mburns avatar nathanwebsterdotme avatar obazoud avatar povilasv1 avatar powerschill avatar ptqa avatar ramereth avatar renovate[bot] avatar scopenco avatar sonnysideup avatar tas50 avatar tmonk42 avatar xorima avatar xorimabot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grafana's Issues

Need to add http_addr and auth.proxy config in grafana.ini

Couldn't find http_addr (under [server]) and auth.proxy attributes. Would appreciate if we can get the below attributes added:

['grafana']['ini']['server']['http_addr']
['grafana']['ini']['auth.proxy']['enabled']
['grafana']['ini']['auth.proxy']['header_name']
['grafana']['ini']['auth.proxy']['auto_sign_up']

kitchen test fails starting grafana-server

I run kitchen test default-ubuntu-1404 and get the following failure:

   [2015-07-08T09:28:32+00:00] ERROR: service[grafana-server] (grafana::default line 70) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
   ---- Begin output of /etc/init.d/grafana-server start ----
   STDOUT: * Starting Grafana Server
      ...fail!
   STDERR: 
   ---- End output of /etc/init.d/grafana-server start ----
   Ran /etc/init.d/grafana-server start returned 1
   [2015-07-08T09:28:32+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

grafana_datasource resource returning nil error

I'm seeing some weird results when trying to use the grafana_datasource resource.

The converge finishes, but throws the following nil error and I don't see a datasource in grafana. :\

Any help with this would be greatly appreciated, thanks!

test-kitchen 1.4.2
chef 12.4.1 running chef zero

recipe:

include_recipe "grafana::default"

grafana_datasource 'graphite2' do
  port node['grafana']['ini']['server']['http_port']
  source(
    type: 'Graphite',
    url: 'http://127.0.0.1:8080',
    access: 'proxy',
    isdefault: true
  )
  action :create
end

grafana_dashboard 'basic-health' do
  port node['grafana']['ini']['server']['http_port']
  source "basic-health"
  overwrite false
end

converge:

         * grafana_datasource[graphite2] action create[2015-08-19T02:08:42+00:00] ERROR: nil

           - Creating data source graphite2

       Running handlers:
       Running handlers complete
       Chef Client finished, 3/51 resources updated in 17.68031387 seconds
       Finished converging <grafana-ubuntu-1404> (0m40.85s).
-----> Kitchen is finished. (0m41.37s)

grafana_user property isAdmin seems to have no effect

grafana_user 'someone' do
  user(
    name: 'someone',
    email: '[email protected]',
    password: 'haspass',
    isAdmin: true
  )
  action :create
end

user is being created, but does not get 'admin' permission.
additionally, i'd be great to have the other permissions (Viewer, Editor, Read Only Editor) reflected, too. using grafana 2.5.0. regards

ERROR: Endpoint not found when sending GET /api/admin/users

I am trying to add a user as such,

grafana_user 'person2' do
port grafana_port
full_name 'John Smith'
email '[email protected]'
passwd 'test123'
admin false
action :create_if_missing
end

while processing, get_global_user_list() in libraries/user_api.rb gets called and there is a GET call to /api/admin/users. Peeking into the api docs, I don't see GET allowed for that endpoint, but there is something around api/users.

the following is the error I recieved. please help.

[2015-09-02T03:02:25+00:00] ERROR: Endpoint not found when sending GET /api/admin/users

       ================================================================================
       Error executing action `create_if_missing` on resource 'grafana_user[person2]'
       ================================================================================

       TypeError
       ---------
       no implicit conversion of String into Integer

       Cookbook Trace:
       ---------------
       /tmp/kitchen/cache/cookbooks/grafana/providers/user.rb:27:in `[]'
       /tmp/kitchen/cache/cookbooks/grafana/providers/user.rb:27:in `block (2 levels) in class_from_file'
       /tmp/kitchen/cache/cookbooks/grafana/providers/user.rb:26:in `each'
       /tmp/kitchen/cache/cookbooks/grafana/providers/user.rb:26:in `block in class_from_file'

       Resource Declaration:
       ---------------------
       # In /tmp/kitchen/cache/cookbooks/demo-grafana/recipes/default.rb

        32: grafana_user 'person2' do
        33:   port grafana_port
        34:   full_name 'John Smith'
        35:   email '[email protected]'
        36:   passwd 'test123'
        37:   admin false
        38:   action :create_if_missing
        39: end

       Compiled Resource:
       ------------------
       # Declared in /tmp/kitchen/cache/cookbooks/demo-grafana/recipes/default.rb:32:in `from_file'

       grafana_user("person2") do
         action [:create_if_missing]
         retries 0
         retry_delay 2
         default_guard_interpreter :default
         declared_type :grafana_user
         cookbook_name "demo-grafana"
         recipe_name "default"
         port 8080
         full_name "John Smith"
         email "[email protected]"
         passwd "test123"
         host "localhost"
         user "admin"
         password "admin"
         login "person2"
         global true
       end


   Running handlers:
   [2015-09-02T03:02:25+00:00] ERROR: Running exception handlers
   Running handlers complete
   [2015-09-02T03:02:25+00:00] ERROR: Exception handlers complete
   Chef Client failed. 1 resources updated in 6.669768779 seconds
   [2015-09-02T03:02:25+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
   [2015-09-02T03:02:25+00:00] ERROR: grafana_user[person2] (demo-grafana::default line 32) had an error: TypeError: no implicit conversion of String into Integer
   [2015-09-02T03:02:25+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

grafana_dashboard file not found

my recipe looks like this:

grafana_dashboard 'MYDASH' do
  source 'grafana'
  port 3015
  overwrite true
end

Funny enough the json file isn't found:

           ================================================================================
           Error executing action `create_if_missing` on resource 'grafana_dashboard[MYDASH]'
           ================================================================================

           RuntimeError
           ------------
           grafana/dashboard was specified, but /tmp/kitchen/cache/cookbooks/mydash/files/default/grafana/dashboard.json does not exist!

       Cookbook Trace:
           ---------------
       /tmp/kitchen/cookbooks/grafana/libraries/dashboard_api.rb:95:in `dashboard_sanity'
           /tmp/kitchen/cookbooks/grafana/providers/dashboard.rb:47:in `block in class_from_file'



~/mydash$ ls -la files/default/grafana/dashboard.json
-rw-rw-r-- 1 user group 15067 Jul 16 10:27 files/default/grafana/dashboard.json

The file ist stored ony my test kitchen machine at a different path:
/tmp/kitchen/cookbooks/mydash/files/default/grafana/dashboard.json instead of /tmp/kitchen/cache/cookbooks/mydash/files/default/grafana/dashboard.json

grafana_dashboard resource with erb templates

so, this is more of a question. Would it be possible to have the grafana_dashboard also source a file from templates/default?
In theory, it'd be awesome if I can pass some variables through to the grafana_dashboard resource, to make templatize my json dashboard similar to the chef template resource works.

So, something like this:

grafana_dashboard 'monitoring-server' do
  port node['grafana']['ini']['server']['http_port']
  source 'monitoring-server'
  template true #looks into templates/default for monitoring-server.json.erb file
  variables({
    :hostname => node.hostname
  })
end

config.js.erb template does properly quote datasource parameters.

The custom pprint() method used in the default template doesn't quote string values so any values in the datasources attribute hash that might contain special characters cause the site to break. I'm not sure if there's any reason not to use the built in JSON generator instead. This seems to handle string quoting properly and works just fine:

    datasources: <%= ::JSON.pretty_generate(@datasources) %>,

Possible regression with datasources in 1.3.0 release

After upgrading to 1.3.0 none of my dashboards are loading. Taking elasticsearch out of the datasource hash, and moving elasticsearch outside of the datasource hash like in 1.2.0 seems to fix it for me. is anyone else having issues with 1.3.0?

Providers consistency

Hello,
I'm about to start working on grafana_user provider.
While looking on what is done currently, I figured out some inconsistencies between providers.

Resources definition sometime use a nemd Hash to pass all variables like grafana_datasource:

grafana_datasource 'graphite-test' do
  source(
    type: 'graphite',
    url: 'http://10.0.0.15:8080',
    access: 'direct'
  )
end

Some other pass variables directly like grafana_user:

grafana_user 'person2' do
  full_name 'John Smith'
  email '[email protected]'
  passwd 'test123'
end

I would like to make all providers work the first way, but this would result in functional change.

Comments are very welcome :)

Thanks

Add link to supermarket

This looks like a great cookbook.

Most cookbooks I've found on the super market have a 'View Source' button on the right hand side that links to github.

Here is an example
https://supermarket.chef.io/cookbooks/elasticsearch

Strangely this cookbook doesn't have that link.
Is that something to do with the metadata.rb? Is there a way a link could be added to the supermarket?

Creating an org with a bad password results in a cryptic error message

If you pass bad credentials in the grafana_organization LWRP you get the following cryptic error message:

================================================================================
Error executing action `create_if_missing` on resource 'grafana_organization[something]'
================================================================================

NameError
---------
No resource, method, or local variable named `messages' for ` ""'

Cookbook Trace:
---------------
/var/chef/cache/cookbooks/grafana/libraries/api_helper.rb:91:in `handle_response_unauthorized'
/var/chef/cache/cookbooks/grafana/libraries/api_helper.rb:64:in `handle_response'
/var/chef/cache/cookbooks/grafana/libraries/api_helper.rb:23:in `login'
/var/chef/cache/cookbooks/grafana/libraries/organization_api.rb:57:in `get_orgs_list'
/var/chef/cache/cookbooks/grafana/providers/organization.rb:16:in `block in class_from_file'

Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/cozy_grafana/recipes/default.rb

Delayed attribute interpolation

Hi,

I try to update Grafana to 1.9.0 but its seems that we have evaluation attributes problems.
If I only change 'version' and 'checksum' attribut, url is not modified on Chef server (with 1.8.1).

Maybe we can try Delayed Interpolation.

Thanks.

Support for multiple Graphites?

Hi,

this is an enhancement question... Have you had any thoughts regarding for supporting multiple Graphite hosts...?

Sincerely,

Iiro Niinikoski

checksum of grafana 2.1.2 appears to be wrong

remote_file("/var/chef/cache/grafana-2.1.2.deb") do
  provider Chef::Provider::RemoteFile
  action [:create]
  retries 0
  retry_delay 2
  default_guard_interpreter :default
  path "/var/chef/cache/grafana-2.1.2.deb"
  backup 5
  atomic_update true
  source ["https://grafanarel.s3.amazonaws.com/builds/grafana_2.1.2_amd64.deb"]
  use_etag true
  use_last_modified true
  declared_type :remote_file
  cookbook_name "grafana"
  recipe_name "_install_file"
  checksum "34d6ae0e81db559bbfb71f1cee811469407eb197b9e8717e73930dceb47d4278"
  not_if "dpkg -l | grep '^ii' | grep grafana | grep 2.1.2"
end

Downloading the file and checking the checksum gives me 57f52cc8e510f395f7f15caac841dc31e67527072fcbf5cc2d8351404989b298

LWRPs fail when grafana.ini template changes connection details

When the grafana.ini changes the http_port, the grafana service isn't restarted until the end of the chef run because the notify is :delayed. This means that any Grafana LWRPs that use the HTTP API will fail because the running services doesn't yet reflect it's new configuration.

_apache recipe is missed

Hi,

I'm trying to set up grafana on apache and
so I've set
node.default['grafana']['webserver'] = 'apache'

but when I execute the recipe I get follow error
could not find recipe _apache for cookbook grafana

do I do something wrong?

undefined method `each' for nil:NilClass

* grafana_datasource[influxdb] action create_if_missing

    ================================================================================
    Error executing action `create_if_missing` on resource 'grafana_datasource[influxdb]'
    ================================================================================

    NoMethodError
    -------------
    undefined method `each' for nil:NilClass

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/grafana/providers/datasource.rb:31:in `create'
    /var/chef/cache/cookbooks/grafana/providers/datasource.rb:16:in `block in class_from_file'

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/azsb_graphing/recipes/default.rb

     53: grafana_datasource 'influxdb' do
     54:   source(
     55:     type: 'influxdb_09',
     56:     url: 'http://127.0.0.1:8086',
     57:     access: 'proxy',
     58:     database: 'grafana',
     59:     isdefault: true
     60:   )
     61:   action :create_if_missing
     62: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/azsb_graphing/recipes/default.rb:53:in `from_file'

    grafana_datasource("influxdb") do
      action [:create_if_missing]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :grafana_datasource
      cookbook_name "azsb_graphing"
      recipe_name "default"
      source {:type=>"influxdb_09", :url=>"http://127.0.0.1:8086", :access=>"proxy", :database=>"grafana", :isdefault=>true, :name=>"influxdb"}
      source_name "influxdb"
      host "localhost"
      port 3000
      user "admin"
      password "admin"
    end

The above worked in our testing on Vagrant but not when we pushed it out to Azure.

$ sudo chef-client --version
Chef: 12.4.1

Running on CentOS 6.6 with the latest version of the cookbook from the supermarket.

init script fails during creation of db tables

when using a DB backend, the init script will fail on the first startup of grafana, while grafana is creating tables in the database.
A quick workaround for me was to add "sleep 10" on startup.

Update docs about using exported dashboards

the graphite_dashboard resource throws a nil error when you try to use a previously exported dashboard from grafana.

Updating the id key from "id": 2, to "id": null, fixed the error for me. So, maybe this should be mentioned in docs.

       [2015-08-19T07:40:31+00:00] ERROR: The dashboard does not exist.
       [2015-08-19T07:40:31+00:00] ERROR: nil

           - Creating dashboard basic-health
       Recipe: oc-graphite::graphite_web

           - execute graphite-manage scriptchangepassword admin changeme
       Recipe: abejacookbook_monitoring::graphite

           - reload service service[uwsgi]
       Recipe: nginx::default

           - reload service service[nginx]
       Recipe: grafana::default

           - restart service service[grafana-server]

       Running handlers:
       Running handlers complete
       Chef Client finished, 53/68 resources updated in 443.065616046 seconds
       Finished converging <grafana-ubuntu-1404> (10m52.71s).
-----> Kitchen is finished. (10m53.12s)

basic-health.json

{
  "id": 2,
  "title": "Basic Health",
  "tags": [],
  "style": "dark",
  "timezone": "browser",
  "editable": true,
  "hideControls": false,
  "sharedCrosshair": false,
  "rows": [
    {
      "collapse": false,
      "editable": true,
      "height": "250px",
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "datasource": null,
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "leftLogBase": 1,
            "leftMax": null,
            "leftMin": null,
            "rightLogBase": 1,
            "rightMax": null,
            "rightMin": null,
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 1,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "target": "$HOSTS.cpu.iowait"
            },
            {
              "target": "$HOSTS.cpu.system"
            },
            {
              "target": "$HOSTS.cpu.user"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "CPU Usage",
          "tooltip": {
            "shared": true,
            "value_type": "cumulative"
          },
          "type": "graph",
          "x-axis": true,
          "y-axis": true,
          "y_formats": [
            "short",
            "short"
          ]
        }
      ],
      "showTitle": false,
      "title": "CPU"
    },
    {
      "collapse": false,
      "editable": true,
      "height": "250px",
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "datasource": null,
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "leftLogBase": 1,
            "leftMax": null,
            "leftMin": null,
            "rightLogBase": 1,
            "rightMax": null,
            "rightMin": null,
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 2,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "target": "$HOSTS.memory_percent.usedWOBuffersCaches"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Memory Usage",
          "tooltip": {
            "shared": true,
            "value_type": "cumulative"
          },
          "type": "graph",
          "x-axis": true,
          "y-axis": true,
          "y_formats": [
            "short",
            "short"
          ]
        }
      ],
      "showTitle": false,
      "title": "Memory"
    },
    {
      "collapse": false,
      "editable": true,
      "height": "250px",
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "datasource": null,
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "leftLogBase": 1,
            "leftMax": null,
            "leftMin": null,
            "rightLogBase": 1,
            "rightMax": null,
            "rightMin": null,
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 5,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "target": "$HOSTS.eth0.*"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "eth0 Traffic(kb/s)",
          "tooltip": {
            "shared": true,
            "value_type": "cumulative"
          },
          "type": "graph",
          "x-axis": true,
          "y-axis": true,
          "y_formats": [
            "short",
            "short"
          ]
        }
      ],
      "showTitle": false,
      "title": "Network"
    },
    {
      "collapse": false,
      "editable": true,
      "height": "250px",
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "datasource": null,
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "leftLogBase": 1,
            "leftMax": null,
            "leftMin": null,
            "rightLogBase": 1,
            "rightMax": null,
            "rightMin": null,
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 3,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 6,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "target": "$HOSTS.disk_usage.root.used_percentage"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "/root Used Percentage",
          "tooltip": {
            "shared": true,
            "value_type": "cumulative"
          },
          "type": "graph",
          "x-axis": true,
          "y-axis": true,
          "y_formats": [
            "short",
            "short"
          ]
        },
        {
          "aliasColors": {},
          "bars": false,
          "datasource": null,
          "editable": true,
          "error": false,
          "fill": 1,
          "grid": {
            "leftLogBase": 1,
            "leftMax": null,
            "leftMin": null,
            "rightLogBase": 1,
            "rightMax": null,
            "rightMin": null,
            "threshold1": null,
            "threshold1Color": "rgba(216, 200, 27, 0.27)",
            "threshold2": null,
            "threshold2Color": "rgba(234, 112, 112, 0.22)"
          },
          "id": 4,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 2,
          "links": [],
          "nullPointMode": "connected",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "span": 6,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "target": "$HOSTS.tcp.*"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "TCP Connections",
          "tooltip": {
            "shared": true,
            "value_type": "cumulative"
          },
          "type": "graph",
          "x-axis": true,
          "y-axis": true,
          "y_formats": [
            "short",
            "short"
          ]
        }
      ],
      "showTitle": false,
      "title": "Disk and TCP"
    }
  ],
  "nav": [
    {
      "collapse": false,
      "enable": true,
      "notice": false,
      "now": true,
      "refresh_intervals": [
        "5s",
        "10s",
        "30s",
        "1m",
        "5m",
        "15m",
        "30m",
        "1h",
        "2h",
        "1d"
      ],
      "status": "Stable",
      "time_options": [
        "5m",
        "15m",
        "1h",
        "6h",
        "12h",
        "24h",
        "2d",
        "7d",
        "30d"
      ],
      "type": "timepicker"
    }
  ],
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "templating": {
    "list": [
      {
        "allFormat": "glob",
        "current": {
          "text": "90e4e24fbcee",
          "value": "90e4e24fbcee",
          "tags": []
        },
        "datasource": null,
        "includeAll": true,
        "multi": false,
        "multiFormat": "glob",
        "name": "HOSTS",
        "options": [
          {
            "text": "All",
            "value": "{90e4e24fbcee,carbon,monitoring-server}",
            "selected": false
          },
          {
            "text": "90e4e24fbcee",
            "value": "90e4e24fbcee",
            "selected": true
          },
          {
            "text": "carbon",
            "value": "carbon",
            "selected": false
          },
          {
            "text": "monitoring-server",
            "value": "monitoring-server",
            "selected": false
          }
        ],
        "query": "*",
        "refresh_on_load": false,
        "type": "query",
        "refresh": true
      }
    ]
  },
  "annotations": {
    "list": []
  },
  "schemaVersion": 6,
  "version": 9,
  "links": []
}

datasources attributes not overriden

Hello!

First of all, thanks for your great cookbook. It almost covers all that we need for our monitoring platform. Unfortunately there's just one point that we can't resolve: datasources attributes aren't overriden by our custom ones.

Let me explain it in detail: we don't plan to use graphite+elasticsearch. Instead, we'll use influxdb. No problem, let's override the default attributes in the role:

    "grafana": {
      "datasources": {
        "'eu-metrics'": {
          "'type'": "'influxdb'",
          "'url'": "'http://our_influxdb_server:8086/db/data_db'",
          "'username'": "'user'",
          "'password'": "'pass'"
        },
        "'grafana'": {
          "'type'": "'influxdb'",
          "'url'": "'http://our_influxdb_server:8086/db/grafana'",
          "'username'": "'test'",
          "'password'": "'test'",
          "'grafanaDB'": true
        }
      }
    }

We should expect the graphite+elasticsearch data overriden by the above details. However, what we get is both of them in the config.js file: influxdb is somehow added to the default attributes listed in the default.rb file:

// datasources, you can add multiple
    datasources: {
      graphite: {
        type: 'graphite',
        url: window.location.protocol+"//"+window.location.hostname+":"+window.location.port+"/_graphite",
        default: true
      },
      elasticsearch: {
        type: 'elasticsearch',
        url: window.location.protocol+"//"+window.location.hostname+":"+window.location.port,
        index: 'grafana-index',
        grafanaDB: true
      },
      'eu-metrics': {
        'type': 'influxdb',
        'url': 'http://our_influxdb_server:8086/db/data_db',
        'username': 'user',
        'password': 'pass'
      },
      'grafana': {
        'type': 'influxdb',
        'url': 'http://our_influxdb_server:8086/db/grafana',
        'username': 'test',
        'password': 'test',
        'grafanaDB': true
      }
    },

In order to discard any precedence order, we've also tried to define our custom attributes in the role "override_attributes" field, without result.

Can you please clarify how to use the datasource attribute in order to get this goal?

Thanks in advance!
Andrés

nginx does not get restarted on property changes

Recipe: nginx::default
 * service[nginx] action start (up to date)
Recipe: grafana::_nginx
 * template[/etc/nginx/sites-available/grafana] action create
   - update content in file /etc/nginx/sites-available/grafana from 7e132b to 8ffd82

   +++ /etc/nginx/sites-available/.grafana20151118-27288-6xbjdb 2015-11-18 09:53:26.211324049 +0000
   @@ -8,7 +8,7 @@


    server {
   -  listen                10.0.2.15:80;
   +  listen                0.0.0.0:80;

server_name           grafana-ubuntu-1204 10.0.2.15;

 * execute[nxensite grafana] action run (skipped due to not_if)

workaround is to have a resource like

service 'nginx' do
  action [:restart]
end

Grafana 2.1.1 missing [security] section

I'm installing Grafana version 2.1.1. When I open the config grafana.ini file, there is no [security] section.
We could add them by defining attributes:

default['grafana']['ini']['security']['admin_user'] = 'admin'
default['grafana']['ini']['security']['admin_password'] = 'admin'

Can't upgrade package when using the file install method

On Ubuntu 14.04, trying to upgrade from 2.0.2 to 2.5.0 by setting node['grafana']['version'] and node['grafana']['file']['checksum']['deb'] does not upgrade the package. The problem seems to be that version isn't being passed the dpkg_package resource and it thinks no package actions need to be taken. If I pass version to dpkg_package the upgrade happens.

nginx setup fails on ubuntu 14.04

There seems to be a problem with ubuntu 1404 and your cookbook.

I have tried some workarround for the pid problem but I still get the adress already in use error.

This is my wrapper cookbook:

# attributes
if platform == 'ubuntu' && platform_version == '14.04'
 override[:nginx][:pid] = '/run/nginx.pid'
end
# recipe
include_recipe "java"
include_recipe "elasticsearch"
include_recipe "grafana"
ubuntu@ip-10-90-yy-xx:/var/log/nginx$ tail error.log 
2015/01/12 16:59:36 [emerg] 31813#0: bind() to 10.90.13.107:80 failed (98: Address already in use)
2015/01/12 16:59:36 [emerg] 31813#0: bind() to 10.90.13.107:80 failed (98: Address already in use)
2015/01/12 16:59:36 [emerg] 31813#0: bind() to 10.90.13.107:80 failed (98: Address already in use)
2015/01/12 16:59:36 [emerg] 31813#0: bind() to 10.90.13.107:80 failed (98: Address already in use)
2015/01/12 16:59:36 [emerg] 31813#0: bind() to 10.90.13.107:80 failed (98: Address already in use)
2015/01/12 16:59:36 [emerg] 31813#0: still could not bind()
ubuntu@ip-10-90-13-107:/var/log/nginx$ tail i-59da03bf.access.log 
ubuntu@ip-10-90-13-107:/var/log/nginx$ curl localhost
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

dashboards aren't created when id is set

My cookbook looks like this:

grafana_dashboard 'graphite' do
  source 'grafana'
  port node['grafana']['ini']['server']['http_port']
  overwrite true
  action :create
end

This is the file stored as files/default/grafana.json:
https://gist.github.com/runningman84/4af3fcd7f9895ec36546#file-gistfile1-json

Unfortunately the dashboard doesn't appear in the web interface. Funny enough chef isn't reporting any error:

       Recipe: asy-graphite::grafana


       * grafana_dashboard[graphite] action create
           - Creating dashboard graphite

grafana_datasource doesn't update default graphite datasource

If I put this code into my recipe

grafana_datasource 'graphite2' do
  port 3015
  source(
    type: 'graphite',
    url: 'http://127.0.0.1:8080',
    access: 'proxy',
    isdefault: true
  )
  action :create
end

I get a new datasource called graphite2.

If I change the name to graphite like this

grafana_datasource 'graphite' do
  port 3015
  source(
    type: 'graphite',
    url: 'http://127.0.0.1:8080',
    access: 'proxy',
    isdefault: true
  )
  action :create
end

each chef run will create or update a datasource with other settings like direct access, notdefault, ...

error using grafana_datasource: undefined method `each' for nil:NilClass

* grafana_datasource[graphite.in] action create[2015-11-13T17:40:26+00:00] ERROR: Connection refused.
[2015-11-13T17:40:26+00:00] ERROR: Connection refused.


================================================================================
Error executing action `create` on resource 'grafana_datasource[graphite.in]'
================================================================================

NoMethodError
-------------
undefined method `each' for nil:NilClass

Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/grafana/providers/datasource.rb:27:in `block in class_from_file'

Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/xpl_grafana/recipes/_grafana.rb

19: grafana_datasource 'graphite.in' do
20:   datasource(
21:     type: 'graphite',
22:     url: 'http://graphite1.in.whatever.com',
23:     access: 'proxy'
24:   )
25: end
26:


------------------
# Declared in /tmp/kitchen/cache/cookbooks/xpl_grafana/recipes/_grafana.rb:19:in `from_file'

grafana_datasource("graphite.in") do
 action [:create]
 retries 0
 retry_delay 2
 default_guard_interpreter :default
 declared_type :grafana_datasource

 recipe_name "_grafana"
 datasource {:type=>"graphite", :url=>"http://graphite1.in.whatever.com", :access=>"proxy", :name=>"graphite.in"}
 host "localhost"
 admin_user "admin"
 admin_password "password"
end

Datasources always includes unwanted sources

When I provide a list of the two datasources I would like, the resulting file /srv/apps/grafana/config.js contains two extras: elasticsearch and graphite. How can I get rid of the extra entries?

Here are the recipe attributes I'm using:

"grafana": {
  "webserver_listen": "*",
  "datasources": {
    "metrics": {
      "type": "'influxdb'",
      "url": "window.location.protocol+'//'+window.location.hostname+':8086/db/metrics'",
      "username": "'foo'",
      "password": "'bar'",
      "default": true
    },
    "grafana": {
      "type": "'influxdb'",
      "url": "window.location.protocol+'//'+window.location.hostname+':8086/db/grafana'",
      "username": "'foo'",
      "password": "'bar'",
      "grafanaDB": true
    }
  }
}

I thought the defaults were being merged, so I modified the code to remove defaults, and the keys still end up in the generated config.

--- a/attributes/default.rb
+++ b/attributes/default.rb
@@ -52,16 +52,4 @@ default['grafana']['unsaved_changes_warning'] = 'true'
 default['grafana']['playlist_timespan'] = '1m'
 default['grafana']['window_title_prefix'] = 'Grafana - '
 default['grafana']['search_max_results'] = 20
-default['grafana']['datasources'] = {
-  'graphite' => {
-    'type' => "'graphite'",
-    'url'  => 'window.location.protocol+"//"+window.location.hostname+":"+window.location.port+"/_graphite"',
-    'default' => true
-  },
-  'elasticsearch' => {
-    'type' => "'elasticsearch'",
-    'url'  => 'window.location.protocol+"//"+window.location.hostname+":"+window.location.port',
-    'index' => lambda { "'#{node['grafana']['grafana_index']}'" },
-    'grafanaDB' => true
-  }
-}
+default['grafana']['datasources'] = { }

Error create grafana_datasource?

Any else seeing this error below? It seems to work on the second run.

rror executing action create on resource 'grafana_datasource[graphite]'
================================================================================

       NoMethodError
       -------------
       undefined method `each' for nil:NilClass

       Cookbook Trace:
       ---------------
       /tmp/kitchen/cache/cookbooks/grafana/providers/datasource.rb:31:in `create'
       /tmp/kitchen/cache/cookbooks/grafana/providers/datasource.rb:12:in `block in class_from_file'

       Resource Declaration:
       ---------------------
       # In /tmp/kitchen/cache/cookbooks/cas_graphite/recipes/grafana.rb

         3: grafana_datasource 'graphite' do
         4:   source(
         5:     type: 'graphite',
         6:     url: "http://#{node['cas_graphite']['graphite']['host']}:#{node['graphite']['port']}",
         7:     access: 'direct'
         8:   )
         9: end

grafana_dashboard doesn't allow uppercase titles

is there any reason for forbidding uppercase names here?

         * grafana_dashboard[MYDASH] action create_if_missing

           ================================================================================
           Error executing action `create_if_missing` on resource 'grafana_dashboard[MYDASH]'
           ================================================================================

           RuntimeError
           ------------
           MYDASH did not match the name (MYDASH) in the json

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.