Hello,

You're definitely on the right track by loading objects into Zenoss using XML using zenload. It sounds like you have a working script but need some sort of mapping to complete it. First of all, nice work. Now, let's get you some help...

Specifically, you mentioned nagios timeperiods, services, and contacts. I believe these objects would map to Zenoss users, alerting rules and windows. I've created these objects in Zenoss (testUser, testAlertingRule, testActivePeriod) and exported them to XML. The file attached will make it easier to map those cfgs to xml. I'm assuming you know what these Zenoss object do.

If there are other nagios objects you'd like to import let me know and we'll work together to map them to Zenoss objects. If you haven't already browsing the objects in zendmd can be really helpful in this type of development. You'll be able to use the .exportXml() method to see a valid xml representation for any object in Zenoss. For example, to generate the objects above I ran:

>>> dmd.ZenUsers.testUser.exportXml(open('testUser.xml', 'w'))

If you'd like to share your code with us just send it to myself of one of the devs here, so that we can take a look. Also, this would make a great topic for the dev list [EMAIL PROTECTED]

<object id='testUser' module='Products.ZenModel.UserSettings' class='UserSettings'>
<property type="string" id="email" mode="w" >
[EMAIL PROTECTED]
</property>
<property type="int" id="defaultPageSize" mode="w" >
40
</property>
<property type="int" id="defaultEventPageSize" mode="w" >
30
</property>
<property type="string" id="defaultAdminRole" mode="w" >
Administrator
</property>
<property type="int" id="defaultAdminLevel" mode="w" >
1
</property>
<property type="int" id="oncallStart" mode="w" >
0
</property>
<property type="int" id="oncallEnd" mode="w" >
0
</property>
<property type="int" id="escalationMinutes" mode="w" >
0
</property>
<property type="int" id="dashboardRefresh" mode="w" >
30
</property>
<property type="int" id="dashboardTimeout" mode="w" >
25
</property>
<property type="string" id="dashboardOrganizer" mode="w" >
Devices
</property>
<tomany id='adminRoles'>
<link objid='/zport/dmd/Devices/Server/Windows/devices/testDevice/adminRoles/testUser'/>
</tomany>
<tomany id='adminRoles'>
<link objid='/zport/dmd/Devices/Server/Windows/devices/testDevice/adminRoles/testUser'/>
</tomany>
<object id='testAlertingRule' module='Products.ZenEvents.ActionRule' class='ActionRule'>
<property type="text" id="where" mode="w" >
severity &gt;= 4 and eventState = 0 and prodState = 1000
</property>
<property type="text" id="format" mode="w" >
[zenoss] %(device)s %(summary)s
</property>
<property type="text" id="body" mode="w" >
Device: %(device)s
Component: %(component)s
Severity: %(severityString)s
Time: %(firstTime)s
Message:
%(message)s
&lt;a href="%(eventUrl)s"&gt;Event Detail&lt;/a&gt;
&lt;a href="%(ackUrl)s"&gt;Acknowledge&lt;/a&gt;
&lt;a href="%(deleteUrl)s"&gt;Delete&lt;/a&gt;
&lt;a href="%(eventsUrl)s"&gt;Device Events&lt;/a&gt;

</property>
<property type="text" id="clearFormat" mode="w" >
[zenoss] CLEAR: %(device)s %(clearOrEventSummary)s
</property>
<property type="text" id="clearBody" mode="w" >
Event: '%(summary)s'
Cleared by: '%(clearSummary)s'
At: %(clearFirstTime)s
Device: %(device)s
Component: %(component)s
Severity: %(severityString)s
Message:
%(message)s

</property>
<property type="int" id="delay" mode="w" >
0
</property>
<property select_variable="actionTypes" type="selection" id="action" mode="w" >
email
</property>
<property type="boolean" id="enabled" mode="w" >
False
</property>
<tomanycont id='windows'>
<object id='testActivePeriod' module='Products.ZenEvents.ActionRuleWindow' class='ActionRuleWindow'>
<property type="int" id="start" mode="w" >
1183400700.0
</property>
<property type="int" id="started" mode="w" >
None
</property>
<property type="int" id="duration" mode="w" >
60
</property>
<property type="string" id="repeat" mode="w" >
Never
</property>
<property type="int" id="skip" mode="w" >
1
</property>
</object>
</tomanycont>
</object>
</object>

Marc Irlandez

On Jun 29, 2007, at 11:50 AM, kpg123 wrote:

I've put together a rough python script to convert Nagios configuration files into XML (read as "It seems to work for the configuration that I have -- and it passes through xmllint too!" :). I notice that ticket http://dev.zenoss.org/trac/ticket/ 1117 notes that the XML schema will be documented in the 2.1 release, but I'm hoping to cheat a little and see if I can get some more info before that time. :)

The idea is that it would be a three step process to make it easy to migrate from Nagios to Zenoss:

1. Use the script to read the nagios.cfg file (which reads subfiles) and create an XML which is close enough to generate a 1:1 mapping.

2. Use xsltproc to convert the generated Nagios XML into something more palatable for Zenoss to import.

   3. Use zenload to read the converted XML.

First of all, where/how should I submit the python script to convert Nagios configuration files to XML?

I've also created a sample XSLT to convert the generated XML into something a little more like the Zenoss XML object/property style, but I really have no clue about how to do anything useful. Ideally, I'd like to see if I can get the timeperiods, services, and contacts into an importable XML format.

Next, I'd like to get some feedback to this idea and see if there's something built-in that I've missed (Doh!) or if there's a better way to handle this scenario.

Thanks in advance!




-------------------- m2f --------------------

Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=8214#8214

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to