Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython

graphite_anomaly_detector is unavailable in PyPM, because there aren't any builds for it in the package repositories. Click the linked icons to find out why.

 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
Linux (64-bit)
 
Links
Author
Dependencies

Command line application that determines spikes in Graphite metrics for a given host and generates a CSV report

Usage

<pre> usage: generate_report.py [-h] -s SERVERS [SERVERS ...] -o OUTPUT [-l LIMIT]

System Message: ERROR/3 (<string>, line 10)

Unexpected indentation.
[-p PATTERN] [-t TIMEOUT]

Generates CSV report with spikes found on Graphite hosts

optional arguments:
-h, --help show this help message and exit

System Message: WARNING/2 (<string>, line 16)

Option list ends without a blank line; unexpected unindent.
-s SERVERS [SERVERS ...], --servers SERVERS [SERVERS ...]
Servers queried by program (default: None)

System Message: WARNING/2 (<string>, line 18)

Definition list ends without a blank line; unexpected unindent.
-o OUTPUT, --output OUTPUT
 Output CSV file (default: [None])
-l LIMIT, --limit LIMIT
 Limit request count per host (default: [500])
-p PATTERN, --pattern PATTERN
 Glob pattern for metrics (default: ['*'])
-t TIMEOUT, --timeout TIMEOUT
 Timeout bethween requests for host (default: [1])

System Message: WARNING/2 (<string>, line 26)

Definition list ends without a blank line; unexpected unindent.

</pre>

For example <pre> ./generate_report.py -s dumdum:81 -o report.csv -l 2 -p .cpu. -t 42 </pre>

Will gather the first two metrics that match *.cpu.* with 42 seconds timeout bethween the requests. The command will ouptut the results in report.csv

Result

The program creates a csv file ginven as argument for the --output option having 5 columns:

HOST | METRIC | TIME | RELEVANCE | GRAPH_URL |

System Message: WARNING/2 (<string>, line 42)

Line block ends without a blank line.

|---------|------------|-------------|-----------|-----------------------------------------| | host:81 | cpu.0.wait | 4 Jul 2013 | .42 | http://host:81/render/?target=cpu.0.wait|

Developing Detectors

All detectors should extend the Detector class and implement the detect_anomalies method.

To change the detector in the program, just change the DETECTOR=SpikeDetector() line with an instance of your detector.

Testing Detectors

For testing you can use test_local.py.

It requires matplotlib for plotting the results.

test_local.py receives a Graphite json response for a given target and plots the following:
  • Original timeseries
  • Timeseries after running the detector
  • Detector results
  • A treshold line (you can remove it while testing)

You just have to replace SpikeDetector with your detector.

For testing large data, you can use the util.logger `create_logfile` function. It creates a json file that can be viewed using view_log.py script that plots a graph simmilar to the one yielded by test_local.py.

Docutils System Messages

System Message: ERROR/3 (<string>, line 42); backlink

Undefined substitution referenced: "---------".

System Message: ERROR/3 (<string>, line 42); backlink

Undefined substitution referenced: "-------------".

System Message: ERROR/3 (<string>, line 42); backlink

Undefined substitution referenced: "-----------------------------------------".

Subscribe to package updates

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.