{"id":13647634,"url":"https://github.com/bfraser/puppet-grafana","last_synced_at":"2025-04-07T05:14:09.112Z","repository":{"id":15936494,"uuid":"18678588","full_name":"bfraser/puppet-grafana","owner":"bfraser","description":"Puppet module to manage Grafana","archived":false,"fork":false,"pushed_at":"2024-06-20T09:32:43.000Z","size":219,"stargazers_count":39,"open_issues_count":42,"forks_count":203,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-30T22:10:05.420Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bfraser.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-04-11T15:21:06.000Z","updated_at":"2021-07-08T13:41:37.000Z","dependencies_parsed_at":"2024-10-29T22:18:58.103Z","dependency_job_id":null,"html_url":"https://github.com/bfraser/puppet-grafana","commit_stats":{"total_commits":158,"total_committers":26,"mean_commits":6.076923076923077,"dds":0.4177215189873418,"last_synced_commit":"6d426d5ccc52ff23dbbcfc45290dafd224b5d2bc"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfraser%2Fpuppet-grafana","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfraser%2Fpuppet-grafana/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfraser%2Fpuppet-grafana/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfraser%2Fpuppet-grafana/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bfraser","download_url":"https://codeload.github.com/bfraser/puppet-grafana/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595335,"owners_count":20963943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:03:40.909Z","updated_at":"2025-04-07T05:14:09.067Z","avatar_url":"https://github.com/bfraser.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"#grafana\n\n[![Puppet Forge](http://img.shields.io/puppetforge/v/bfraser/grafana.svg)](https://forge.puppetlabs.com/bfraser/grafana)\n[![Build Status](http://img.shields.io/travis/bfraser/puppet-grafana.svg)](http://travis-ci.org/bfraser/puppet-grafana)\n\n####Table of Contents\n\n1. [Overview](#overview)\n2. [Module Description](#module-description)\n3. [Setup](#setup)\n    * [Beginning with Grafana](#beginning-with-grafana)\n4. [Usage](#usage)\n    * [Classes and Defined Types](#classes-and-defined-types)\n5. [Limitations](#limitations)\n6. [Copyright and License](#copyright-and-license)\n\n##Overview\n\nThis module installs Grafana, a dashboard and graph editor for Graphite, InfluxDB and OpenTSDB.\n\n##Module Description\n\nVersion 2.x of this module is designed to work with version 2.x of Grafana. If you would like to continue to use Grafana 1.x, please use version 1.x of this module.\n\n##Setup\n\nThis module will:\n\n* Install Grafana using your preferred method: package (default), Docker container, or tar archive\n* Allow you to override the version of Grafana to be installed, and / or the package source\n* Perform basic configuration of Grafana\n\n###Beginning with Grafana\n\nTo install Grafana with the default parameters:\n\n```puppet\n    class { 'grafana': }\n```\n\nThis assumes that you want to install Grafana using the 'package' method. To establish customized parameters:\n\n```puppet\n    class { 'grafana':\n      install_method  =\u003e 'docker',\n    }\n```\n\n##Usage\n\n###Classes and Defined Types\n\n####Class: `grafana`\n\nThe Grafana module's primary class, `grafana`, guides the basic setup of Grafana on your system.\n\n```puppet\n    class { 'grafana': }\n```\n**Parameters within `grafana`:**\n\n#####`archive_source`\n\nThe download location of a tarball to use with the 'archive' install method. Defaults to the URL of the latest version of Grafana available at the time of module release.\n\n#####`cfg_location`\n\nConfigures the location to which the Grafana configuration is written. The default location is '/etc/grafana/grafana.ini'.\n\n#####`cfg`\n\nManages the Grafana configuration file. Grafana comes with its own default settings in a different configuration file (/opt/grafana/current/conf/defaults.ini), therefore this module does not supply any defaults.\n\nThis parameter only accepts a hash as its value. Keys with hashes as values will generate sections, any other values are just plain values. The example below will result in...\n\n```puppet\n    class { 'grafana':\n      cfg =\u003e {\n        app_mode =\u003e 'production',\n        server   =\u003e {\n          http_port     =\u003e 8080,\n        },\n        database =\u003e {\n          type          =\u003e 'sqlite3',\n          host          =\u003e '127.0.0.1:3306',\n          name          =\u003e 'grafana',\n          user          =\u003e 'root',\n          password      =\u003e '',\n        },\n        users    =\u003e {\n          allow_sign_up =\u003e false,\n        },\n      },\n    }\n```\n\n...the following Grafana configuration:\n\n```ini\n# This file is managed by Puppet, any changes will be overwritten\n\napp_mode = production\n\n[server]\nhttp_port = 8080\n\n[database]\ntype = sqlite3\nhost = 127.0.0.1:3306\nname = grafana\nuser = root\npassword =\n\n[users]\nallow_sign_up = false\n```\n\nSome minor notes:\n\n - If you want empty values, just use an empty string.\n - Keys that contains dots (like auth.google) need to be quoted.\n - The order of the keys in this hash is the same as they will be written to the configuration file. So settings that do not fall under a section will have to come before any sections in the hash.\n\n####`ldap_cfg`\n\n#####TOML note\nThis option **requires** the [toml](https://github.com/toml-lang/toml) gem. Either install the gem using puppet's native gem provider, [puppetserver_gem](https://forge.puppetlabs.com/puppetlabs/puppetserver_gem), [pe_gem](https://forge.puppetlabs.com/puppetlabs/pe_gem), [pe_puppetserver_gem](https://forge.puppetlabs.com/puppetlabs/pe_puppetserver_gem), or manually using one of the following:\n```\n  # apply or puppet-master\n  gem install toml\n  # PE apply\n  /opt/puppet/bin/gem install toml\n  # AIO or PE puppetserver\n  /opt/puppet/bin/puppetserver gem install toml\n```\n\n#####cfg note\nThis option by itself is not sufficient to enable LDAP configuration as it must be enabled in the main configuration file. Enable it in cfg with:\n\n```\n'auth.ldap' =\u003e {\n  enabled     =\u003e 'true',\n  config_file =\u003e '/etc/grafana/ldap.toml',\n},\n```\n\n####Integer note\nPuppet may convert integers into strings while parsing the hash and converting into toml. This can be worked around by appending 0 to an integer.\n\nExample:\n```\nport =\u003e 636+0,\n```\n\nManages the Grafana LDAP configuration file. This hash is directly translated into the corresponding TOML file, allowing for full flexibility in generating the configuration.\n\nSee the [LDAP documentation](http://docs.grafana.org/v2.1/installation/ldap/) for more information.\n\n####Example LDAP config\n\n```\nldap_cfg =\u003e {\n  servers =\u003e [\n    { host            =\u003e 'ldapserver1.domain1.com',\n      port            =\u003e 636+0,\n      use_ssl         =\u003e true,\n      search_filter   =\u003e '(sAMAccountName=%s)',\n      search_base_dns =\u003e [ 'dc=domain1,dc=com' ],\n      bind_dn         =\u003e 'user@domain1.com',\n      bind_password   =\u003e 'passwordhere',\n    },\n  ],\n  'servers.attributes' =\u003e {\n    name      =\u003e 'givenName',\n    surname   =\u003e 'sn',\n    username  =\u003e 'sAMAccountName',\n    member_of =\u003e 'memberOf',\n    email     =\u003e 'email',\n  }\n},\n```\n\n\n#####`container_cfg`\n\nBoolean to control whether a configuration file should be generated when using the 'docker' install method. If 'true', use the 'cfg' and 'cfg_location' parameters to control creation of the file. Defaults to false.\n\n#####`container_params`\n\nA hash of parameters to use when creating the Docker container. For use with the 'docker' install method. Refer to documentation of the 'docker::run' resource in the [garethr-docker](https://github.com/garethr/garethr-docker) module for details of available parameters. Defaults to:\n\n```puppet\ncontainer_params =\u003e {\n  'image' =\u003e 'grafana/grafana:latest',\n  'ports' =\u003e '3000:3000'\n}\n```\n\n#####`data_dir`\n\nThe directory Grafana will use for storing its data. Defaults to '/var/lib/grafana'.\n\n#####`install_dir`\n\nThe installation directory to be used with the 'archive' install method. Defaults to '/usr/share/grafana'.\n\n#####`install_method`\n\nControls which method to use for installing Grafana. Valid options are: 'archive', 'docker', 'repo' and 'package'. The default is 'package'. If you wish to use the 'docker' installation method, you will need to include the 'docker' class in your node's manifest / profile. If you wish to use the 'repo' installation method, you can control whether the official Grafana repositories will be used. See `manage_package_repo` below for details.\n\n#####`manage_package_repo`\n\nBoolean. When using the 'repo' installation method, controls whether the official Grafana repositories are enabled on your host. If true, the official Grafana repositories will be enabled. If false, the module assumes you are managing your own package repository and will not set one up for you. Defaults to true.\n\n#####`package_name`\n\nThe name of the package managed with the 'package' install method. Defaults to 'grafana'.\n\n#####`package_source`\n\nThe download location of a package to be used with the 'package' install method. Defaults to the URL of the latest version of Grafana available at the time of module release.\n\n#####`rpm_iteration`\n\nUsed when installing Grafana from package ('package' or 'repo' install methods) on Red Hat based systems. Defaults to '1'. It should not be necessary to change this in most cases.\n\n#####`service_name`\n\nThe name of the service managed with the 'archive' and 'package' install methods. Defaults to 'grafana-server'.\n\n#####`version`\n\nThe version of Grafana to install and manage. Defaults to the latest version of Grafana available at the time of module release.\n\n##Advanced usage:\n\nThe archive install method will create the user and a \"command line\" service by default.\nThere are no extra parameters to manage user/service for archive. However, both check to see if they are defined before defining. This way you can create your own user and service with your own specifications. (sort of overriding)\nThe service can be a bit tricky, in this example below, the class sensu_install::grafana::service creates a startup script and a service{'grafana-server':}\n\nExample:\n```puppet\n    user { 'grafana':\n      ensure   =\u003e present,\n      uid      =\u003e '1234',\n    }\n    -\u003e\n    class { 'grafana':\n      install_method  =\u003e 'archive',\n    }\n\n    include sensu_install::grafana::service\n\n    # run your service after install/config but before grafana::service\n    Class[::grafana::install]\n    -\u003e\n    Class[sensu_install::grafana::service]\n    -\u003e\n    Class[::grafana::service]\n\n```\n\n####Custom Types and Providers\n\nThe module includes two custom types: `grafana_dashboard` and `grafana_datasource`\n\n#####`grafana_dashboard`\n\nIn order to use the dashboard resource, add the following to your manifest:\n\n```puppet\ngrafana_dashboard { 'example_dashboard':\n  grafana_url       =\u003e 'http://localhost:3000',\n  grafana_user      =\u003e 'admin',\n  grafana_password  =\u003e '5ecretPassw0rd',\n  content           =\u003e template('path/to/exported/file.json'),\n}\n```\n\n`content` must be valid JSON, and is parsed before imported.\n`grafana_user` and `grafana_password` are optional, and required when authentication is enabled in Grafana.\n\n#####`grafana_datasource`\n\nIn order to use the datasource resource, add the following to your manifest:\n\n```puppet\ngrafana_datasource { 'influxdb':\n  grafana_url       =\u003e 'http://localhost:3000',\n  grafana_user      =\u003e 'admin',\n  grafana_password  =\u003e '5ecretPassw0rd',\n  type              =\u003e 'influxdb',\n  url               =\u003e 'http://localhost:8086',\n  user              =\u003e 'admin',\n  password          =\u003e '1nFlux5ecret',\n  database          =\u003e 'graphite',\n  access_mode       =\u003e 'proxy',\n  is_default        =\u003e true,\n  json_data         =\u003e template('path/to/additional/config.json'),\n}\n```\n\nAvailable types are: influxdb, elasticsearch, graphite, kairosdb, opentsdb, prometheus\n\nAccess mode determines how Grafana connects to the datasource, either `direct` from the browser, or `proxy` to send requests via grafana.\n\nAuthentication is optional, as is `database`; additional `json_data` can be provided to allow custom configuration options.\n\n\n##Limitations\n\nThis module has been tested on Ubuntu 14.04, using each of the 'archive', docker' and 'package' installation methods. Other configurations should work with minimal, if any, additional effort.\n\n##Copyright and License\n\nCopyright (C) 2015 Bill Fraser\n\nBill can be contacted at: fraser@pythian.com\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfraser%2Fpuppet-grafana","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbfraser%2Fpuppet-grafana","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfraser%2Fpuppet-grafana/lists"}