Skip to content

Commit

Permalink
Initial work on pollers overview
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mortimer committed Sep 28, 2016
1 parent 8dd15ad commit b2dc741
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 1 deletion.
2 changes: 2 additions & 0 deletions controller/app/__init__.py
Expand Up @@ -6,7 +6,9 @@
from app.mod_tasks.controllers import mod_tasks
from app.mod_inventory.controllers import mod_inventory
from app.mod_configuration.controllers import mod_configuration
from app.mod_pollers.controllers import mod_pollers

app.register_blueprint(mod_tasks)
app.register_blueprint(mod_inventory)
app.register_blueprint(mod_configuration)
app.register_blueprint(mod_pollers)
2 changes: 1 addition & 1 deletion controller/app/mod_configuration/controllers.py
Expand Up @@ -6,5 +6,5 @@


@mod_configuration.route('/', methods=['GET'])
def get_configuration():
def home():
return render_template('configuration/index.html')
Empty file.
10 changes: 10 additions & 0 deletions controller/app/mod_pollers/controllers.py
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

from flask import Blueprint, render_template

mod_pollers = Blueprint('pollers', __name__, url_prefix='/pollers')


@mod_pollers.route('/', methods=['GET'])
def home():
return render_template('pollers/pollers.html')
6 changes: 6 additions & 0 deletions controller/app/templates/navigation.html
Expand Up @@ -119,6 +119,12 @@ <h5 class="media-heading"><strong>John Smith</strong>
<li {%- if request.path == url_for('tasks.get_tasks') %} class="active" {% endif %}>
<a href="{{ url_for('tasks.get_tasks') }}"><i class="fa fa-fw fa-bar-chart-o"></i> Tasks</a>
</li>
<li {%- if request.path == url_for('pollers.home') %} class="active" {% endif %}>
<a href="{{ url_for('pollers.home') }}"><i class="fa fa-fw fa-bar-chart-o"></i> Pollers</a>
</li>
<li {%- if request.path == url_for('configuration.home') %} class="active" {% endif %}>
<a href="{{ url_for('configuration.home') }}"><i class="fa fa-fw fa-bar-chart-o"></i> Configuration</a>
</li>
<li>
<a href="javascript:;" data-toggle="collapse" data-target="#demo"><i class="fa fa-fw fa-arrows-v"></i> Dropdown <i class="fa fa-fw fa-caret-down"></i></a>
<ul id="demo" class="collapse">
Expand Down
35 changes: 35 additions & 0 deletions controller/app/templates/pollers/pollers.html
@@ -0,0 +1,35 @@
<!-- extend from base layout -->
{% extends "base.html" %}
{% block content %}

<div class="page-header">
<h2>All Pollers</h2>
</div>

<div class="row">
<div class="col-lg-9">
<table class="table table-condensed">
<tr>
<th>Name</th>
<th>IP</th>
<th>Port</th>
<th>Status</th>
<th>Online since</th>
<th>Last healthpoll</th>
</tr>
{% for poller in pollers %}
<tr>
<td>{{ poller.name }}</td>
<td>{{ poller.ip }}</td>
<td>{{ poller.port }}</td>
<td></td>
<td></td>
<td></td>
</tr>
{% else %}
<tr><td colspan=6>No pollers found</td></tr>
{% endfor %}
</table>
</div>
</div>
{% endblock %}
15 changes: 15 additions & 0 deletions controller/libs/pollers.py
@@ -0,0 +1,15 @@
#!/usr/bin/env python3

class Poller:
"""A single poller connection"""

def __init__(self, ip, port, name=None):
""" Initialise task handler
:param ip: Poller IP address
:param port: Poller listening port
:param name: Poller name
"""
self.ip = ip
self.port = port
self.port = name

0 comments on commit b2dc741

Please sign in to comment.