Wednesday, 20 October 2010

HTTP Rewrite

Someone may find this useful. If you have configured your site for https access, and you want anyone who tries to acess it using normal http to automatically redirect to https, you can use rewrite in this fashion:

# This rewrites all hits on port 80 to port 443
<>VirtualHost *:80>
     RewriteEngine On
     RewriteCond ^{HTTPS} !on
     RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R,QSA,L]
<>/VirtualHost>


On the ssl configuration, you may want to:
<>VirtualHost *:443>
     ...
     RewriteEngine On
     # Now send everyone to your https base(document root)
     RewriteRule ^/(.*) http://your_https_site/$1 [L,P]
<>/VirtualHost>


For help with the flags used, check http://borkweb.com/story/apache-rewrite-cheatsheet. Of course you need mod_rewrite in your apache.

Wednesday, 11 August 2010

[zenoss] employ ping down dependency to suppress other events


sum = str(evt.summary)
if getattr(evt, 'severity', 0) > 0 \
and getattr(evt, 'eventClass', '/Unknown') != '/Status/Ping' \
and device and device.getPingStatus() > 0:
       evt._action = "drop"

if (sum.find("Command timed out")>=0) \
or (sum.find("Socket timeout")>=0) \
or (sum.find("Unable to read")>=0) \
or (sum.find("Process not running")>=0) \
or (sum.find("SNMP agent down")>=0) \
or (sum.find("No response from")>=0):
     if device.getPingStatus() <= 0:
           time.sleep(8)
           if device.getPingStatus() > 0:
                  evt._action = "drop"
     else:
           evt._action = "drop"

   if getattr(evt, 'prodState', 99)<400:
      evt._action = "drop"

Wednesday, 26 May 2010

Monitoring a Fedora Directory Server based LDAP service (FDS, CDS, RHDS) with Zenoss

I am publishing a new Zenpack to monitor an FDS LDAP service. The Zenpack greatly extends the LDAPMonitor (you may want to remove it completely if you were using it to monitor FDS)
The Zenpack provides:

* FDS-LDAPserver Template which provides:
  • Monitoring for ldap and ldaps ports
  • Monitors the ssl certificate validityfor your server
  • LDAP operations, binds and failure stats/graphs for your FDS server
* RHDS-MIB
  • An implementation of the MADMAN mib for monitoring LDAP/CLDAP and X.500 directories described in RFC 2788 and 2789
* /Events/Status/LDAP event class transform to modify the event summary for threshold triggerd events.

*The zenpack utilises both command and snmp datasources

The zenpack is extensible and one can incoporate other snmp datasources or modify the graphs that can be generated from them.

Tuesday, 19 January 2010