Last active
March 30, 2018 12:33
-
-
Save jstanley23/4e45067624ecf50c5d4eab625ce1fa2f to your computer and use it in GitHub Desktop.
Mass Change Zenoss Serviced Pool
This file contains hidden or 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
| #1. Get a list of the serviced ids you want to edit itno a temp file called "to_rename", one per line. | |
| #2. Create a script to do the edit you want with sed e.g. | |
| #4. Then edit the services using that script | |
| #5. e.g.: for i in cat to_rename; do EDITOR=./movepool serviced service edit $i; done | |
| # movepool.sh example | |
| #!/bin/bash | |
| sed -i -e 's/\"PoolID\": \"Prod_.*\",/\"PoolID\": \"resmgr\",/' "$1" | |
| # bash command example | |
| serviced service list --show-fields ServiceID > resmgr_services.txt | |
| for i in $(cat resmgr_services.txt); do echo $i; EDITOR=./move_pool.sh serviced service edit $i; done | |
| for i in $(serviced service list --show-fields=ServiceID); do EDITOR=./move_pool.sh serviced service edit $i; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment