No Node Left Behind

Zenoss Blog: No Node Left Behind

7 Posts tagged with the tips tag

This month's tip comes from Zenoss Community member Jeff Schroeder and Zenoss engineer Kells Kearney.  Maintenance windows are useful for scheduled downtime periods, but there are situations where being able to dynamically schedule a maintenance window for an individual device is useful. This tip describes how to create an event that can create a short (10 minute) window with an event mapping.

 

Resolution

There are two parts to this solution:

  • A script to generate an event, based around zensendevent command. Other methods using XML-RPC can be used, of course.
  • An event mapping that uses that event

 

Event Generation: Using System Startup / Shutdown Scripts

Attached to this article is an example system startup/ shutdown script called zennotifyreboot suitable for installing into the /etc/init.d/ directory and configuring for service using the chkconfig system utility.  This script uses the zensendevent command, which only requires a Python 2.4 installation on the remote server.  Use the following procedure to install and set up the script:

  • Copy the startup script into the /etc/init.d/ directory.
  • Copy the zensendevent script from the Zenoss server ( $ZENHOME/bin/zensendevent ) to the remote device.
  • Run the chkconfig command: chkconfig --add zennotifyreboot
  • Create the configuration file:  service zennotifyreboot sampleconfig > /etc/sysconfig/zennotifyreboot
  • Edit the /etc/sysconfig/zennotifyreboot file as appropriate.
  • Verify the configuration: service zennotifyreboot status

 

When the stop action (ie service zennotifyreboot stop) is run, an event will be sent using zensendevent to the Zenoss server.

Here is the sample configuration file:

# Sample configuration for sending events into Zenoss

# Plain Python script to send the XML-RPC event
ZENSENDEVENT=/opt/zenoss/bin/zensendevent

# Zenoss XML-RPC server (eg a server where zenhub is running)
ZENSERVER=localhost
ZENPORT=8081

# Credentials to send in event into Zenoss
# This cred needs to exist in the /etc/hubpasswd file
# on the Zenoss server
CREDS=admin:zenoss

# If the Zenoss device is something else other than the
# hostname of the device, use this name.
#ZENDEVICE=mySpecialHostname

Event Generation: Event Requirements

Whether using zensendevent or another mechanism to send in an event, the following information is required for the event mapping below to be useful:

  • Device name as it is known in Zenoss.  If the device is not known to Zenoss exactly as it appears on the Status page for the device (ie if the Status page has a non-FQDN name, then the name sent in the event must not be FQDN). 
  • The eventClassKey field must be MaintenanceWindowImmediate

A summary is required, but there are no restrictions on the content.

Event Mapping: Creating  a Dynamic Maintenance Window

Follow this procedure to create an event mapping:

  1. Click on the Events item from the navigation bar.
  2. Click on the Status class.
  3. Click on the Update class.
  4. From the  EventClass Mappings table menu, select the Add Mapping... menu item.
  5. In the dialog box, enter an id of MaintenanceWindowImmediate and then click the OK button.
  6. Click on the MaintenanceWindowImmediate item.
  7. Click on the Edit tab.
  8. Copy and paste from the attached status-update-MaintenanceWindowImmediate.txt
  9. Click on the Save button when complete.

 

MaintenanceWindowImmediate.png

 

Now drop the event so that it doesn't clutter up the Event Console.

  1. Click on the zProperties tab.
  2. Change the zEventAction to drop.  If you would like to track the events, set the action to history.
  3. Click on the Save button

 

This will create a new maintenance window called Reboot under the device.  To see the maintenance windows for a device, select More -> Administration from the page menu of the device.


3,231 Views 1 Comments 1 References Permalink Tags: tips, tip-of-the-month, maintenance, event, mapping, window
This month's tip comes from Zenoss Community member Scott Haskell.  This tip provides detailed documentation for implementing email acknowledgement  with Postfix, Procmail and Python.   Originally posted on his blog Technology, Food, Life, he updated the tip and posted it to the Zenoss Wiki: Email Acknowledgment - Postfix, Procmail and Python

Background

Event driven network monitoring systems rely on acknowledgment for multiple reasons. These reasons include:

  • To let other Zenoss administrators and users know that someone is aware of the problem and taking action.
  • To suppress escalation of alerts.

