@@ -3,25 +3,41 @@ openwisp-monitoring
33
44.. image :: https://api.travis-ci.org/openwisp/openwisp-monitoring.svg?branch=master
55 :target: https://travis-ci.org/github/openwisp/openwisp-monitoring
6+ :alt: ci build
67
78.. image :: https://coveralls.io/repos/github/openwisp/openwisp-monitoring/badge.svg?branch=master
89 :target: https://coveralls.io/github/openwisp/openwisp-monitoring?branch=master
10+ :alt: Test coverage
911
10- ------------
12+ .. image :: https://requires.io/github/openwisp/openwisp-monitoring/requirements.svg?branch=master
13+ :target: https://requires.io/github/openwisp/openwisp-monitoring/requirements/?branch=master
14+ :alt: Requirements Status
1115
12- OpenWISP 2 monitoring module (Work in progress).
16+ .. image :: https://badge.fury.io/py/openwisp-monitoring.svg
17+ :target: http://badge.fury.io/py/openwisp-monitoring
18+ :alt: pypi
1319
14- .. figure :: https://drive.google.com/uc?export=view&id=1BgxmXEkdEgCWlWASALZB2a3WeZad0wXw
15- :align: center
20+ .. image :: https://pepy.tech/badge/openwisp-monitoring
21+ :target: https://pepy.tech/project/openwisp-monitoring
22+ :alt: downloads
1623
17- ------------
24+ .. image :: https://img.shields.io/gitter/room/nwjs/nw.js.svg?style=flat-square
25+ :target: https://gitter.im/openwisp/monitoring
26+ :alt: support chat
1827
19- .. contents :: **Table of Contents**:
20- :backlinks: none
21- :depth: 3
28+ .. image :: https://img.shields.io/badge/code%20style-black-000000.svg
29+ :target: https://pypi.org/project/black/
30+ :alt: code style: black
2231
2332------------
2433
34+ This repository contains the monitoring module of `OpenWISP <openwisp.org >`_. It packs in a wide range
35+ of features which have been designed to be **extensible **, **scalable ** and easily **deployable **.
36+
37+ .. figure :: https://drive.google.com/uc?export=view&id=1GuB5HsyiZejBzXKZJnM8QJCUJt1Z5IkJ
38+ :align: center
39+
40+
2541Available Features
2642------------------
2743
@@ -34,10 +50,19 @@ Available Features
3450* Charts can be viewed at resolutions of 1 day, 3 days, a week, a month and a year
3551* Configurable alerts
3652* CSV Export of monitoring data
37- * Possibility to ` Configure additional charts <#openwisp_monitoring_charts >`_
53+ * Possibility to configure additional ` Metrics < #openwisp_monitoring_metrics >`_ and ` Charts <#openwisp_monitoring_charts >`_
3854* Extensible active check system: it's possible to write additional checks that
3955 are run periodically using python classes
4056* API to retrieve the chart metrics and status information of each device
57+ * The format used for Device Status is inspired by `NetJSON DeviceMonitoring <http://netjson.org/docs/what.html#devicemonitoring >`_
58+
59+ ------------
60+
61+ .. contents :: **Table of Contents**:
62+ :backlinks: none
63+ :depth: 3
64+
65+ ------------
4166
4267Install Dependencies
4368--------------------
@@ -85,6 +110,7 @@ Follow the setup instructions of `openwisp-controller
85110 ' openwisp_controller.pki' ,
86111 ' openwisp_controller.config' ,
87112 ' openwisp_controller.connection' ,
113+ ' openwisp_controller.geo' ,
88114 # monitoring
89115 ' openwisp_monitoring.monitoring' ,
90116 ' openwisp_monitoring.device' ,
@@ -380,12 +406,6 @@ Configuration applied
380406
381407This check ensures that the `openwisp-config agent <https://github.com/openwisp/openwisp-config/ >`_
382408is running and applying configuration changes in a timely manner.
383-
384- By default, if a configuration object stays in the ``modified `` state
385- for more than 5 minutes (configurable via
386- `OPENWISP_MONITORING_DEVICE_CONFIG_CHECK_MAX_TIME <#OPENWISP_MONITORING_DEVICE_CONFIG_CHECK_MAX_TIME >`_),
387- the check will fail and set the health status of the device to ``PROBLEM ``.
388-
389409You may choose to disable auto creation of this check by using the
390410setting `OPENWISP_MONITORING_AUTO_DEVICE_CONFIG_CHECK <#OPENWISP_MONITORING_AUTO_DEVICE_CONFIG_CHECK >`_.
391411
@@ -963,6 +983,84 @@ An example usage is shown below.
963983 **Note **: It will raise ``ImproperlyConfigured `` exception if the concerned chart
964984configuration is not registered.
965985
986+ Exceptions
987+ ----------
988+
989+ ``TimeseriesWriteException ``
990+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
991+
992+ **Path **: ``openwisp_monitoring.db.exceptions.TimeseriesWriteException ``
993+
994+ If there is any failure due while writing data in timeseries database, this exception shall
995+ be raised with a helpful error message explaining the cause of the failure.
996+ This exception will normally be caught and the failed write task will be retried in the background
997+ so that there is no loss of data if failures occur due to overload of Timeseries server.
998+ You can read more about this retry mechanism at `OPENWISP_MONITORING_WRITE_RETRY_OPTIONS <#openwisp-monitoring-write-retry-options >`_.
999+
1000+ ``InvalidMetricConfigException ``
1001+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1002+
1003+ **Path **: ``openwisp_monitoring.monitoring.exceptions.InvalidMetricConfigException ``
1004+
1005+ This exception shall be raised if the metric configuration is broken.
1006+
1007+ ``InvalidChartConfigException ``
1008+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1009+
1010+ **Path **: ``openwisp_monitoring.monitoring.exceptions.InvalidChartConfigException ``
1011+
1012+ This exception shall be raised if the chart configuration is broken.
1013+
1014+ Rest API
1015+ --------
1016+
1017+ Live documentation
1018+ ~~~~~~~~~~~~~~~~~~
1019+
1020+ .. image :: docs/api-doc.png
1021+
1022+ A general live API documentation (following the OpenAPI specification) at ``/api/v1/docs/ ``.
1023+
1024+ Browsable web interface
1025+ ~~~~~~~~~~~~~~~~~~~~~~~
1026+
1027+ .. image :: docs/api-ui-1.png
1028+ .. image :: docs/api-ui-2.png
1029+
1030+ Additionally, opening any of the endpoints `listed below <#list-of-endpoints >`_
1031+ directly in the browser will show the `browsable API interface of Django-REST-Framework
1032+ <https://www.django-rest-framework.org/topics/browsable-api/> `_,
1033+ which makes it even easier to find out the details of each endpoint.
1034+
1035+ List of endpoints
1036+ ~~~~~~~~~~~~~~~~~
1037+
1038+ Since the detailed explanation is contained in the `Live documentation <#live-documentation >`_
1039+ and in the `Browsable web page <#browsable-web-interface >`_ of each point,
1040+ here we'll provide just a list of the available endpoints,
1041+ for further information please open the URL of the endpoint in your browser.
1042+
1043+ Retrieve device charts and device status data
1044+ #############################################
1045+
1046+ .. code-block :: text
1047+
1048+ GET /v1/monitoring/device/{pk}/?key={key}&status=true
1049+
1050+ The format used for Device Status is inspired by `NetJSON DeviceMonitoring <http://netjson.org/docs/what.html#devicemonitoring >`_.
1051+
1052+ **Note **: If the request is made without ``?status=true `` then only device charts
1053+ data would be returned.
1054+
1055+ Collect device metrics and status
1056+ #################################
1057+
1058+ .. code-block :: text
1059+
1060+ POST /v1/monitoring/device/{pk}/?key={key}
1061+
1062+ The format used for Device Status is inspired by `NetJSON DeviceMonitoring <http://netjson.org/docs/what.html#devicemonitoring >`_.
1063+
9661064Signals
9671065-------
9681066
@@ -982,14 +1080,25 @@ view (only when using HTTP POST).
9821080The signal is emitted just before a successful response is returned,
9831081it is not sent if the response was not successful.
9841082
1083+ ``health_status_changed ``
1084+ ~~~~~~~~~~~~~~~~~~~~~~~~~
1085+
1086+ **Path **: ``openwisp_monitoring.device.signals.health_status_changed ``
1087+
1088+ **Arguments **:
1089+
1090+ - ``instance ``: instance of ``DeviceMonitoring `` whose status has been changed
1091+ - ``status ``: the status by which DeviceMonitoring's existing status has been updated with
1092+
1093+ This signal is emitted only if the health status of DeviceMonitoring object gets updated.
1094+
9851095``threshold_crossed ``
9861096~~~~~~~~~~~~~~~~~~~~~
9871097
9881098**Path **: ``openwisp_monitoring.monitoring.signals.threshold_crossed ``
9891099
9901100**Arguments **:
9911101
992- - ``sender ``: Metric class
9931102- ``metric ``: ``Metric `` object whose threshold defined in related alert settings was crossed
9941103- ``alert_settings ``: ``AlertSettings `` related to the ``Metric ``
9951104- ``target ``: related ``Device `` object
@@ -1001,6 +1110,55 @@ For example, sending recovery notifications.
10011110This signal is emitted when the threshold value of a ``Metric `` defined in
10021111alert settings is crossed.
10031112
1113+ ``pre_metric_write ``
1114+ ~~~~~~~~~~~~~~~~~~~~
1115+
1116+ **Path **: ``openwisp_monitoring.monitoring.signals.pre_metric_write ``
1117+
1118+ **Arguments **:
1119+
1120+ - ``metric ``: ``Metric `` object whose data shall be stored in timeseries database
1121+ - ``values ``: metric data that shall be stored in the timeseries database
1122+
1123+ This signal is emitted for every metric before the write operation is sent to
1124+ the timeseries database.
1125+
1126+ ``post_metric_write ``
1127+ ~~~~~~~~~~~~~~~~~~~~~
1128+
1129+ **Path **: ``openwisp_monitoring.monitoring.signals.post_metric_write ``
1130+
1131+ **Arguments **:
1132+
1133+ - ``metric ``: ``Metric `` object whose data is being stored in timeseries database
1134+ - ``values ``: metric data that is being stored in the timeseries database
1135+
1136+ This signal is emitted for every metric after the write operation is sent to the
1137+ timeseries database. Since the write operation is run in the background and may be
1138+ retried on failures, using the ``post_metric_write `` signal does not guarantee the
1139+ receiver function will be called after the data has been written, only after the
1140+ request to write it has been sent.
1141+
1142+ Management commands
1143+ -------------------
1144+
1145+ ``run_checks ``
1146+ ~~~~~~~~~~~~~~
1147+
1148+ This command will execute all the `available checks <#available-checks >`_ for all the devices.
1149+ By default checks are run periodically by *celery beat *. You can learn more
1150+ about this in `Setup <#setup-integrate-in-an-existing-django-project >`_.
1151+
1152+ Example usage:
1153+
1154+ .. code-block :: shell
1155+
1156+ cd tests/
1157+ ./manage.py run_checks
1158+
1159+ For more information about how to custom django management commnads work,
1160+ please refer to the `django documentation https://docs.djangoproject.com/en/dev/howto/custom-management-commands/> `_.
1161+
10041162Installing for development
10051163--------------------------
10061164
0 commit comments