-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
1,881 additions
and
95 deletions.
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
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,32 @@ | ||
.. _local_testing: | ||
|
||
============= | ||
Local Testing | ||
============= | ||
|
||
When adding new functionality to ``napalm-logs``, in particular new parsing templates, it can be helpful to run an end-to-end simulation. | ||
|
||
Testing Installation | ||
++++++++++++++++++++ | ||
|
||
As referenced in the :ref:`installation <installation>` documentation, it's advisable to use a Python Virtual Environment. This also applies for the testing installation. | ||
Once you have the environment setup, you can install your local copy (with modifications) of ``napalm-logs`` in it: | ||
|
||
.. code-block:: bash | ||
pip install -e <local_path/url> | ||
Suggested startup options for ``napalm-logs`` once it's installed: | ||
|
||
.. code-block:: bash | ||
napalm-logs -l debug --disable-security --publisher cli --listener udp --port 5514 | ||
This will run ``napalm-logs`` in a ``debug`` log-level, without certificate-based authentication, using the ``cli`` publisher, while listening for ``syslog`` messages on UDP port 5514. | ||
You can then proceed to send a sample ``syslog`` message to ``napalm-logs`` using ``netcat``: | ||
|
||
.. code-block:: bash | ||
nc -w0 -u 127.0.0.1 5514 <<< "<32>Oct 24 20:21:27 vmx01 jlaunchd: System reaching processes ceiling high watermark: Contact to system administrator to clean up unnecessary processes or increase maxproc ceiling. Further process fork request may be denied." | ||
The debug output will go to ``/var/log/napalm/logs/`` by default, and it will output the yang message on the CLI. |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
.. _publisher-prometheus: | ||
|
||
========== | ||
Prometheus | ||
========== | ||
|
||
.. versionadded:: 0.10.0 | ||
|
||
Expose *napalm-logs* notifications as Prometheus metrics. | ||
|
||
.. important:: | ||
|
||
In order to make use of this Publisher, you'll need to enable the | ||
:ref:`configuration-options-enable-metrics` option (and eventually | ||
customise the other related settings). | ||
|
||
The metrics start with ``napalm_logs``, plus the *napalm-logs* notification | ||
name. For example, the metric corresponding to :ref:`ISIS_NEIGHBOR_DOWN` is | ||
named ``napalm_logs_isis_neighbor_down``. | ||
|
||
All the metrics have at least the ``host`` label. Some of them have additional | ||
labels, whenever it makes sense to include additional information that can be | ||
used for selection and/or alerting. | ||
|
||
By default, it will expose metrics for all kinds of messages, so you might want | ||
to narrow down the selection using the :ref:`publisher-opts-error-whitelist` or | ||
:ref:`publisher-opts-error-blacklist` options. | ||
|
||
CLI usage example: | ||
|
||
.. code-block:: bash | ||
$ sudo napalm-logs --publisher prometheus --enable-metrics | ||
Starting through the command above, you'll find the metrics at | ||
http://localhost:9443/metrics. | ||
|
||
Metrics examples: | ||
|
||
.. code-block:: text | ||
# HELP napalm_logs_interface_up_total Multiprocess metric | ||
# TYPE napalm_logs_interface_up_total counter | ||
napalm_logs_interface_up_total{host="veos01",interface="Ethernet28"} 1.0 | ||
# HELP napalm_logs_interface_down_total Multiprocess metric | ||
# TYPE napalm_logs_interface_down_total counter | ||
napalm_logs_interface_down_total{host="veos01",interface="Ethernet28"} 1.0 | ||
# HELP napalm_logs_isis_neighbor_down_total Multiprocess metric | ||
# TYPE napalm_logs_isis_neighbor_down_total counter | ||
napalm_logs_isis_neighbor_down_total{host="HOSTNAME",interface="et7",level="L1",neighbor="1920.0000.2006"} 1.0 | ||
# HELP napalm_logs_bgp_neighbor_state_changed_total Multiprocess metric | ||
# TYPE napalm_logs_bgp_neighbor_state_changed_total counter | ||
napalm_logs_bgp_neighbor_state_changed_total{current_state="IDLE",host="HOSTNAME",neighbor="192.0.2.2",peer_as="12345",previous_state="ESTABLISHED"} 1.0 | ||
# HELP napalm_logs_agent_initialized_total Multiprocess metric | ||
# TYPE napalm_logs_agent_initialized_total counter | ||
napalm_logs_agent_initialized_total{host="edge01.bru01"} 1.0 | ||
# HELP napalm_logs_interface_mac_limit_reached Multiprocess metric | ||
# TYPE napalm_logs_interface_mac_limit_reached gauge | ||
napalm_logs_interface_mac_limit_reached{host="vmx01",interface="ge-1/0/23.0",pid="15711"} 3.0 |
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 |
---|---|---|
@@ -1,9 +1,6 @@ | ||
-r ../requirements.txt | ||
jinja2 | ||
pyzmq | ||
pyyaml | ||
pynacl | ||
u-msgpack-python | ||
sphinx | ||
sphinx-rtd-theme | ||
sphinxcontrib-napoleon | ||
prometheus_client |
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
Oops, something went wrong.