To acknowledge an alert, a responder typically:

  • Clicks the acknowledge link in the body of the default Zenoss alert email.
  • Logs into the Zenoss server, navigates to the alert on the device or in the event manager, and acknowledges the alert.

This process works well when you're in the office or your operations are business hours only. Typically, this is not the case for most users of Zenoss. Most users have critical systems that require 24x7 monitoring and alerting. Additionally, managers and executives require escalation of messages from the on-call personnel through management and sometimes to executive management.

 

The acknowledgment model of Zenoss, in its current state, is limited. An alert will never escalate, as long as it is acknowledged. In a 24x7 monitoring and alerting model, an alert can and will come during non-business hours. The first responder (on-call personnel) is usually mobile and does not always have immediate access to a computer. To compound this, many Zenoss servers live on private networks that require VPN authentication to access them. There are times where the on-call personnel can not get into the system quick enough to prevent escalation from occurring. We all know how upset managers get when the on-call grunt doesn't do her job properly.

 

One possible solution to this issue is email based event acknowledgment. The on-call responder replies to the alert email on her PDA. The alert email is routed back to the Zenoss server for processing with Procmail. The body of the email is piped into a python script, via Procmail. The device and event id are extracted and the alert is acknowledged through Zenoss API calls. An email is sent back to the responder reporting whether or not the acknowledgment was successful.

 

The biggest caveat, for this model, is that incoming mail needs to be routed to your Zenoss server. As such, this will require knowledge of mail relay administration or you'll need to rope in your mail relay administrator to help you out. Since every company's mail setup is unique (Spam filters, Exchange Servers, Postfix Servers, et. al) I will leave this as an exercise for the user of this how-to. The second caveat is that your mail relay becomes a single point of failure for delivery. If your mail relay is down or in schedule maintenance, you won't be able to acknowledge events.

 

** This will work with plain-text, base64 encoded and multipart email types (Iphone, Blackberry, Exchange). I have tested this on Zenoss Core 2.4.5 and 2.5.0

Installation

Postfix Installation

Install Postfix from RPM or source.

Procmail Installation

Install Procmail from RPM or source and configure per the README.

Configuration

Postfix Configuration

Edit your configuration file to use procmail. This is typically located at:

vi /etc/postfix/main.cf

 

Edit mailbox_command to reflect the path of your Procmail installation.

mailbox_command = /usr/bin/procmail

 

Restart Postfix

/etc/init.d/postfix restart

Procmail Configuration

We will be filtering email at the user level, not the system level.  As the zenoss user:

vi ~/.procmailrc
chmod 600 ~/.procmailrc

 

Create a procmail directory to log to.

mkdir ~/procmail

 

Copy and paste these two sections into your .procmailrc. There can be space between them. The first section exports basic environment variables.

SHELL=/bin/bash
PMDIR=$HOME/procmail
LOGFILE=$PMDIR/pmlog
ZENHOME=/usr/local/zenoss
PYTHONPATH=$ZENHOME/lib/python
PATH=$ZENHOME/bin:$PATH

 

The next section is the Procmail formula. This says for any message that contains '[zenoss]' in the subject, forward the header and body (as STDIN) to /home/zenoss/zenemailack.py and redirect STDOUT and STDERR to $ZENHOME/log/zenemailack.log. This formula also locks and waits until the script has finished. You can relocate zenemailack.py anywhere on your system, just update the path in the formula accordingly.

:0
* ^Subject:.*\[zenoss\].*
{
  :0 hbW:
  | /home/zenoss/zenemailack.py >> $ZENHOME/log/zenemailack.log 2>&1
}

Zenoss UI Configuration

Under the 'settings' tab, from the 'settings' link on the main navigation menu (left navbar), change this value to reflect the valid email address to your zenoss user.

From Address For Emails        zenoss@server.mydomain.com

* You must be able to receive emails at this email address on your Zenoss server.

Zenoss Server Configuration

Download the attached script below (zenemailack.py) and place it in /home/zenoss. You can install the file to any location of your choice. If you use a different location, make sure to update the Procmail formula to reflect the new path of your installation.

 

Change permissions to make the script executable.

chmod 755 ~/zenemailack.py

 

Edit zenemailack.py and change these variables to suit your environment:

# Update for outgoing email
MAIL = "/usr/sbin/sendmail -t "
from_addr = "
zenoss@server.mydomain.com"

cc_address = ""

Testing

General

The first step is to make sure you can receive emails at zenoss@server.mydomain.com. If you can't receive a basic email, resolve this or you're out of luck.

Procmail

Once you can successfully receive emails, make sure that procmail is working. You can create a test formula in your .procmailrc to test that it's working correctly.

vi ~/.procmailrc

 

Append this to your .procmailrc and save it.

:0
* ^Subject:.*test
/dev/null

 

As zenoss user, test Procmail functionality by sending yourself an email with 'test' as the subject.

echo "foo" | mailx -s "test" zenoss

 

Check the procmail log for success.

tail ~/procmail/pmlog
From zenoss@localhost  Wed Sep  3 16:11:26 2008
Subject: test
  Folder: /dev/null                                595

If you have no entry for this test in your Procmail log, Procmail is not working properly. Check your installation, double check that Postfix is configured to use Procmail and that you re-started Postfix after you configured it to use Procmail.

 

Re-edit ~/.procmailrc and remove the test formula you added above. Your .procmailrc should look like this after.

SHELL=/bin/bash
PMDIR=$HOME/procmail
LOGFILE=$PMDIR/pmlog
ZENHOME=/usr/local/zenoss
PYTHONPATH=$ZENHOME/lib/python
PATH=$ZENHOME/bin:$PATH
:0
* ^Subject:.*\[zenoss\].*

  :0 hbW:
  | /home/zenoss/zenemailack.py >> $ZENHOME/log/zenemailack.log 2>&1
}

Zenoss

Once you've verified that you can receive emails and Procmail works, test this with an actual event.

 

If you're impatient, you can inject an event into Zenoss. To do this, you can follow the admin guide. Just make sure your event matches an alertable condition.

 

Admin Guide - 7.1.8.1 – Creating Events Through the User Interface

 

If you're not impatient, just wait around until you get an alert. Once you receive the alert, simply reply. There is no need to type anything in your reply.

Make sure that your mail editor includes the body of the alert when you reply. I don't know of any that don't, by default, but I'm just throwing that in there.

You should receive a verification email back saying that the alert has been acknowledged or not. You’ll only receive a verification reply if the alert is in an unacknowledged state or something crapped out during the attempted acknowledgment. If you don’t get a reply email, the alert most likely cleared itself and has been moved to history, by Zenoss.  Once an event has been acknowledged, any reply-to-all email threads will not generate email noise. They will, however, be logged.

 

For debugging or troubleshooting, you can view the log at:

$ZENHOME/log/zenemailack.log

Further configuration and debugging information may be found at the wiki entry: Email Acknowledgment - Postfix, Procmail and Python, which will have any updates to the instructions going forward.  Thanks again to Scott Haskell for providing this tip!

4,056 Views 0 Comments 1 References Permalink Tags: zenoss, python, tips, events, tip-of-the-month, email, acknowledgement, postfix, procmail

This month's tip comes from Zenoss engineer Kells Kearney who recently checked in a patchset for ticket #5375 "Add tab completion to zendmd".  This was checked in for the upcoming 2.5 release, but it applies cleanly to recent 2.4.5 installations.  By Kells' description, this patch makes spelunking in zendmd become very easy and reduce some of the need for looking through code to determine what's possible.  To apply and use the patch

  1. Login as the zenoss user and cd $ZENHOME
  2. zenoss stop
  3. zenpatch 14397
  4. zenoss restart
  5. zendmd
  6. You can now hit the tab key and see all the possible choices when working with devices and other zodb objects.

 

 

 

For more tips on using zendmd, take a look at the Developer Guide and the ZenDMD section of the Community Wiki

 

Thanks Kells!

6,119 Views 0 Comments Permalink Tags: zendmd, development, tips, developers, tip-of-the-month

This month’s tip comes from the Zenoss Forums thread How Change Performance Graphs Range from hour to minute? with the solution from user ‘jhelgesen’.

 

The default range for performance graphs in Zenoss are 129600 seconds, or 36 hours. You may change the default ranges, so you do not have to zoom in or out each time you view the performance graphs. Unfortunately these values are hard-coded and will have to be added to the source files to override them.

 

render

 

There are three files you will need to edit, make sure you back them up before editing.

 

$ZENHOME/Products/ZenModel/DataRoot.py holds the default ranges for performance graphs. Near line 243 (depending on your Zenoss version) there is a table that holds the list of available time ranges, with time spans in seconds. You may add a new range (e.g. 8 hours or 28800 seconds) and make this the new default. You will change to code to look similar to this (remember to maintain the same spacing):

defaultDateRange = 28800
performanceDateRanges = [
('Today',28800,),
('Hourly',129600,),
('Daily',864000,),
('Weekly',3628800,),
('Monthly',41472000,),
('Yearly',62208000,)
]

Remove the compiled $ZENHOME/Products/ZenModel/DataRoot.pyc file and the update will go into effect.

 

Next you will need to update the template files to default to the range that you prefer.


$ZENHOME/Products/ZenModel/skins/zenmodel/viewPerformanceDetail.pt and $ZENHOME/Products/ZenModel/skins/zenmodel/viewGraphReport.pt each contain a single line defining the default date range.

 

For $ZENHOME/Products/ZenModel/skins/zenmodel/viewPerformanceDetail.pt near line 15 (dependent on your Zenoss version) there is a line:

tableName,'drange',129600)">

you will change this to

tableName,'drange',28800)">

for an 8 hour default.

 

For $ZENHOME/Products/ZenModel/skins/zenmodel/viewGraphReport.pt near line 52 (dependent on your Zenoss version) there is a line:

tableName,'drange',129600)">

you will change this to

tableName,'drange',28800)">

for an 8 hour default.

 

You now have 8 hour defaults for your performance graphs. Note that you will have to re-apply these edits when you upgrade your version of Zenoss.

4,976 Views 0 Comments Permalink Tags: zenoss, tips, performance-graphs

In a recent forum post, user ‘rmk’ came up with a Perl script to expose the software inventory through the SNMP hrSWInstalled OID for Debian and Ubuntu machines. User ‘zarxcky’ wrote up detailed instructions for deploying the solution and getting it to work with Ubuntu. Many thanks to these two for providing a very useful guide for the Zenoss community. Here is the write-up from ‘zarxcky’, the Perl script URL is listed at the end of the post.

How to make the hrSWInstalled OID working on Ubuntu
Credit to RMK for making this works!

 

Disclaimer:


This guide is intended to be used with hrswinstalled.pl to resolve hrSWInstalled OID on Ubuntu not revealing anything to Zenoss.

 

Prequisite Packages (Ubuntu .debs) to prepare for *snmp-perl:


Install this packages first before testing running the script.

 

apt-get install all software listed below before attempting to run the perl scripts:

 

- libnet-snmp-perl
- libyaml-perl
- libparse-debian-packages-perl
- libsnmp-info-perl

 

Place the hrswinstalled.pl within /etc/snmp/ folder.

 

Modify the snmpd.conf and add:

 

perl do "hrswinstalled.pl";

 

Note: if the "perl do" command not working when you try to snmpwalk the hrSWInstalled oid, this is because the SNMP agents (snmpd) are not perl-embedded enabled.

 

Since default snmpd Ubuntu package does not have embedded-perl support enabled (check using: net-snmp-config --configure-options), we need to rebuild back the Ubuntu snmpd (come from net-snmp) package with the --enable-embedded-perl option within the net-snmpfolder/debian/rules. Once we got the package, remove the original snmpd package installed and use the custom one that we just built.

 

Use the howtoforge reference below to rebuild debian packages under Ubuntu.

 

Note: after the ./configure step, check the net-snmp configuration summary, for example as shown below:

---------------------------------------------------------
Net-SNMP configuration summary:
---------------------------------------------------------

SNMP Versions Supported: 1 2c 3
Net-SNMP Version: 5.4.1
Building for: linux
Network transport support: Callback Unix TCP UDP
SNMPv3 Security Modules: usm
Agent MIB code: default_modules => snmpv3mibs mibII ucd_snmp notification notification-log-mib target agent_mibs agentx disman/event disman/schedule utilities host
Embedded Perl support: enabled
SNMP Perl modules: building -- embeddable
SNMP Python modules: disabled
Authentication support: MD5 SHA1
Encryption support: DES AES

