Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
salt-observer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
django
salt-observer
Commits
ce95fbb7
There was a problem fetching the pipeline summary.
Commit
ce95fbb7
authored
8 years ago
by
Tim Fechner
Browse files
Options
Downloads
Plain Diff
Merge branch 'dev_4' into 'master'
Add list of listening services to minion detail Close
#4
See merge request
!2
parents
16483b6c
c70210b8
No related branches found
No related tags found
1 merge request
!2
Add list of listening services to minion detail
Pipeline
#
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
salt_observer/management/commands/fetchlisteningservices.py
+30
-0
30 additions, 0 deletions
salt_observer/management/commands/fetchlisteningservices.py
salt_observer/templates/minion/detail.html
+32
-5
32 additions, 5 deletions
salt_observer/templates/minion/detail.html
with
62 additions
and
5 deletions
salt_observer/management/commands/fetchlisteningservices.py
0 → 100644
+
30
−
0
View file @
ce95fbb7
from
django.core.management.base
import
BaseCommand
from
salt_observer.models
import
Minion
from
.
import
ApiCommand
class
Command
(
ApiCommand
,
BaseCommand
):
help
=
'
Fetch and save listening network services
'
def
save_services
(
self
,
api
):
listening_services
=
api
.
get
(
'
network.netstat
'
)
for
minion_fqdn
,
services
in
listening_services
.
items
():
minion
=
Minion
.
objects
.
filter
(
fqdn
=
minion_fqdn
).
first
()
if
not
minion
:
continue
minion_services
=
[]
for
service
in
services
:
if
service
.
get
(
'
state
'
,
''
)
==
'
LISTEN
'
:
minion_services
.
append
(
service
)
minion
.
update_data
({
'
listening_services
'
:
minion_services
})
minion
.
save
()
def
handle
(
self
,
*
args
,
**
kwargs
):
api
=
super
().
handle
(
*
args
,
**
kwargs
)
self
.
save_services
(
api
)
api
.
logout
()
This diff is collapsed.
Click to expand it.
salt_observer/templates/minion/detail.html
+
32
−
5
View file @
ce95fbb7
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
<li
role=
"presentation"
><a
{%
if
minion.outdated_package_count
%}
class=
"text-danger"
{%
endif
%}
href=
"#packages"
aria-controls=
"packages"
role=
"tab"
data-toggle=
"tab"
>
Packages
</a></li>
<li
role=
"presentation"
><a
{%
if
minion.outdated_package_count
%}
class=
"text-danger"
{%
endif
%}
href=
"#packages"
aria-controls=
"packages"
role=
"tab"
data-toggle=
"tab"
>
Packages
</a></li>
<li
role=
"presentation"
><a
href=
"#users"
aria-controls=
"users"
role=
"tab"
data-toggle=
"tab"
>
Users
</a></li>
<li
role=
"presentation"
><a
href=
"#users"
aria-controls=
"users"
role=
"tab"
data-toggle=
"tab"
>
Users
</a></li>
<li
role=
"presentation"
><a
href=
"#partitions"
aria-controls=
"partitions"
role=
"tab"
data-toggle=
"tab"
>
Partitions
</a></li>
<li
role=
"presentation"
><a
href=
"#partitions"
aria-controls=
"partitions"
role=
"tab"
data-toggle=
"tab"
>
Partitions
</a></li>
<li
role=
"presentation"
><a
href=
"#netstat"
aria-controls=
"netstat"
role=
"tab"
data-toggle=
"tab"
>
Netstat
</a></li>
</ul>
</ul>
<!-- tab panes -->
<!-- tab panes -->
...
@@ -240,9 +241,9 @@
...
@@ -240,9 +241,9 @@
{% for network in minion.networkinterface_set.all %}
{% for network in minion.networkinterface_set.all %}
<tr>
<tr>
<td>
{{ network.name }}
</td>
<td>
{{ network.name }}
</td>
<td>
{{ network.mac_address }}
</td>
<td>
<samp>
{{ network.mac_address }}
</
samp></
td>
<td>
{{ network.network.ipv4 }}
</td>
<td>
<samp>
{{ network.network.ipv4 }}
</
samp></
td>
<td><a
href=
"{% url 'network-detail' network.network.ipv4 %}"
>
{{ network.network.mask }}
</a></td>
<td><
samp><
a
href=
"{% url 'network-detail' network.network.ipv4 %}"
>
{{ network.network.mask }}
</a></
samp></
td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</tbody>
...
@@ -319,8 +320,8 @@
...
@@ -319,8 +320,8 @@
<tr
data-uid=
"{{ user.id }}"
>
<tr
data-uid=
"{{ user.id }}"
>
<td>
{{ user.id }}
</td>
<td>
{{ user.id }}
</td>
<td>
{{ user.name }}
</td>
<td>
{{ user.name }}
</td>
<td><
code
>
{{ user.home }}
</
code
></td>
<td><
samp
>
{{ user.home }}
</
samp
></td>
<td><
code
>
{{ user.shell }}
</
code
></td>
<td><
samp
>
{{ user.shell }}
</
samp
></td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</tbody>
...
@@ -353,6 +354,32 @@
...
@@ -353,6 +354,32 @@
</table>
</table>
</div>
</div>
<!-- netstat -->
<div
role=
"tabpanel"
class=
"tab-pane fade"
id=
"netstat"
>
<table
class=
"table sortable"
>
<thead>
<tr>
<th>
User id
</th>
<th>
Remote address
</th>
<th>
Local address
</th>
<th>
Program
</th>
<th>
Protocol
</th>
</tr>
</thead>
<tbody>
{% for service in minion.data.listening_services %}
<tr>
<td>
{{ service.user }}
</td>
<td><samp>
{{ service|get:"remote-address" }}
</samp></td>
<td><samp>
{{ service|get:"local-address" }}
</samp></td>
<td><samp>
{{ service.program }}
</samp></td>
<td>
{{ service.proto }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<!-- tab panes end -->
<!-- tab panes end -->
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment