Wednesday, August 28, 2019

Cisco DNA list and restart all Maglev services

List the services:

magctl appstack status

Limit the search to just the maglev services

magctl appstack status | grep "maglev-system"

remove the Maglev service (docker containers) and restart them

for svc in $(magctl appstack status | grep "maglev-system" | awk '{print $2}'); do magctl service restart -d $svc; done


Tuesday, August 20, 2019

Cisco DNA Center Maglev (CLI) Commands for package management

" Uninstall stalled packages 

for pkg in $(maglev package status -o json | jq -r '.[] | select(.available!="-") | [ .name,.available | tostring ] | join (":")'); do maglev catalog package delete $pkg 2>/dev/null; done

" List stalled install packages

maglev package status -o json | jq -r '.[] | select(.available!="-") | [ .name,.available | tostring ] | join (":")'

" Check system update status

maglev system_updater update_info

" list packages

maglev catalog package status system:1.1.0.784
or
maglev catalog packages display

" Forcefully exit maintenance mode

maglev maintenance disable

" Manually download a package

maglev catalog package pull <name>:<version>

" Forcefully download a package

maglev catalog package pull <name>:<version> --force

" Force package install (IE: system)

maglev package upgrade --force system:1.2.0.998

" Undeploy (uninstall) a package

maglev  package undeploy --force assurance

" List just the installing packages (it's convuluted but makes the output pretty)

maglev catalog package display | grep -v pulled | grep PARTIAL | sed 's/    */,/g' | sed -r 's/\s+//g'  | column -s, -t | sort -k6 | grep =


src: https://community.cisco.com/t5/cisco-digital-network/failed-to-upgrade-cisco-dna-center-from-version-1-2-6-to-1-2-10/td-p/3838655

So I have also faced issues during most of my DNAC upgrades I have gone through. You may want to check with your Cisco rep on whether or not you can move
from 1.2.6 to 1.2.10. Pretty sure there is a 1.2.6 patch that needs to be applied (1.1.0.659.1), then move to 1.2.8 prior to 1.2.10. Here are some very

helpful troubleshooting tips you can use:


$ sudo maglev system_updater update_info --Shows status of upgrade via CLI
$ magctl service logs -rf system-updater --Tail logs during upgrade to monitor status
$ magctl service logs -r system-updater > system_updater.log --Identify which host in your cluster failed installing host components
$ sudo journalctl -u maglev-node-updater -f --Tail updater log in real-time
$ maglev system_updater update_system 1.1.0.659.1 -f --Force an upgrade via CLI

Remember to download and install the application packages once a good upgrade has occurred prior to performing another upgrade.


When upgrading to Cisco DNA Center 1.2.10 or below, run this command as maglev SSH until it comes back “clean”, that is, empty.
watch -n 30 "magctl appstack status |  grep -v -E '([0-9]+)/\1.*Running'"