---------------------------------------------------------

If we got "Embedded Perl support: enabled", then we know we on the right path to Nirvana ;o)

 

Continue with debuild command to build .deb packages (see Howtoforge link).

 

Listed .deb packages:

 

libsnmp15_5.4.1~dfsg-4ubuntu4.2_amd64.deb
libsnmp-python_5.4.1~dfsg-4ubuntu4.2_amd64.deb
libsnmp-base_5.4.1~dfsg-4ubuntu4.2_all.deb
snmp_5.4.1~dfsg-4ubuntu4.2_amd64.deb
libsnmp-dev_5.4.1~dfsg-4ubuntu4.2_amd64.deb
snmpd_5.4.1~dfsg-4ubuntu4.2_amd64.deb
libsnmp-perl_5.4.1~dfsg-4ubuntu4.2_amd64.deb
tkmib_5.4.1~dfsg-4ubuntu4.2_all.deb

 

Backup the /etc/snmp/snmpd.conf to a safe place

 

Install using dpkg -i for everything EXCEPT libsnmp-python & tkmib (since we not really need it)


Note: You might face dependencies problem especially with libsnmpd15 vs. apt-get. This is where the apt-get and/or dpkg kung-fu will be needed.

 

Double check for existence of --enable-embedded-perl parameter using "net-snmp-config --configure-options" command.

 

Configure the /etc/default/snmpd


Restore the snmpd.conf to /etc/snmp && restart snmpd.

 

Test by running:


snmpwalk -v 2c -c public hidro.logistics.com hrSWInstalled

 

You will start to see long lists of hrSWInstalled OID in actions, displaying and listing all software installed within any Ubuntu systems.

 

Example:

 

Before:


#snmpwalk -v 2c -c public hidro.logistics.com hrSWInstalled
HOST-RESOURCES-MIB::hrSWInstalled = No Such Object available on this agent at this OID

 

After:


#snmpwalk -v 2c -c hidro.logistics.com hrSWInstalled
HOST-RESOURCES-MIB::hrSWInstalledName.1 = STRING: "adduser 3.105ubuntu1/all (add and remove users and groups)"
HOST-RESOURCES-MIB::hrSWInstalledName.2 = STRING: "apache2 2.2.8-1ubuntu0.3/all (Next generation, scalable, extendable web serv
er)"
HOST-RESOURCES-MIB::hrSWInstalledName.3 = STRING: "apache2-mpm-worker 2.2.8-1ubuntu0.3/amd64 (High speed threaded model for Apa
che HTTPD)"
HOST-RESOURCES-MIB::hrSWInstalledName.4 = STRING: "apache2-utils 2.2.8-1ubuntu0.3/amd64 (utility programs for webservers)"
HOST-RESOURCES-MIB::hrSWInstalledName.5 = STRING: "apache2.2-common 2.2.8-1ubuntu0.3/amd64 (Next generation, scalable, extendab
le web server)"
HOST-RESOURCES-MIB::hrSWInstalledName.6 = STRING: "apparmor 2.1+1075-0ubuntu9.1/amd64 (User-space parser utility for AppArmor)"
HOST-RESOURCES-MIB::hrSWInstalledName.7 = STRING: "apparmor-utils 2.1+1075-0ubuntu9.1/amd64 (Utilities for controlling AppArmor
)"
HOST-RESOURCES-MIB::hrSWInstalledName.8 = STRING: "apt 0.7.9ubuntu17.1/amd64 (Advanced front-end for dpkg)"

 

.... and so on...

 

References:


SNMP Software Inventory for Debian and Ubuntu machines

http://www.net-snmp.org/wiki/index.php/Tut:Extending_snmpd_using_perl
http://pwet.fr/man/linux/formats/snmp/snmpd_conf
http://www.howtoforge.com/how-to-rebuild-the-squid-2.6-debian-package-with-support-for-x-forwarded-for-headers

 

The Perl script is available for downloading here: SNMP Software Inventory for Debian and Ubuntu machines

8,280 Views 6 Comments Permalink Tags: zenoss, community, ubuntu, snmp, tips, debian, tip-of-the-month
In a recent forum post, user ccole shared a event transform to create unique thresholds per filesystem monitored.  He reported that

