Skip navigation
0

Transforms based on time

Posted by Ryan Matte Mar 16, 2010

I wrote a new guide titled transforms based on time which can be viewed here: http://community.zenoss.org/docs/DOC-5822

 

It explains how to perform actions based on the current time (for example, perhaps you want to drop an event between 3am and 4am).

0

This guide explains how to patch the following bug:

 

http://dev.zenoss.org/trac/ticket/5473

 

I have only tested this patch on 2.4.5, so I would advise upgrading to this version before applying it.  I don't believe the bug exists prior to this version anyways.

 

On the Zenoss system, become the zenoss user then execute the following commands:

 

zenpatch 15214 && sleep 1 && zenoss stop && sleep 3 && zenoss start

 

zendmd
>>> dmd.Manufacturers.productSearch.reIndex()
>>> commit()

 

Press CTRL-D to exit zendmd.

 

Once these steps are completed your Zenoss 2.4.5 installation will be patched and you should once again be able to manually set hardware and software product info for devices.

 

If you have any questions feel free to contact me.

0

There is now a patch available to resolve this issue.  The steps to patch your Zenoss 2.4.5 installation are available here: http://community.zenoss.org/blogs/ryanmatte/2009/09/28/patching-hardwaresoftware-info-bug-trac-ticket-5473

 

Ok, so as you're most likely aware (if you've come across this blog entry), there is a bug which is affecting the ability to manually specify hardware and software product info for devices from the Edit tab.


I have a ticket open for this bug: http://dev.zenoss.org/trac/ticket/5473


In the mean time, I'm sure that many of you are becoming quite frustrated with this (as I was).  What I'll first do is lay down the symptoms of the bug (what sorts of issues it causes).  I will then explain a workaround which I have found for this until the bug is fixed.


Symptoms:


