Django MVC

Models

class monitor.models.Group(*args, **kwargs)[source]

Group sites by type

class monitor.models.Outage(*args, **kwargs)[source]

Records when an outage has taken place, including all the things that have gone down and the dates when it was resolved etc

class monitor.models.OutageSites(*args, **kwargs)[source]

Records which sites are effected by the outage

class monitor.models.Site(*args, **kwargs)[source]

Core information about a site

class monitor.models.SiteView(*args, **kwargs)[source]

Records when it has been accessed and the code returned

This will get big very quickly, so there will need to be a database purge script written. This shouldn’t be done on save because the normal monitoring system should do no extra work.

Using a UUID rather than an auto-increment for the pk

Views

monitor.views.group_data(request, *args, **kwargs)[source]

Returns a json object containing details for each site being monitored in this particular group

monitor.views.home(request)[source]

Show monitoring results for all systems being monitored.

This doesn’t do any parsing, it just gets the latest information from the database. A seperate script does the db update work.

monitor.views.login_user(request)[source]

Logs the user in

monitor.views.outage(request, *args, **kwargs)[source]

Shows details of an outage, or the current outage if there is one

monitor.views.outages(request, *args, **kwargs)[source]

Lists all outages recorded on the system. You can click on each one to view the details of it.

monitor.views.site_data(request, *args, **kwargs)[source]

Returns details of the last 10 requests to view this particular site as a json object

Templatetags

readable_time

monitor.templatetags.readable_time.readable_time(value)[source]

Pass it a time in seconds and it returns a human readable string showing the hours, minutes and seconds

number_suffix

monitor.templatetags.number_suffix.ordinal(value)[source]

http://code.activestate.com/recipes/576888-format-a-number-as-an-ordinal/

Converts zero or a postive integer (or their string representations) to an ordinal value.

>>> for i in range(1,13):
...     ordinal(i)
...     
u'1st'
u'2nd'
u'3rd'
u'4th'
u'5th'
u'6th'
u'7th'
u'8th'
u'9th'
u'10th'
u'11th'
u'12th'
>>> for i in (100, '111', '112',1011):
...     ordinal(i)
...     
u'100th'
u'111th'
u'112th'
u'1011th'

paginator

monitor.templatetags.paginator.paginate(obj)[source]

Takes an object obj and puts the pagination links on screen.

This is an inclusion tag rather than just calling the fragment because it is totally generic - it uses {{obj}} rather than the name of the variable.

Project Versions

Table Of Contents

Previous topic

Monitoring System documentation

Next topic

Python Scripts

This Page