Not able to remove ZenPack – Zenoss 5

Ran into an issue where I was not able to list the installed ZenPacks and Zenoss was having issues starting. I think it was due to a ZenPack having issues and not being installed properly.

Drop into the container

serviced service shell -i -s FixZenpack zope bash

Change user and cd to ZenPack directory

su zenoss
cd /opt/zenoss/ZenPacks

Once there, remove the offending ZenPack. Replace ZENPACK.egg with the ZenPack

rm -rf ./ZENPACK.egg

Example:

rm -rf ./ZenPacks.zenoss.MikroTik-1.1.1.egg

Exit out of the container.

exit
exit

You can also hit ctrl+d twice.
Commit the Container

 serviced service shell -i -s FixZen zope bash

Restart the Zenoss.Core Service

service service restart Zenoss.Core

How To remove a ZenPack from Zenoss 5

To remove a ZenPack on Zenoss 5.1 and later, you are going to need to stop the zenoss services, restart a couple services that are needed to install the ZenPack, install the ZenPack, and then restart the Zenoss service.

Stop Zenoss.Core

serviced service stop Zenoss.Core

Make sure the service is stopped by running the following command.  When it reports back the Zenoss is Stopped, then continue.

 if ( serviced service status Zenoss.Core | awk '{print $3}' | grep -q Stopped) ; then echo "Zenoss is not running!" ; else echo "Zenoss is not Stopped!" ; fi

Or you can run this command, just make sure it says it is stopped.

serviced service status zenoss.core

Create a Snapshot

serviced service snapshot Zenoss.core

Start the following three services

serviced service start Infrastructure
zeneventserver
Zope

serviced service start Infrastructure
serviced service start zeneventserver
serviced service start Zope

List the ZenPacks that are currently installed.

serviced service run zope zenpack list

Remove the ZenPack.  Replace “ZenPack.comunity.Zenpack” with the zenpack name from the previous command.

serviced service run zope zenpack-manager uninstall ZenPack.community.Zenpack

How to Install ZenPack on Zenoss 5.1

To install a ZenPack on Zenoss 5.1 and later, you are going to need to stop the zenoss services, restart a couple services that are needed to install the ZenPack, install the ZenPack, and then restart the Zenoss service.

Stop Zenoss.Core :

serviced service stop 

Make sure the service is stopped by running the following command.  When it reports back the Zenoss is Stopped, then continue.

 if ( serviced service status Zenoss.Core | awk '{print $3}' | grep -q Stopped) ; then echo "Zenoss is not running!" ; else echo "Zenoss is not Stopped!" ; fi

Or you can run this command, just make sure it says it is stopped.

serviced service status zenoss.core

Create a Snapshot

serviced service snapshot Zenoss.core

Start the following three services

serviced service start Infrastructure
zeneventserver
Zope


serviced service start Infrastructure
serviced service start zeneventserver
serviced service start Zope

Change directory to tmp, make sure you put the zenpack in /tmp

cd /tmp

Install the Zenpack

serviced service run zope zenpack-manager install *.egg

Example:

serviced service run zope zenpack-manager install ZenPacks.zenoss.MikroTik-1.1.1.egg

Restart the Zenoss Service

serviced service restart zenoss.core

Log into Zenoss and check it.

How to Install a ZenPack in Zenoss 5

Log into your Zenoss server via ssh.

ssh root@zenossserver

Create working direcotry

 mkdir /tmp/zenpack && cd /tmp/zenpack/

Now upload the ZenPack to “/tmp/zenpack/” on your Zenoss server with your favorite ftp tool.

Stop the Zenoss service

serviced service stop zenoss.core

Restart the services needed to import the ZenPack i.e. the following.

ZooKeeper
mariadb
RabbitMQ
redis
zeneventserver
Zope

You can start all of them with the following commands

serviced service start ZooKeeper
serviced service start mariadb 
serviced service start RabbitMQ
serviced service start redis
serviced service start zeneventserver 
serviced service start Zope

Install ZenPack with the following command

serviced service run zope zenpack install ZenPack.xxx.xxx.egg

Restart Zenoss

serviced service restart zenoss.core

Log into Zenoss and make sure that it is working right.