Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samn/mongo-size-check
monitoring for collection size rates of growth
https://github.com/samn/mongo-size-check
Last synced: about 21 hours ago
JSON representation
monitoring for collection size rates of growth
- Host: GitHub
- URL: https://github.com/samn/mongo-size-check
- Owner: samn
- Created: 2013-04-29T19:54:03.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-06-04T19:19:40.000Z (over 11 years ago)
- Last Synced: 2024-04-14T23:39:31.139Z (7 months ago)
- Language: Python
- Size: 123 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## mongo-size-check
A rate of growth check for mongo collection sizes
meant to be used with [Riemann](https://github.com/aphyr/riemann)
and [riemann-sumd](https://github.com/bmhatfield/riemann-sumd).### Usage
Usage: mongo-size-check.py [options]
Options:
-h, --help show this help message and exit
--database=DATABASE Monitor the collections of this database
--host=HOST The host of the database to monitor.
(default=localhost)
--max-collection-size=MAX_COLLECTION_SIZE
The max allowed size of a collection in GB.
(default=256)
--growth-interval=GROWTH_INTERVAL
The number of days to look at the growth rate for.
Alert if growth will exceed max-collection-size within
this interval. (default=30)Call `mongo-size-check.py` with the name of the database to monitor.
The current size of each collection will be emitted as an event to riemann-sumd, which will sent to Riemann.
Your Riemann config should calculate the rate of growth on collection sizes so you can shard before it's
[too late](http://docs.mongodb.org/manual/reference/limits/#Sharding%20Existing%20Collection%20Data%20Size).### riemann-sumd config
service: 'mongo-collection-size'
arg: 'mongo-collection-size.py --database DATABASE'
ttl: 86400
tags: ['notify', 'mongo-collection', 'rate-of-change']
type: 'json'### Riemann config
````
(defn when-growth-exceeds
"Call children when the the metric of events
will exceeed a threshold within some interval.
Calculates the rate-of-growth of metric between events.
Uses attributes on the event to determine the threshold
and interval. The names of those attribute keys are passed
as args to this function."
[growth_interval_key threshold_key & children]
;; the metric of the event emitted by this function is the rate-of-change
(ddt-events
(smap
;; call children if the growth is exceeding the threshold within the interval
(fn [event]
(let [growth_interval (growth_interval_key event)
threshold (threshold_key event)
rate-of-change (:metric event)]
(when (> threshold (* growth_interval rate-of-change))
event)))
(apply sdo children))))(streams
(by [:host :service]
(where (and (not (expired? event)) (tagged "rate-of-change"))
(when-growth-exceeds :growth_interval :max_size
(with {:state "error"}
(rollup 1 rollup-ttl (email notify-email)))))))
````