|
| 1 | +# Contents |
| 2 | +--- |
| 3 | +- [Objective](#objective) |
| 4 | +- [Format](#format) |
| 5 | +- [Structure](#structure) |
| 6 | + - [Overview](#overview) |
| 7 | + - [Files](#files) |
| 8 | + - [Usage Examples](#usage-examples) |
| 9 | + - [Configuration](#configuration) |
| 10 | + - [Asset registration](#asset-registration) |
| 11 | + - [Asset definition](#asset-definition) |
| 12 | + - [Resource definitions](#resource-definitions) |
| 13 | + - [Installation from source](#installation-from-source) |
| 14 | + - [Additional notes](#additional-nodes) |
| 15 | + - [Contributing](#contributing) |
| 16 | +- [Plugin collections](#plugin-collections) |
| 17 | +- [Tables of contents](#tables-of-contents) |
| 18 | + |
| 19 | +# Objective |
| 20 | + |
| 21 | +Thank you for your interest in contributing to the Sensu community! Contributing plugins is a great way to get involved, and we want to help you effectively explain how to use your plugin. |
| 22 | + |
| 23 | +This guide is designed to help you and other Sensu plugin authors describe your plugin’s use and facilitate consistency among community plugin READMEs. Because many users throughout the Sensu community rely on plugins, we value plugin documentation that: |
| 24 | + |
| 25 | +* Is readable and free of jargon |
| 26 | +* Focuses on users |
| 27 | +* Clearly describes what the plugin does |
| 28 | +* Includes examples of how to use and deploy the plugin |
| 29 | + |
| 30 | +# Format |
| 31 | + |
| 32 | +Plugin READMEs are Markdown documents. Write your README in [GitHub-flavored Markdown](https://guides.github.com/features/mastering-markdown/) to ensure it is properly rendered on Bonsai. |
| 33 | + |
| 34 | +# Structure |
| 35 | + |
| 36 | +Organize your plugin README according to this overall structure: |
| 37 | + |
| 38 | +* Overview |
| 39 | +* Files |
| 40 | +* Usage examples |
| 41 | +* Configuration |
| 42 | + * Asset registration |
| 43 | + * Asset definition |
| 44 | + * Resource definitions |
| 45 | +* Installation from source |
| 46 | +* Additional notes |
| 47 | +* Contributing |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +## Overview |
| 52 | + |
| 53 | +Begin with an overview of the plugin’s functionality. Describe what the plugin does and what it’s used for. Here are some examples of good overviews from Sensu plugins: |
| 54 | + |
| 55 | +* [Prometheus Collector](https://github.com/sensu/sensu-prometheus-collector#overview) |
| 56 | +* [Linux System Profiler](https://github.com/sensu/system-profile-linux#overview) |
| 57 | +* [Influxdb Handler](https://github.com/sensu/sensu-influxdb-handler#sensu-influxdb-handler) |
| 58 | +* [Fatigue Check Filter](https://github.com/nixwiz/sensu-go-fatigue-check-filter#sensu-go-fatigue-check-filter) |
| 59 | +* [Has Contact Filter](https://github.com/sensu/sensu-go-has-contact-filter#sensu-go-has-contact-filter) |
| 60 | + |
| 61 | + |
| 62 | +## Files |
| 63 | + |
| 64 | +If the project is a collection (grouping of multiple plugins), the README should include a list of executable plugin files. If the project is not a collection, you do not need to include a list of files. |
| 65 | + |
| 66 | + |
| 67 | +## Usage |
| 68 | + |
| 69 | +Plugin documentation should include a usage section, which should show the help output for the plugin, if available. Otherwise, any supported configuration via command-line arguments or environment variables should be thoroughly documented in the usage section. |
| 70 | + |
| 71 | + |
| 72 | +## Configuration |
| 73 | + |
| 74 | +The bulk of a plugin’s README is often in the configuration section, which includes asset registration, asset definition, and resource definition examples. |
| 75 | + |
| 76 | + |
| 77 | +### Asset registration |
| 78 | + |
| 79 | +The **Asset registration** section should contain the following boilerplate language: |
| 80 | + |
| 81 | + |
| 82 | + Assets are the best way to make use of this plugin. If you're not using an asset, please consider doing so! If you're using sensuctl 5.13 with Sensu Backend 5.13 or later, you can use the following command to add the asset: |
| 83 | + |
| 84 | + |
| 85 | + `sensuctl asset add CHANGEME/sensu-CHANGEME:VERSION` |
| 86 | + |
| 87 | + |
| 88 | + If you're using an earlier version of sensuctl, you can find the asset on the [Bonsai Asset Index]([https://bonsai.sensu.io/assets/CHANGEME/sensu-CHANGEME](https://bonsai.sensu.io/assets/CHANGEME/sensu-CHANGEME)). |
| 89 | + |
| 90 | +In general, avoid recommending building the plugin from source. Instead, use sensuctl asset add or create a definition manually via sensuctl create -f /path/to/asset-definition.yml. |
| 91 | + |
| 92 | + |
| 93 | +### Asset definition |
| 94 | + |
| 95 | +Users can install asset definitions using `sensuctl asset add`, but we recommend including an example asset definition in your plugin README. Format your example in yaml. |
| 96 | + |
| 97 | + |
| 98 | +### Resource definitions |
| 99 | + |
| 100 | +In the resource definitions, include example check, filter, mutator, or handler definitions (depending on the resources in your plugin). Format your resource definitions in yaml. |
| 101 | + |
| 102 | + |
| 103 | +## Installation from source |
| 104 | + |
| 105 | +Assets are the preferred plugin installation method. If you cannot use an asset to install your plugin, make sure to provide all the documentation users will need to compile your plugin from source. Some useful examples of plugins providing instructions for installing from source are: |
| 106 | + |
| 107 | +* [InfluxDB Handler](https://github.com/sensu/sensu-influxdb-handler#dependencies) |
| 108 | +* [Slack Handler](https://github.com/sensu/sensu-slack-handler#installing-from-source-and-contributing) |
| 109 | + |
| 110 | +## Additional notes |
| 111 | + |
| 112 | +Use the **Additional notes** section to provide further context for users who will download and deploy your plugin. For example, you might explain whether your plugin requires an on-disk configuration file to properly operate (such as templates for notification plugins) or recommend that users create RBAC roles that allow your plugin to make calls to the Sensu backend API. Describe any additional configuration needed to operate your plugin in this section. |
| 113 | + |
| 114 | +## Contributing |
| 115 | + |
| 116 | +We recommend that all community plugins include a **CONTRIBUTING** document in their repositories. If you create a plugin from the [Sensu Go Plugin](https://github.com/sensu/sensu-go-plugin) repository, a CONTRIBUTING document is included in the repository. If you create a plugin using a different method, you can add your own CONTRIBUTING document. Examples of CONTRIBUTING documents from the community include: |
| 117 | + |
| 118 | +* [Contributing to Sensu Go](https://github.com/sensu/sensu-go/blob/master/CONTRIBUTING.md) |
| 119 | +* [Sensu Plugins Developer Guidelines](http://sensu-plugins.io/docs/developer_guidelines.html) |
| 120 | + |
| 121 | + |
| 122 | +# Plugin collections |
| 123 | + |
| 124 | +Plugin collections can be useful, as they bundle functionality into a single asset. However, we ask that if you write a collection that you document each executable's functionality. A prime example of a plugin collection with well-documented executables can be found here: |
| 125 | + |
| 126 | +* [NCR nagios-foundation collection](https://github.com/ncr-devops-platform/nagiosfoundation) |
| 127 | + |
| 128 | +# Tables of contents |
| 129 | + |
| 130 | +The table of contents is a reader’s first impression of a plugin and should help them find the information they need. Each plugin’s README should include a table of contents that follows the structure described in this style guide. |
| 131 | + |
| 132 | +Here’s an example table of contents: |
| 133 | + |
| 134 | +```markdown |
| 135 | +- [Overview](#overview) |
| 136 | +- [Files](#files) |
| 137 | +- [Usage examples](#usage-examples) |
| 138 | +- [Configuration](#configuration) |
| 139 | + - [Asset registration](#asset-registration) |
| 140 | + - [Asset definition](#asset-definition) |
| 141 | + - [Resource definition](#resource-definition) |
| 142 | +- [Installation from source](#installation-from-source) |
| 143 | +- [Additional notes](#additional-notes) |
| 144 | +- [Contributing](#contributing) |
| 145 | +``` |
0 commit comments