Find Cisco 9800 CLI commands

I recently came across someone looking for a specific Cisco 9800 controller CLI command as doing it hundreds of times in the webinterface is too tedious, but the one that sounded right was not working as intended.

If you ever find yourself in this position, there is a really neat trick to find any CLI command to a function in the web interface, which is especially helpful for commands, that are not stored in the running config - like any AP configuration.

Everything done in the webinterface is done on the CLI, so by catching what is sent to the CLI, we can see what commands we need to replicate it. We can use our old friend, the eem script for that. There are certainly other possibilities, but this works out of the box with just a few lines.

If you put this script into your config

event manager applet CLIcatcher
 event cli pattern ".*" sync no skip no
 action 1.0 syslog priority informational msg "$_cli_msg"
 action 2.0 set _exit_status "1"

everything done on CLI will be sent to the log, and because the logging buffers are usually not very deep, sent to your syslog/graylog/splunk or whatever.

So if you’re wondering what data is pulled for the dashboard after logging in, you can just search in the log for “CLIcatcher” and see the whole slew of data that gets pulled:

...
2025-01-26T14:09:20+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show clock
2025-01-26T14:09:20+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show redundancy states
2025-01-26T14:09:21+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show wireless client device count
2025-01-26T14:09:21+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: dir bootflash:
2025-01-26T14:09:22+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show redundancy
2025-01-26T14:09:22+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show license all
2025-01-26T14:09:22+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show platform resources
2025-01-26T14:09:22+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show platform resources hidden chassis active qfp tcam
2025-01-26T14:09:22+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show platform resources hidden chassis active qfp exmem DRAM
2025-01-26T14:09:22+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show platform resources hidden chassis active qfp exmem IRAM
2025-01-26T14:09:22+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show platform resources hidden chassis active qfp cpu
2025-01-26T14:09:22+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show platform resources hidden chassis active qfp packet-buffer-memory
2025-01-26T14:09:22+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show license summary
2025-01-26T14:09:22+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show license tech support
2025-01-26T14:09:23+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show running-config partition common
2025-01-26T14:09:25+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: show platform software status control-processor brief
...

And if you’re changing AP settings (again, which are not in the running config), like TX power and antenna gain:

2025-01-26T14:12:33+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: ap name APM20306 dot11 5ghz slot 1 antenna ext-ant-gain 4
2025-01-26T14:12:33+01:00 C9800 %HA_EM-6-LOG: CLIcatcher: ap name APM20306 dot11 5ghz slot 1 txpower 2

Now I did find some that do not trigger a CLI command, so the coverage is probably not 100%. But it does help to find a command really quick sometimes.