summaryrefslogtreecommitdiffstats
path: root/templates/host.html
blob: 9fa1b82c16f7d9ba914f831741a73a6e9dae3090 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
{% extends 'layout.html' %}

{% block title %}{{hostname}}{% endblock %}

{% block content %}
<h1>{{hostname|replace('.spline.inf.fu-berlin.de', '')}}</h1>

<ul class="nav nav-tabs">
  <li class="active"><a href="#info" data-toggle="tab">Info</a></li>
  <li><a href="#ports" data-toggle="tab">Ports</a></li>
  <li><a href="#interfaces" data-toggle="tab">Interfaces</a></li>
  <li><a href="#services" data-toggle="tab">Services</a></li>
  <li class="pull-right"><a id="index" href="index.html">back to index</a></li>
</ul>

<div class="tab-content">
  <div class="tab-pane active" id="info">
    {% if description is defined %}
    <div class="row">
      <div class="well well-small span8 offset2">
        {{description}}
      </div>
    </div>
    {% endif %}

    <dl class="dl-horizontal">
      <dt>hostname</dt><dd>{{hostname}}</dd>
      <dt>os</dt><dd>{{os|default('unknown')}}</dd>
      <dt>arch</dt><dd>{{arch|default('unknonw')}}</dd>
      {% if vserver %}
      <dt>vserver</dt><dd>{{vserver}}</dd>
      {% endif %}
      {% if vserver_host %}
      <dt>vserver_host</dt><dd>{{vserver_host}}</dd>
      {% endif %}
      {% if maintainers is iterable %}
      <dt>maintainers</dt>
      <dd>
        {% for maintainer in maintainers %}
        {% set name, mail = get_contact_info(maintainer) %}
        <a href="mailto:{{mail}}">{{name}}</a>
        {% if not loop.last %}, {% endif %}
	{% endfor %}
      </dd>
      {% endif %}
      {% if groups is defined %}
      <dt>bcfg2-groups</dt>
      <dd>
        {% for group in groups %}
        {{group}}{% if not loop.last %}, {% else %}<br />{% endif %}
        {% endfor %}
        <a href="https://bcfg2.spline.de/client/{{hostname}}">view client in bcfg2</a>
        </dd>
      {% endif %}
    </dl>
  </div>

   
  <div class="tab-pane row" id="interfaces">
    {% if addresses %}
    {% for group in addresses | select_with_attribute('vserver', False) | groupby('interface') %}
    <div class="span6">
      <h3>{{ group.grouper }}</h3>
      <ul>
        {% for address in group.list %}
        <li>{{address['address']}}/{{address['netmask']}}</li>
        {% else %}
        <li>no address</li>
        {% endfor %}
      </ul>
    </div>
    {% else %}
    <p class="centering">no network interfaces</p>
    {% endfor %}
    {% endif %}
  </div>

  <div class="tab-pane" id="ports">
    <table id="portstable" class="table table-striped table-hover tablesorter">
      <thead>
        <tr>
          <th>Port</th>
          <th>IP</th>
          <th>Process</th>
          <th>Protocol</th>
        </tr>
      </thead>
      <tbody>
	{% set ports = ports or [] %} 
        {% for port in ports %}
        <tr>
          <td>{{port['port']}}</td>
          <td>{{port['ip']}}</td>
          <td>{{port['process']}}</td>
          <td>{{port['proto']}}</td>
        </tr>
        {% else%}
        <tr><td class="centering" colspan="4">no ports open</td></tr>
        {% endfor %}
      </tbody>
    </table>
  </div>

  <div class="tab-pane" id="services">
    {% if services is defined %}
    <table id="servicetable" class="table table-striped table-hover tablesorter">
      <thead>
        <tr>
          <th>Name</th>
          <th>Port</th>
          <th>Visibility</th>
        </tr>
      </thead>
      <tbody>
        {% for service_category in services %}
          {% if services[service_category] is iterable %}
            {% for service in services[service_category] %}
            <tr>
              <td>
                {% if service is string %}
                {{service}}
                {% else %}
                {{service.items()[0][0]}}
                {% endif %}
              </td>
              <td>
                {% if service is string %}
                default
                {% else %}
                {{service.items()[0][1]}}
                {% endif %}
              </td>
              <td>{{service_category}}</td>
            </tr>
            {% endfor %}
          {% endif %}
        {% else %}
        <tr><td class="centering" colspan="4">no services provoided</td></tr>
        {% endfor %}
      </tbody>
    </table>
    {% endif %}
  </div>
</div>

<script>
<!--
  $(function() {
    // force column "IP" to text (ips sometimes are parsed as digits)
    $("table#portstable").tablesorter({ headers: { 1: { sorter:'text' } } });
    $("table#servicetable").tablesorter();
  });
//-->
</script>
{% endblock %}