TECHZEN Zenoss User Community ARCHIVE  

Import event classes, mappings and transforms via zendmd

Subject: Import event classes, mappings and transforms via zendmd
Author: Jad Baz
Posted: 2018-11-23 06:24

This article explains how to list event transforms and mappings.

I have a Zenoss 4 instance that has more than 200 configured classes and mappings.
It will be a very strenuous (and error-prone) process to manually add them.

Any idea if I can do this via zendmd?
I couldn't find any resources on the matter.

Thank you

------------------------------
Jad
------------------------------


Subject: RE: Import event classes, mappings and transforms via zendmd
Author: Jane Curry
Posted: 2018-11-24 07:17

You could create a migration ZenPack and add your configured event classes to that.  You can do this through the GUI - no need to do any programming.

Cheers,
Jane

------------------------------
Jane Curry
Skills 1st United Kingdom
jane.curry@skills-1st.co.uk
------------------------------


Subject: RE: Import event classes, mappings and transforms via zendmd
Author: Jad Baz
Posted: 2018-11-25 17:11

Sorry, I meant to say Zenoss 4 instance that I want to migrate from to a Zenoss 6 instance.
Once I do that, I want to migrate between several Zenoss 6 instances. (this is more of a priority actually)
The ZenPack guide doesn't seem to contain anything about event mappings specifically.

Moreover, I'm not sure I understand exactly what a "migration ZenPack" is.

I know in Zenoss 6 I can just do a backup of the entire serviced volume but I'm not sure I want to do that, it's too big and I can't inspect it or easily change it. If I miss something in my dev config, I will have to make another 2GB+ backup.

------------------------------
Jad
------------------------------


Subject: RE: Import event classes, mappings and transforms via zendmd
Author: Laurent Hemeryck
Posted: 2018-11-26 07:26

Hello, 

You can easily create a ZenPack from the GUI. To get more info about this, you can consult Jane's doc : https://www.skills-1st.co.uk/papers/jane/zenpacks/zenpacks.pdf

The method is to create a new ZenPack and from the GUI adding the objects that you need. In your case, you would add the event classes that you need to migrate and one by one add them to your new ZenPack. The next step would be to test your ZenPack in a new environment and install it to check that your data had been exported correctly. 
However, from my experience, because I needed to follow the same path as yours, I noticed the following issues: 
- The ZenPack may never be removed because all objects (event classes) are bound to your ZenPack. If you remove the ZenPack, you will remove all your custom event classes. 
- For a migration, it doesn't provide a clean documentation of your migrated objects. The way you handle the ZenPack is a bit like a garbage bin where you throw everything in and dump it on a new Zenoss instance. And it's not that easy to retrieve and read the objects.
- The GUI method is skipping some fields, at least in my case. When pushing an event class into a ZenPack, some attributes are missing. If I remember correctly, the transform data is omitted. So, this wouldn't help you, but I would check on your own instance. 

My own solution was to write a script that parses the event classes and dump all information in a YAML-formatted file which can be included in a ZenPack. This provides you with a readable documentation and you have total control on the exported attributes. You can easily edit the YAML file, if needed. You can finally also run the same script on several Zenoss instances in order to compare the output. 

Cheers,

Laurent

------------------------------
Laurent Hemeryck
------------------------------


Subject: RE: Import event classes, mappings and transforms via zendmd
Author: Laurent Hemeryck
Posted: 2018-11-26 09:15

Here is the script I was talking about. Please consider it as a draft. Any feedback is welcome. 
You have to run it on your Zenoss server, as the zenoss user. 


------------------------------
Laurent Hemeryck
------------------------------


Subject: RE: Import event classes, mappings and transforms via zendmd
Author: Jad Baz
Posted: 2018-11-26 09:45

Thank you Laurent.

Do you have the script to import them?
Or is there something I'm missing perhaps

------------------------------
Jad
------------------------------


Subject: RE: Import event classes, mappings and transforms via zendmd
Author: Jad Baz
Posted: 2018-11-27 02:48

Just specifying that I meant that your script only does the export.
Do you have any way to import?

------------------------------
Jad
------------------------------


Subject: RE: Import event classes, mappings and transforms via zendmd
Author: Laurent Hemeryck
Posted: 2018-11-29 02:31

As (shortly) explained above, you have to include the YAML export into a new ZenPack you have to create. 
Follow the instructions here: 
https://zenpack-sdk.zenoss.com/en/latest/development-environment.html
Afterward, launch the following: 
zenpacklib --create ZenPacks.acme.migration

Then place the YAML file under ZenPacks.acme.migration/ZenPacks/acme/migration and install the Zenpack.

------------------------------
Laurent Hemeryck
Monitoring Engineer
FedNot
------------------------------


Subject: RE: Import event classes, mappings and transforms via zendmd
Author: Jad Baz
Posted: 2018-11-30 09:56

It worked!
Thanks :)

------------------------------
Jad
------------------------------


< Previous
Fortigate Firewall
  Next
Zenoss Shows Everything Down
>