My management is very interested in Zenoss, but we’ve got a few challenges. The first challenge is that we have a number of Windows machines that have large shadow copy volumes. Those are intended to fill up, and alerting for those isn’t particularly useful. The second challenge is that a one-size-fits-all threshold doesn’t actually fit all.

The solution we’ve fixed upon is to put a custom threshold into the volume name and work off that. Here’s the code used in the /Perf/Filesystem event transform (based off another user’s change that made for more understandable messages)

 

Zenoss guru Chet Luther added a couple of minor fixes and here’s the result:

 

import re

fs_id = device.prepId(evt.component)
for f in device.os.filesystems():
    if f.id != fs_id: continue

    # Extract the percent and free from the summary
    m = re.search("threshold of [^:]+: current value ([\d\.]+)", evt.summary)
    if not m: continue
    usedBlocks = float(m.groups()[0])
    p = (usedBlocks / f.totalBlocks) * 100
    freeAmtGB = ((f.totalBlocks - usedBlocks) * f.blockSize) / 1073741824

    # Make a nicer summary
    evt.summary = "Disk space low: %3.1f%% used (%3.2f GB free)" %  (p,freeAmtGB)

    # This is where we change to a per device threshold
    perDeviceThreshold = 95.0
    m = re.search("zz(\d{3})", f.id)
    perDeviceThreshold = m and float(m.groups()[0]) or 95.0
    if p >= perDeviceThreshold: evt.severity = 5
    break

 

UPDATE: fixed the indentation

5,950 Views 2 Comments Permalink Tags: zenoss, tips, tip, event-transform

This month Zenoss announced two new enterprise products Zenoss Enterprise Edition and Zenoss for Service Providers. Here’s a synopsis of these two new products.

 

New Features in Zenoss Enterprise 2.2

  • Distributed Collector Package
  • Expanded Library of Certified Monitors
  • Platinum Service Plan

 

New Features in Zenoss for Service Providers

 

  • Multi-Tenant Network Management
  • Distributed Configuration Manager
  • High Availability Package

Submit a ZenPack Contest!

In the Zenoss forums there are a wide variety of ZenPacks being discussed and tested, but we wanted to really kickstart the process. So we’re announcing a Submit a ZenPack Contest with not 1, but 2 great prizes! Read the Zenoss blog to find out how you can win an Asus Eee PC laptop.

Three Nominations in the SF.net CCAs

Thanks to everyone who voted for Zenoss in the SourceForge.Net Community Choice Awards. Zenoss was nominated in the following categories.

 

  • Best Project for the Enterprise
  • Most Likely to Be the Next $1B Acquisition
  • Best Tool or Utility for SysAdmins

 

Now we need your help in the finals for the SF.net Community Choice Awards. Please cast your vote today (login required).

 

New Book: Zenoss Core Network and System Monitoring

One of our community members Mike Badger recently published a book through Packt Publishing on using Zenoss Core. Through their giveback program we have asked that 2% of the proceeds go to the Twisted Foundation and if you buy through this link 5% of book sales go to support Twisted SNMP one of the open source projects that makes up Zenoss Core.

Zenoss Users Conference: Nov 4-6

Based on user feedback we have decided on November 4-6 for the Zenoss user’s conference to be held in Annapolis, MD. Enjoy free training, network with other users and meet the Zenoss development team. Let us know if you would like to receive updates on the Zenoss Users Conference.

In The News

See what people are saying about Zenoss this month.

 

Roberto Galoppini: Open Source Systems Management, Zenoss Expands Platform Support

eWeek: Open Source and IT Management

IT Management: Open-Source Network-Management Tools: Reading Between the Lines

Upcoming Events

Zenoss is looking to expand its IT team. The Web Developer position will focus on developing, maintaining and enhancing a variety of internal and customer facing web applications. You will be working with a team that is responsible to support these applications in accordance with business requirements.

Visit the Zenoss Career Center for more information.

Thank you for your support and interest in Zenoss.

 

Best Regards,

 

Mark R. Hinkle

 

Mark R. Hinkle
Vice President, Community
Zenoss Inc.

4,856 Views 0 Comments Permalink Tags: zenoss-xsp, tips, sourceforge-awards, zenoss-enterprise


Actions