Skip to content

Instantly share code, notes, and snippets.

@jstanley23
Last active March 30, 2018 12:33
Show Gist options
  • Select an option

  • Save jstanley23/4e45067624ecf50c5d4eab625ce1fa2f to your computer and use it in GitHub Desktop.

Select an option

Save jstanley23/4e45067624ecf50c5d4eab625ce1fa2f to your computer and use it in GitHub Desktop.
Mass Change Zenoss Serviced Pool
#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