Debian Codegraph @

docs/troubleshooting.md

raw symbols SCIP
1 ---
2 title: Troubleshooting ANTA
3 hide:
4 - tags
5 tags:
6 - Troubleshooting
7 ---
8
9 <!--
10 ~ Copyright (c) 2024-2026 Arista Networks, Inc.
11 ~ Use of this source code is governed by the Apache License 2.0
12 ~ that can be found in the LICENSE file.
13 -->
14
15 A couple of things to check when hitting an issue with ANTA:
16
17 <textarea hidden class="mermaid-zoom-source" data-title="Troubleshooting ANTA">
18 --8<-- "troubleshooting.mmd"
19 </textarea>
20
21 ```mermaid
22 --8<-- "troubleshooting.mmd"
23 ```
24
25 ## Capturing logs
26
27 To help document the issue in GitHub, it is important to capture some logs so the developers can understand what is affecting your system. No logs mean that the first question asked on the issue will probably be *"Can you share some logs please?"*.
28
29 ANTA provides very verbose logs when using the `DEBUG` level. When using DEBUG log level with a log file, the DEBUG logging level is not sent to stdout, but only to the file.
30
31 !!! warning
32 On real deployments, do not use DEBUG logging level without setting a log file at the same time.
33
34 To save the logs to a file called `anta.log`, use the following flags:
35
36 ```bash
37 # Where ANTA_COMMAND is one of nrfu, debug, get, exec, check
38 anta -l DEBUG --log-file anta.log <ANTA_COMMAND>
39 ```
40
41 See `anta --help` for more information. These have to precede the `nrfu` cmd.
42
43 !!! tip
44 Remember that in ANTA, each level of command has its own options and they can only be set at this level.
45 so the `-l` and `--log-file` MUST be between `anta` and the `ANTA_COMMAND`.
46 similarly, all the `nrfu` options MUST be set between the `nrfu` and the `ANTA_NRFU_SUBCOMMAND` (`json`, `text`, `table` or `tpl-report`).
47
48 As an example, for the `nrfu` command, it would look like:
49
50 ```bash
51 anta -l DEBUG --log-file anta.log nrfu --enable --username username --password arista --inventory inventory.yml -c nrfu.yml text
52 ```
53
54 ### `ANTA_DEBUG` environment variable
55
56 !!! warning
57 Do not use this if you do not know why. This produces a lot of logs and can create confusion if you do not know what to look for.
58
59 The environment variable `ANTA_DEBUG=true` enables ANTA Debug Mode.
60
61 This flag is used by various functions in ANTA: when set to true, the function will display or log more information. In particular, when an Exception occurs in the code and this variable is set, the logging function used by ANTA is different to also produce the Python traceback for debugging. This typically needs to be done when opening a GitHub issue and an Exception is seen at runtime.
62
63 Example:
64
65 ```bash
66 ANTA_DEBUG=true anta -l DEBUG --log-file anta.log nrfu --enable --username username --password arista --inventory inventory.yml -c nrfu.yml text
67 ```
68
69 ### Troubleshooting on EOS
70
71 ANTA is using a specific ID in eAPI requests towards EOS. This allows for easier eAPI requests debugging on the device using EOS configuration `trace CapiApp setting UwsgiRequestContext/4,CapiUwsgiServer/4` to set up CapiApp agent logs.
72
73 Then, you can view agent logs using:
74
75 ```bash
76 bash tail -f /var/log/agents/CapiApp-*
77
78 2024-05-15 15:32:54.056166 1429 UwsgiRequestContext 4 request content b'{"jsonrpc": "2.0", "method": "runCmds", "params": {"version": "latest", "cmds": [{"cmd": "show ip route vrf default 10.255.0.3", "revision": 4}], "format": "json", "autoComplete": false, "expandAliases": false}, "id": "ANTA-VerifyRoutingTableEntry-132366530677328"}'
79 ```