-
-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Added intergration with openwisp-monitoring #488
Open
pandafy
wants to merge
48
commits into
master
Choose a base branch
from
radius-monitoring
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 42 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
73d69c6
[feature] Added intergraion with openwisp-monitoring
pandafy 6b4846c
[req-changes] Fixed colours for RADIUS charts
pandafy e8b7990
[chores] Refactored code
pandafy 6c12595
[tests] Added tests for RADIUS monitoring
pandafy e18f1b3
[chores] Updated requirements-test.txt
pandafy c4d1e7a
[ci] Added stylelint and jshint
pandafy e8901f5
[tests] Fixed test suite
pandafy 978e7e9
[ci] Updated system dependencies
pandafy 3ab942f
[tests] Fixed coverage
pandafy cc6c330
[docs] Added documentation
pandafy 9139946
[feature] Added dashboard pie charts for radius monitoring
pandafy ce5755a
[docs] Added dashboard pie chart screenshot
pandafy de4af91
[fix] Removed precision from Round() which is not support on Django 3.2
pandafy dee1af5
[chores] Upgraded openwisp-utils dependency
pandafy 88eeda3
[fix] Handle called_station_id uses "-" instead of ":"
pandafy 38eab47
[req-changes] Updated colors for the user registration page
pandafy a453f4f
[req-changes] Don't discard accounting metrics if related device is n…
pandafy 3dd0901
[req-changes] Updated colours
pandafy b0c41f3
[tests] Added test for changes in post_save_radiusaccounting
pandafy fd91f6f
[req-changes] Use a separate metric for storing total registered users
pandafy 45554ef
[req-changes] Moved "RADIUS Sessions" tab on the device page after "C…
pandafy c232b7f
[change] Create a separate metric and chart for total registered users
pandafy 460d679
[tests] Fixed test suite
pandafy 8db674d
[change] Updated colours
pandafy 12259cc
[change] Exclude users in write_user_signup_metrics which registered …
pandafy 7e0cf00
[revert] Revert "[change] Updated colours"
pandafy 7cc8dc0
[change] Added fill operation in influxDB query
pandafy a511ec4
[change] Removed fill from user registration graph
pandafy a706e4c
[tests] Fixed tests
pandafy 869e4db
[fix] Fixed called_station_id and calling_station_id lookup for Radiu…
pandafy 6cf1fd8
[fix] Fixed view all radius sessions button in device change page
pandafy 810593c
[fix] Fixed alignment of RADIUS Session text
pandafy ccad33c
[req-changes] Fixed inconsistencies in UI
pandafy 2f2b956
[req-changes] Updated order of RADIUS charts in device page
pandafy a0c81c1
[req-change] Use verbose label for SAML in radius monitoring charts
pandafy 338ede3
[req-change] Use verbose name for all registration methods
pandafy 5d86050
[fix] Fixed date formatting for RADIUS sessions on device page
pandafy c16cb22
[chores] Changed openwisp-monitoring branch from radius-monitoring to…
pandafy b008b25
[fix] Fixed metric not writing when RegisteredUser does not exist
pandafy 8d1717c
[fix] Fixed test
pandafy db2756e
[req-changes] Removed fill from User Registration form
pandafy 17909e6
[req-changes] Renamed labels of RADIUS monitoring charts
pandafy c862fba
[change] Hash calling_station_id
pandafy 938c492
[req-changes] Added setting for disable org lookup for device
pandafy f8dfab6
[req-changes] Renamed setting
pandafy c73ee88
[change] Use device.organization_id for RADIUS metric if SHARED_ACCOU…
pandafy 193ac59
[req-change] Don't overwrite the organization of RadiusAccounting
pandafy 1bdf7b6
[chores] Removed changes to .gitignore and setup.cfg
pandafy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"unused": true, | ||
"esversion": 6, | ||
"curly": true, | ||
"strict": "global", | ||
"browser": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: "3" | ||
|
||
services: | ||
influxdb: | ||
image: influxdb:1.8-alpine | ||
volumes: | ||
- influxdb-data:/var/lib/influxdb | ||
ports: | ||
- "8086:8086" | ||
environment: | ||
INFLUXDB_DB: openwisp2 | ||
INFLUXDB_USER: openwisp | ||
INFLUXDB_USER_PASSWORD: openwisp | ||
|
||
redis: | ||
image: redis:alpine | ||
ports: | ||
- "6379:6379" | ||
entrypoint: redis-server --appendonly yes | ||
|
||
volumes: | ||
influxdb-data: {} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
Integration with OpenWISP Monitoring | ||
------------------------------------ | ||
|
||
OpenWISP RADIUS includes an optional Django sub-app that adds integration with | ||
`OpenWISP Monitoring <https://github.com/openwisp/openwisp-monitoring#openwisp-monitoring>`_ | ||
to provide RADIUS metrics. | ||
|
||
.. image:: /images/radius-dashboard-charts.png | ||
:alt: RADIUS session dashboard charts | ||
|
||
RADIUS metrics | ||
============== | ||
|
||
1. User registrations | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. image:: /images/user-registration-chart.png | ||
:alt: User registration chart | ||
|
||
This chart shows number of users signed up using different registration methods. | ||
|
||
2. Total user registrations | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. image:: /images/total-user-registration-chart.png | ||
:alt: Total user registration chart | ||
|
||
This chart shows total users registered using different registration methods | ||
in the system on a given date. | ||
|
||
3. Unique RADIUS Sessions | ||
~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. image:: /images/unique-radius-session-chart.png | ||
:alt: Unique RADIUS session chart | ||
|
||
This chart shows unique RADIUS sessions. It is helpful to know how many | ||
unique users has used the system in a given time. | ||
|
||
4. RADIUS traffic | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
.. image:: /images/radius-traffic-chart.png | ||
:alt: RADIUS traffic chart | ||
|
||
This chart shows the RADIUS traffic generated by user sessions. | ||
|
||
Enabling RADIUS metrics in Django project | ||
========================================= | ||
|
||
You can enable the monitoring integration by including ``openwisp_radius.integrations.monitoring`` | ||
in ``INSTALLED_APPS`` of your Django project's settings as following: | ||
|
||
|
||
.. code-block:: python | ||
|
||
# In your_project/settings.py | ||
|
||
INSTALLED_APPS = [ | ||
# ... | ||
'openwisp_radius', | ||
'openwisp_radius.integrations.monitoring' # <--- add the app after openwisp_radius | ||
# ... | ||
] | ||
|
||
.. note:: | ||
|
||
Ensure your Django project is correctly configured to utilize OpenWISP Monitoring as | ||
outlined in the `OpenWISP Monitoring's documentation <https://github.com/openwisp/openwisp-monitoring#setup-integrate-in-an-existing-django-project>`_. | ||
For production environments, it is advisable to deploy OpenWISP using | ||
`Ansible OpenWISP2 <https://github.com/openwisp/ansible-openwisp2>`_ or | ||
`Docker OpenWISP <https://github.com/openwisp/docker-openwisp>`_, as they simplify | ||
the deployment process considerably. | ||
|
||
.. important:: | ||
|
||
If you are registering a :ref:`"registration method" <register_registration_method>` | ||
in any other Django application, then ``openwisp_radius.integrations.monitoring`` | ||
should come after that app in the ``INSTALLED_APPS``. Otherwise, the | ||
registration method would not appear in the chart. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from django.contrib import admin | ||
from django.urls import reverse | ||
from swapper import load_model | ||
|
||
Device = load_model('config', 'Device') | ||
RadiusAccounting = load_model('openwisp_radius', 'RadiusAccounting') | ||
|
||
BaseDeviceAdmin = admin.site._registry[Device].__class__ | ||
|
||
|
||
class DeviceAdmin(BaseDeviceAdmin): | ||
change_form_template = 'admin/config/radius-monitoring/device/change_form.html' | ||
|
||
class Media: | ||
js = tuple(BaseDeviceAdmin.Media.js) + ( | ||
'radius-monitoring/js/device-change.js', | ||
) | ||
css = { | ||
'all': ('radius-monitoring/css/device-change.css',) | ||
+ BaseDeviceAdmin.Media.css['all'] | ||
} | ||
|
||
def get_extra_context(self, pk=None): | ||
ctx = super().get_extra_context(pk) | ||
ctx.update( | ||
{ | ||
'radius_accounting_api_endpoint': reverse( | ||
'radius:radius_accounting_list' | ||
), | ||
'radius_accounting': reverse( | ||
f'admin:{RadiusAccounting._meta.app_label}' | ||
f'_{RadiusAccounting._meta.model_name}_changelist' | ||
), | ||
} | ||
) | ||
return ctx | ||
|
||
|
||
admin.site.unregister(Device) | ||
admin.site.register(Device, DeviceAdmin) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is longer than the title, let's also update the charts images once we are done with everything else