Skip to content

Commit 893fe08

Browse files
committed
cleaning up README formatting
1 parent f4699aa commit 893fe08

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

README.markdown

+29-23
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
1+
# django-munin
2+
13
This is a Django application to make it a bit simpler to use
2-
Munin (http://munin-monitoring.org/) to monitor various metrics
4+
[Munin](http://munin-monitoring.org/) to monitor various metrics
35
for your Django app.
46

57
First, it includes a munin plugin that you can symlink into
6-
/etc/munin/plugins/ and point at your django application and it will
8+
`/etc/munin/plugins/` and point at your django application and it will
79
gather data for munin to graph. Second, it contains a couple views
810
that return some very basic information about the state of your app:
911
database performance, number of users, number of sessions, etc. Third,
1012
it provides a decorator to make it simple to expose your own custom
1113
metrics to Munin.
1214

13-
Install django-munin into your python path with the usual pip install
14-
or whatever you are doing. Then add 'munin' to your INSTALLED_APPS and
15-
run 'manage.py syncdb' (it just needs to set up one database table
15+
## Installing
16+
17+
Install `django-munin` into your python path with the usual `pip install`
18+
or whatever you are doing. Then add `munin` to your `INSTALLED_APPS` and
19+
run `manage.py syncdb` (it just needs to set up one database table
1620
that it will use for performance testing).
1721

1822
To access the included basic views, add the following pattern to your
19-
urls.py:
23+
`urls.py`:
2024

21-
('^munin/',include('munin.urls')),
25+
('^munin/',include('munin.urls')),
2226

2327
The views available there are then going to be at:
2428

25-
* munin/db_performance/ (milliseconds to perform insert/select/delete operations)
26-
* munin/total_users/ (total number of Users)
27-
* munin/active_users/ (number of users logged in in the last hour)
28-
* munin/total_sessions/ (total number of sessions)
29-
* munin/active_sessions/ (number of sessions that are not expired)
29+
* `munin/db_performance/` (milliseconds to perform insert/select/delete operations)
30+
* `munin/total_users/` (total number of Users)
31+
* `munin/active_users/` (number of users logged in in the last hour)
32+
* `munin/total_sessions/` (total number of sessions)
33+
* `munin/active_sessions/` (number of sessions that are not expired)
3034

3135
Those were the only metrics I could think of that would be potentially
3236
useful on just about any Django app and were likely to always be
@@ -35,11 +39,11 @@ available.
3539
(I'm going to assume that you are already a pro at configuring
3640
Munin. If not, go get on that. Munin is very cool)
3741

38-
Next, copy scripts/django.py into your /usr/share/munin/plugins/
42+
Next, copy `scripts/django.py` into your `/usr/share/munin/plugins/`
3943
directory.
4044

4145
For each metric that you want Munin to monitor, make a symlink in
42-
/etc/munin/plugins/ to /usr/share/munin/plugins/django.py with an
46+
`/etc/munin/plugins/` to `/usr/share/munin/plugins/django.py` with an
4347
appropriate name. Eg, to monitor all five of the included ones (as
4448
root, probably):
4549

@@ -50,9 +54,9 @@ root, probably):
5054
$ ln -s /usr/share/munin/plugins/django.py /etc/munin/plugins/myapp_active_sessions
5155

5256
You then need to configure each of them in
53-
/etc/munin/plugin-conf.d/munin-node
57+
`/etc/munin/plugin-conf.d/munin-node`
5458

55-
For each, give it a stanza with env.url and graph_category set. To
59+
For each, give it a stanza with `env.url` and `graph_category` set. To
5660
continue the above, you'd add something like:
5761

5862
[myapp_db_performance]
@@ -78,21 +82,23 @@ continue the above, you'd add something like:
7882
Restart your Munin node, and it should start collecting and graphing
7983
that data.
8084

85+
## Custom munin views
86+
8187
Those are pretty generic metrics though and the real power of this
8288
application is that you can easily expose your own custom
8389
metrics. Basically, anything that you can calculate in the context of
8490
a Django view in your application, you can easily expose to Munin.
8591

86-
django-munin includes a 'muninview' decorator that lets you write a
87-
regular django view that returns a list of (key,value) tuples and it
88-
will expose those to that django.py munin plugin for easy graphing.
92+
`django-munin` includes a `@muninview` decorator that lets you write a
93+
regular django view that returns a list of `(key,value)` tuples and it
94+
will expose those to that `django.py` munin plugin for easy graphing.
8995

90-
The @muninview decorator takes a config parameter, which is just a
96+
The `@muninview` decorator takes a `config` parameter, which is just a
9197
string of munin config directives. You'll want to put stuff like
92-
graph_title, graph_vlabel, and graph_info there. Possibly
93-
graph_category too (if you include it there, remove it from the munin
98+
`graph_title`, `graph_vlabel`, and `graph_info` there. Possibly
99+
`graph_category` too (if you include it there, remove it from the munin
94100
plugin conf stanza). The view function that it wraps then just needs
95101
to return a list of tuples.
96102

97103
The simplest way to get a feel for how this works is to look at how
98-
the included views were written. So check out munin/views.py.
104+
the included views were written. So check out [munin/views.py](https://github.com/ccnmtl/django-munin/blob/master/munin/views.py).

0 commit comments

Comments
 (0)