Skip to content

Commit

Permalink
Added more readme
Browse files Browse the repository at this point in the history
  • Loading branch information
solarkennedy committed Dec 15, 2013
1 parent e46074d commit 0dbb10b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
# sensu-report
[![Build Status](https://travis-ci.org/solarkennedy/sensu-report.png)](https://travis-ci.org/solarkennedy/sensu-report)

A script to query the [Sensu API](http://sensuapp.org/docs/0.12/api)
and get a human readable report.
Prints a human readable output of the failing Sensu checks into your terminal.
Queries the [Sensu API](http://sensuapp.org/docs/0.12/api) and formats it
into pretty colors. Basically a text based report of the sensu dashboard,
on a particular client. (by default, the local hostmame)

## Examples

```
./sensu-report --server localhost
Failed Sensu checks on this host:
Crit: (6 hours ago) apt-get_update: Hit http://archive.ubuntu.com precise-...
Crit: (3 hours ago) check-ping-leb2.xkyle.com: PING CRITICAL - Packet loss...
Crit: (3 hours ago) check-ping-remina.gateway.2wire.net: CRITICAL - Networ...
```


## Put it in Puppet for MOTDs

Expand Down
17 changes: 10 additions & 7 deletions sensu-report
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"""
SYNOPSIS
Prints a human readable output of the failing Sensu checks into your terminal.
Queries the Sensu API and formats it into pretty colors. Basically a text
based report of the sensu dashboard, on a particular client. (by default,
the local hostmame)
"""
RED = '\033[91m'
YELLOW = '\033[93m'
Expand Down Expand Up @@ -40,13 +45,11 @@ def test_pretty_date():
is pretty """
import datetime
fakenow = 1387148113
fake = fudge.Fake('now', callable=True).returns(fakenow)
patched = fudge.patch_object(datetime.datetime, 'now', fake)
try:
eq_(datetime.datetime.now(), now)
finally:
patched.restore()
eq_(datetime.datetime.now, orig_datetime.now)
# TODO:....
assert pretty_date(1387148113) == "Just now"

def test_test():
pass

def pretty_date(time=False):
"""
Expand Down

0 comments on commit 0dbb10b

Please sign in to comment.