Skip to content

Commit 0582257

Browse files
author
Todd Campbell
authored
Merge pull request #47 from hillaryfraley/patch-1
Complete and standardize README
2 parents 2c0d028 + bce6e7b commit 0582257

File tree

1 file changed

+150
-11
lines changed

1 file changed

+150
-11
lines changed

README.md

Lines changed: 150 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
1-
## Sensu-Plugins-filesystem-checks
2-
1+
[![Sensu Bonsai Asset](https://img.shields.io/badge/Bonsai-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-filesystem-checks)
32
[ ![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-filesystem-checks.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-filesystem-checks)
43
[![Gem Version](https://badge.fury.io/rb/sensu-plugins-filesystem-checks.svg)](http://badge.fury.io/rb/sensu-plugins-filesystem-checks)
54
[![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-filesystem-checks/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-filesystem-checks)
65
[![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-filesystem-checks/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-filesystem-checks)
76
[![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-filesystem-checks.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-filesystem-checks)
8-
[![Sensu Bonsai Asset](https://img.shields.io/badge/Bonsai-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-filesystem-checks)
97

10-
## Sensu Asset
11-
The Sensu assets packaged from this repository are built against the Sensu ruby runtime environment. When using these assets as part of a Sensu Go resource (check, mutator or handler), make sure you include the corresponding Sensu ruby runtime asset in the list of assets needed by the resource. The current ruby-runtime assets can be found [here](https://bonsai.sensu.io/assets/sensu/sensu-ruby-runtime) in the [Bonsai Asset Index](bonsai.sensu.io).
8+
## Sensu Plugins Filesystem Checks Plugin
9+
10+
- [Overview](#overview)
11+
- [Files](#files)
12+
- [Usage examples](#usage-examples)
13+
- [Configuration](#configuration)
14+
- [Sensu Go](#sensu-go)
15+
- [Asset registration](#asset-registration)
16+
- [Asset definition](#asset-definition)
17+
- [Check definition](#check-definition)
18+
- [Sensu Core](#sensu-core)
19+
- [Check definition](#check-definition)
20+
- [Installation from source](#installation-from-source)
21+
- [Additional notes](#additional-notes)
22+
- [Contributing](#contributing)
23+
24+
### Overview
1225

13-
## Functionality
26+
This plugin provides native instrumentation for monitoring and metrics collection, including health, usage, and various metrics of filesystem attributes.
1427

15-
## Files
28+
### Files
1629
* bin/check-checksums.rb
1730
* bin/check-dir-count.rb
1831
* bin/check-dir-size.rb
@@ -24,11 +37,137 @@
2437
* bin/metrics-dirsize.rb
2538
* bin/metrics-filesize.rb
2639
* bin/metrics-nfsstat.rb
40+
41+
**check-checksums**
42+
Checks a file against its checksum.
43+
44+
**check-dir-count**
45+
Checks the number of files in a directory.
46+
47+
**check-dir-size**
48+
Checks the size of a directory using `du`. Includes optional command line parameter to ignore a missing directory. WARNING: When using this with a directory with many files, there will be some lag as `du` recursively goes through the directory.
49+
50+
**check-file-exists**
51+
Checks whether alerting is functioning as designed. Can be set to check for the existence of any file for which you have read-level permissions. Looks in `/tmp` folder for the files CRITICAL, WARNING, or UNKNOWN and if any are found, sends the corresponding status to Sensu (otherwise, sends an "ok"). This allows you to send an alert for something like `touch /tmp/CRITICAL` and then set it ok again with `rm /tmp/CRITICAL`. Supports globbing for basic wildcard matching. Wildcard charaters must be quoted or escaped to prevent shell expansion.
52+
53+
**check-file-size**
54+
Checks the file size of a given file. Includes optional command line parameters to ignore missing files.
55+
56+
**check-fs-writable**
57+
Checks that a filesystem is writable. Useful for checking for stale NFS mounts.
58+
59+
**check-mtime**
60+
Checks a given file's modified time.
61+
62+
**check-tail**
63+
Checks the tail of a file for a given patten and sends critical (or optional warning) message if found. Alternatively, failure can be triggered when the pattern is not found by passing the 'absent' flag.
64+
65+
**metrics-dirsize**
66+
Provides a simple wrapper around `du` for getting directory size stats in real size, apparent size, and inodes (when supported).
67+
68+
**metrics-filesize**
69+
Provies a simple wrapper around `stat` for getting file size stats in both in both, bytes and blocks.
70+
71+
**metrics-nfsstat**
72+
Provides a simple wrapper around `nfsstat` for getting nfs server/client stats.
73+
74+
## Usage examples
75+
76+
### Help
77+
78+
**check-dir-count.rb**
79+
```
80+
Usage: check-dir-count.rb (options)
81+
-c, --critical NUM Critical if count of files is greater than provided number (required)
82+
-d, --dir DIR Directory to count files in (required)
83+
-w, --warning NUM Warn if count of files is greater than provided number (required)
84+
```
85+
86+
**metrics-dirsize.rb**
87+
```
88+
Usage: metrics-dirsize.rb (options)
89+
-a, --apparent Report apparent size (bytes) (required)
90+
-d, --dir PATH Absolute path to directory to measure (required)
91+
-i, --inodes Report inodes used instead of bytes. Not all Linux distributions support this. (required)
92+
-r, --real Report real size (bytes) (required)
93+
-s, --scheme SCHEME Metric naming scheme, text to prepend to metric (required)
94+
```
95+
96+
## Configuration
97+
### Sensu Go
98+
#### Asset registration
99+
100+
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 or later, you can use the following command to add the asset:
101+
102+
`sensuctl asset add sensu-plugins/sensu-plugins-logs`
103+
104+
If you're using an earlier version of sensuctl, you can download the asset definition from [this project's Bonsai asset index page](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-logs).
105+
106+
#### Asset definition
107+
108+
```yaml
109+
---
110+
type: Asset
111+
api_version: core/v2
112+
metadata:
113+
name: sensu-plugins-filesystem-checks
114+
spec:
115+
url: https://assets.bonsai.sensu.io/ccce3fd9dd55770aeadd5034b674b763945454ac/sensu-plugins-filesystem-checks_2.0.0_centos_linux_amd64.tar.gz
116+
sha512: ecac91a77c2e27bb650dcb61a64d62fa92e98ffa1e754008b6b9bd94bf8e6c8862bdaf40ccf65447dd8be5e037acacb3fc2d20e39519167da05b55b0b9c3e880
117+
```
118+
119+
#### Check definition
120+
121+
```yaml
122+
---
123+
type: CheckConfig
124+
spec:
125+
command: "check-dir-count.rb"
126+
handlers: []
127+
high_flap_threshold: 0
128+
interval: 10
129+
low_flap_threshold: 0
130+
publish: true
131+
runtime_assets:
132+
- sensu-plugins/sensu-plugins-filesystem-checks
133+
- sensu/sensu-ruby-runtime
134+
subscriptions:
135+
- linux
136+
```
137+
138+
### Sensu Core
139+
140+
#### Check definition
141+
```json
142+
{
143+
"checks": {
144+
"check-dir-count": {
145+
"command": "check-dir-count.rb",
146+
"subscribers": ["linux"],
147+
"interval": 10,
148+
"refresh": 10,
149+
"handlers": ["influxdb"]
150+
}
151+
}
152+
}
153+
```
154+
155+
## Installation from source
156+
157+
### Sensu Go
158+
159+
See the instructions above for [asset registration](#asset-registration).
160+
161+
### Sensu Core
162+
163+
Install and setup plugins on [Sensu Core](https://docs.sensu.io/sensu-core/latest/installation/installing-plugins/).
164+
165+
## Additional notes
27166

28-
## Usage
167+
### Sensu Go Ruby Runtime Assets
29168

30-
## Installation
169+
The Sensu assets packaged from this repository are built against the Sensu Ruby runtime environment. When using these assets as part of a Sensu Go resource (check, mutator, or handler), make sure to include the corresponding [Sensu Ruby Runtime Asset](https://bonsai.sensu.io/assets/sensu/sensu-ruby-runtime) in the list of assets needed by the resource.
31170

32-
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
171+
## Contributing
33172

34-
## Notes
173+
See [CONTRIBUTING.md](https://github.com/sensu-plugins/sensu-plugins-filesystem-checks/blob/master/CONTRIBUTING.md) for information about contributing to this plugin.

0 commit comments

Comments
 (0)