-
Notifications
You must be signed in to change notification settings - Fork 26
Control Center Tips and Tricks
Check your installed serviced and zenoss version:
rpm -qa | egrep 'serviced|zenoss' # for CentOS/RHEL (YUM)
dpkg --list | egrep 'serviced|zenoss' # for Ubuntu (APT)
A useful JSON utility:
https://stedolan.github.io/jq/
Run docker commands directly (without sudo) by adding your user account to the Docker group.
sudo usermod -a -G docker $USER
Find the TCP port where the Zenoss web service is listening:
sudo docker ps | awk '/8080/{ print $1 }' | xargs docker inspect \
| python -c "import json, sys; print json.load(sys.stdin)[0]['HostConfig']['PortBindings']['8080/tcp'][0]['HostPort']"
Remove all unneeded docker images and containers before starting serviced, version Phil:
docker ps -q | xargs docker stop
docker ps -qa | xargs docker rm -fv
docker images |awk '/:5000/{print $1 ":" $2}' | xargs docker rmi
Remove unneeded docker images, version Ian:
docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs docker rm
docker images | grep "<none>" | awk '{print $3}' | xargs docker rmi
Attach to isvcs zookeeper container:
dockerid=$(docker ps --no-trunc | awk '/>2181\/tcp/{print $1;exit}'); echo $dockerid
docker exec -it $dockerid bash
Start a shell in an existing/running service, i.e. Zope:
sudo serviced service shell -i zope /bin/bash
Tail (and follow) the container log of first running Zope service:
serviced service logs zope/0 -- -f
Tail (and follow) the event log of first running Zope service:
serviced service attach zope/0 tail -F /opt/zenoss/log/event.log
Start a new container to run zendmd:
serviced service run -i zope zendmd
Run zensendevent - attach to zenhub to run zensendevent
serviced service attach zenhub
zensendevent ...
Attach to an HBase regionserver container:
serviced service attach regionserver-1
Attach to the first zope instance:
serviced service attach zope/0
Show status of zopes:
serviced service status zope
What service is port XXXXX associated with?
docker ps --no-trunc | grep XXXXX
Attach to the first container with 2181/tcp port mapped:
dockerid=$(docker ps --no-trunc | awk '/>2181\/tcp/{print $1;exit}'); echo $dockerid
docker exec -it $dockerid bash
zendmd with zendev:
zendev serviced -dx
serviced service start mariadb # for core
serviced service start mariadb-model # for resmgr 5.0.1 and beyond
serviced service start mariadb-events # for resmgr 5.0.1 and beyond
serviced service start zope
zendev devshell zendmd
zenpack install with zendev:
zendev serviced -dx
serviced service start mariadb # for core
serviced service start mariadb-model # for resmgr 5.0.1 and beyond
serviced service start mariadb-events # for resmgr 5.0.1 and beyond
for svc in zope /redis rabbitmq zeneventserver; do serviced service start $svc; done
serviced service list | grep zencatalogservice && serviced service start zencatalogservice
watch serviced service status # wait for those services to start
zendev devshell zenpack --link --install /mnt/src/enterprise_zenpacks/ZenPacks.zenoss.Licensing
zendev devshell zenpack --list
serviced service restart zenoss.core
impact install with zendev: https://intranet.zenoss.com/docs/DOC-6081
runtest with zendev:
zendev serviced -dx
serviced service start mariadb # for core
serviced service start mariadb-model # for resmgr 5.0.1 and beyond
serviced service start mariadb-events # for resmgr 5.0.1 and beyond
for svc in zope /redis rabbitmq zeneventserver; do serviced service start $svc; done
serviced service list | grep zencatalogservice && serviced service start zencatalogservice
watch serviced service status # wait for those services to start
zendev devshell runtest
compile and install zep core:
zendev devshell --docker
cd /mnt/src/zep
mvn clean
mvn -DskipTests=true install && tar -xvzf dist/target/zep-dist-*-SNAPSHOT.tar.gz -C /opt/zenoss
easy snmpd device with zendev:
============= first terminal - start snmpd and walk localhost:
# plu@plu-9: zendev devshell -d
Welcome to the Zenoss Dev Shell!
(zenoss)[zenoss@5546215ff848 zenoss]$ sudo snmpd
(zenoss)[zenoss@5546215ff848 zenoss]$ snmpwalk -v 1 -c public localhost .1.3.6.1.2.1.1.1.0
SNMPv2-MIB::sysDescr.0 = STRING: Linux 5546215ff848 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64
(zenoss)[zenoss@fbb2d5040690 zenoss]$ ip addr |grep 172
inet 172.17.0.30/16 scope global eth0
============= second terminal - snmpwalk first devshell:
# plu@plu-9: zendev devshell -d
Welcome to the Zenoss Dev Shell!
(zenoss)[zenoss@614f1e92116b zenoss]$ snmpwalk -v 1 -c public 172.17.0.30 .1.3.6.1.2.1.1.1.0
SNMPv2-MIB::sysDescr.0 = STRING: Linux fbb2d5040690 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64
(zenoss)[zenoss@614f1e92116b zenoss]$ ip addr |grep 172
inet 172.17.0.32/16 scope global eth0
To attach to the zookeeper isvc container:
docker exec -it serviced-isvcs_zookeeper bash
docker ps |grep isvcs # shows you the names of other serviced isvcs
To reset rabbit queues (and lose inflight queue), remove rabbitmq from DFS on MASTER:
serviced service status rabbitmq # RABBIT_TENANT_ID is ID next to Zenoss.core or Zenoss.resmgr
serviced service stop rabbitmq # stop rabbit
rm -fr /opt/serviced/var/volumes/RABBIT_TENANT_ID/rabbitmq
serviced service start rabbitmq # start rabbit
To downgrade from docker 1.4 to docker 1.3.3:
sudo stop docker
sudo reboot
sudo stop docker
sudo rm -fr /var/lib/docker
sudo apt-get remove lxc-docker
sudo apt-get purge lxc-docker-1.4.0
sudo apt-get install lxc-docker-1.3.3
To add this extra space to your instance you type:
- sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=15360
- sudo /sbin/mkswap /var/swap.1
- sudo /sbin/swapon /var/swap.1
If you need more than 16GB then change that to something higher.
To enable it by default after reboot, add this line to /etc/fstab:
- /var/swap.1 swap swap defaults 0 0
Example:
serviced service attach zope/0
(enter password)
su - zenoss
zenmodeler run -d zdouglas-tb1 -v10 1> output.txt 2>&1
You can then exit the container and look for the file - NOTE: Be sure to look on the file system of the correct host if you are on multihost install.
find . -name "output.txt" (you can switch to /var and then search it's faster)
It will be in a folder like this:
/var/lib/docker/vfs/dir/a274d524389af1d2d9e947b54f6148dcce3fc6d329328c88eb5c1dd21001e41a#/output.txt
You may wish to copy the file from there to /tmp to make it easier to get out of Linux to Windows if needed.
Then use winscp or similar to copy the file from /tmp to windows if needed to attach to bug.
####Search elastic-search from the commandline:
requires java
https://github.com/elasticsearch/es2unix
es -u host://localhost:9100 search 'Traceback'
####Access MariaDB from its container:
serviced service attach mariadb su - zenoss # for core
serviced service attach mariadb-events su - zenoss # for resmgr 5.0.1 and beyond
export TERM=screen
mysql -u root
use zenoss_zep;
serviced service start mariadb-model # for resmgr 5.0.1 and beyond
export TERM=screen
mysql -u root
use zodb;
Display a list of running containers, sorted by amount of resident memory:
for line in `docker ps | awk '{print $1}' | grep -v CONTAINER`; do \
echo $(( `cat /sys/fs/cgroup/memory/docker/$line*/memory.usage_in_bytes` / 1024 / 1024 ))MB \
$(docker ps | grep $line | awk '{printf $NF" "}') ; \
done | sort -n
Display the amount of disk space each container is using:
for d in `docker ps | awk '{print $1}' | tail -n +2`; do
d_name=`docker inspect -f {{.Name}} $d`
echo "========================================================="
echo "$d_name ($d) container size:"
sudo du --max-depth 2 -h /var/lib/docker/devicemapper | grep `docker inspect -f "{{.Id}}" $d`
echo "$d_name ($d) volumes:"
for mount in `docker inspect -f "{{range .Mounts}} {{.Source}}:{{.Destination}}
{{end}}" $d`; do
size=`echo $mount | cut -d':' -f1 | sudo xargs du -d 0 -h`
mnt=`echo $mount | cut -d':' -f2`
echo "$size mounted on $mnt"
done
done