1. When you set software or product info for a device on the edit tab (by hand) and then click save, some dropdown fields will no longer contain the data which they had before (though if you navigate directly to the Device's status page afterwards you will notice that the values have been set for the device).


2.  When you set hardware or software product values for a device the product model dissapears from the dropdown list when trying to set it for another device (yet it still appears in the Products section).


3. After it has dissapeared from the product model dropdown you will no longer be able to model a device and have it automatically detect the model via SNMP for devices with that particular model.


Workaround:


1. If some hardware or software product models are not displayed in the dropdown, navigate to the Products section and click on each product model.  Modify something (add something to a field), save it, then remove what you added previously and save it again.  You should now see it in the product models dropdown.  Make sure that there is a proper SNMP product OID associated with it as well.


2.  Also, make sure that there are no other entries with that SNMP string in the list.  Check the particular product class for the device (such as Cisco) as well as the Unknown product class.


Now that it shows up properly in the dropdown, and has an SNMP product OID associated with it, we can proceed with the next step.


3. Navigate to a device's edit page.  Set the product and software dropdowns to the blank entry (empty) and click save.


4. From the device page, select Manage -> Model Device from the dropdown menu.


5.  After the device is remodeled check the status page.  The proper hardware and software info should now be displayed.


Do not attempt to set the hardware or software product info by hand until this bug is resolved as it will cause the product items to disappear from the dropdowns on the device edit tab.  You will then have to repeat step 1 for these items.  Automatically discovering the product info via SNMP does not result in this issue.

3

If you navigate to Reports -> Performance Reports and run the CPU Utilization report, or Memory Utilization report (for example), you may notice that there is limited/no data for devices which you have developed custom templates for.

 

You can modify report plugins to use datapoints from your templates.

 

Examples:

 

I have device templates that I created to monitor performance on certain devices.  The values were not represented in the report, and instead I was simply seeing "N/A" for all values of these devices.

 

One is a template to monitor Windows devices via SNMP where the percentage of CPU in use is represented by the datapoint "Total" and the percentage of memory in use is represented by the datapoint "PercentMemoryUsed".

 

Another template is a template to monitor Cisco routers and switches where the CPU usage is represented by a datapoint called "cpu5min" and memory usage is represented by datapoints called "mem5minFree" and "mem5minUsed".

 

CPU:

 

I edited $ZENHOME/Products/ZenReports/plugins/cpu.py

 

After lines:

 

if cpuPercent is None:

    cpuPercent = d.getRRDValue('cpuPercentProcessorTime', **summary)

 

I added:

 

if cpuPercent is None:

    cpuPercent = d.getRRDValue('cpu5min', **summary)

 

if cpuPercent is None:

    cpuPercent = d.getRRDValue('Total', **summary)

 

Memory:

 

I edited $ZENHOME/Products/ZenReports/plugins/memory.py

 

After lines:

 

percentUsed = None

if totalReal and free:

    percentUsed = Utils.percent(totalReal - free, totalReal)

 

I added:

 

if percentUsed is None:

    percentUsed = d.getRRDValue('PercentMemoryUsed', **summary)

 

if percentUsed is None:

    CiscoMemFree = d.getRRDValue('mem5minFree', **summary)

    CiscoMemUsed = d.getRRDValue('mem5minUsed', **summary)

    if CiscoMemFree and CiscoMemUsed:

        percentUsed = round((CiscoMemUsed/(CiscoMemUsed + CiscoMemFree))*100.0)

 

After any modification is made to a report plugin you should restart Zope by executing "zopectl restart" as the zenoss user.  In some rare cases restarting Zope can cause Zenoss to stop responding.  If this happens simply restart Zenoss by executing "zenoss stop", wait a few seconds, then "zenoss start".

1

Note: these are now available as a Zenpack at  http://community.zenoss.org/docs/DOC-3404

 

This guide provides step by step instructions for installing all Cisco Mibs in to Zenoss.  This method was derived from hours of research and testing.  I have attempted to explain the necessity of each step as best I can.  Please feel free to  contact  me if you have any questions about any of the steps in this process.

 

Please note that the steps in this guide should be performed as the zenoss user.

 

1.  Download my modified Cisco Mibs pack by clicking here.

 

This Mibs pack is a mix of Mibs found in the following:

 

ftp://ftp-sj.cisco.com/pub/mibs/v1/v1.tar.gz

ftp://ftp-sj.cisco.com/pub/mibs/v2/v2.tar.gz

 

I have modified about 10 of the Mibs files so that they work in Zenoss.  Details of the errors which I encountered and what was changed in each file are provided below.  I have also included a list of Mibs that would not load before these modifications were made.  This is only for reference in case you are curious as to what modifications were made.   You can safely skip to step 2 from here if you wish.

 

List of Mibs that would not load:

 

ACTONA-ACTASTOR-MIB-V1SMI.my

CISCO-CIDS-MIB.my

CISCO-CIDS-MIB-V1SMI.my

CISCO-CLASS-BASED-QOS-MIB.my

CISCO-CLASS-BASED-QOS-MIB-V1SMI.my

CISCO-CONFIG-MAN-MIB.my

CISCO-CONFIG-MAN-MIB-V1SMI.my

CISCO-IF-EXTENSION-MIB.my

CISCO-IF-EXTENSION-MIB-V1SMI.my

CISCO-ISNS-IP-NW-DISCOVERY-MIB-V1SMI.my

CISCO-QOS-PIB-MIB.my

CISCO-REMOTE-ACCESS-MONITOR-MIB-V1SMI.my

PerfHist-TC-MIB-V1SMI.my

SNMPv2-TC-V1SMI.my

 

Note: All other Mibs did load without modifications.

 

Errors that were encountered:

 

First of all, note that I made copies of SNMPv2-TC-V1SMI.my and SNMPv2-SMI-V1SMI.my.  I saved the copies as SNMPv2-TC-v1.my and SNMPv2-SMI-v1.my.  This is so that the Mib filenames were the same as the actual Mib name.  I did this because some other Mibs were having trouble finding these files by their original name.

 

I was encountering errors referencing 'Unsigned64' as Zenoss does not apparently support this function.  I ended up having to go in to CISCO-TC.my and delete any reference to Unsigned64.  I then had to go in to each file that would not load and change any instance of Unsigned64 that I found to Unsigned32.

 

I was also encountering errors referencing 'TimeTicks'.  I had to edit SNMPv2-TC-V1SMI.my and SNMPv2-TC-v1.my.

 

I changed:

 

IMPORTS

TimeTicks

FROM SNMPv2-SMI-v1;

 

to:

 

IMPORTS

TimeTicks

FROM RFC1155-SMI;

 

As SNMPv2-SMI-v1.my does not contain any reference to TimeTicks, but the RFC1155-SMI Mib does.

 

After these modifications were made I was able to finally get all of the Mibs to load in to Zenoss.

 

2.  Many of the Cisco Mibs depend on libsmi2.  You will need to install it on the server.  If you are using a copy of Ubuntu then you can simply type apt-get install libsmi2 libsmi2-common.  You can install this same package on other Linux distros via their respective package managers.  If the package is not available in your package manager then you can also install it from an RPM, or compile it from source.

 

3.  Next, you need to transfer cisco-mibs-zenoss.tar.gz to the server under /home/zenoss/mibs.  You then need to extract it by using the following command:

 

tar -xvzf cisco-mibs-zenoss.tar.gz

 

Once it is extracted there should be a folder with the path of /home/zenoss/mibs/mixed.  Once you have this folder created you are ready to proceed to the next step.

 

4.   You will need to set the SMIPATH environment variable to include all possible paths for the Mibs that get installed by default with Zenoss as well as the /home/zenoss/mibs/mixed directory that you just created.

 

Do this by issuing the following command:

 

export SMIPATH=/usr/local/zenoss/common/share/snmp/mibs/:/usr/local/zenoss/common/share/mibs/iana/:/usr/local/zenoss/common/share/mibs/ietf:/usr/local/zenoss/common/share/mibs/irtf:/usr/local/zenoss/common/share/mibs/site:/usr/local/zenoss/common/share/mibs/tubs:/home/zenoss/mibs/mixed

 

5.   Now we are ready to build up the first batch of Mibs.  During this process some Mibs will fail to load.  This is perfectly normal at this point so simply disregard any errors that you may see and let the command run through (this can take a while, so go make a pizza or something).

 

Make sure that you are in the /home/zenoss/mibs/mixed directory then run the following command:

 

zenmib run *

 

6.   Once the last command has run through, we need to build some of the core Cisco Mibs which did not build the first time around.  We do this by loading them in a specific order with the following command:

 

zenmib run ./CISCO-SMI.my ./OLD-CISCO-SYSTEM-MIB.my ./OLD-CISCO-INTERFACES-MIB.my ./OLD-CISCO-TS-MIB.my ./OLD-CISCO-TCP-MIB.my ./CISCO-GENERAL-TRAPS.my

 

7.  Once the last command has run through and some of the core Cisco Mibs are loaded, we have to run through the building process again by executing:

 

zenmib run *

 

This should run through with significantly less errors (though you will probably still see some).  Take note of which Mibs do not load during this process (make a list of the names).

 

8.  Now, we should only be down to a small amount of Mibs that did not load.  Since you are using the custom Mibs pack you won't have to modify Mibs files like I did, but you still may need to load them in a similar way as was done in step 6.  To do this you first need to find out what dependencies the Mibs are complaining about.

 

You can do this with the command:

 

zenmib run -v10 NAME-OF-THE-MIB.my

 

Obviously fill in the name of whichever MIB you want to check dependencies for.  Once you know what dependencies it is expecting and in what order, then simply make a command similar to the one in step 6, but replace the MIBs listed in that command and ensure that they are in the specific order specified in the debug output.

 

After you have completed step 8 for each Mib and have them all loaded you should be done.  Login to Zenoss and ensure that you have 1128 Cisco Mibs loaded.  You can then start moving them in to a Subfolder called Cisco to keep things tidy.  Move them 40 at a time (yes, it will be time consuming but it's the best way to do it).  Once they are all moved in to a subfolder you are done.