oes
index
/usr/lib/sca/python/oes.py

Supportconfig Analysis Library for Open Enterprise Server for Linux
 
Library of python functions used when dealing with supportconfigs from OES for 
Linux servers.

 
Modules
       
Core
re

 
Functions
       
dsfwCapable()
Checks for DSfW capabilities from the LDAP root DSE server in novell-lum.txt file.
 
Args:           None
Returns:        Boolean
        True = Server is DSfW capable
        False = Server is NOT DSfW capable or novell-lum.txt cannot be found
 
Example:
 
if( oes.dsfwCapable() ):
        Core.updateStatus(Core.IGNORE, "Server is DSfW Capable")
else:
        Core.updateStatus(Core.WARN, "Server is not DSfW Capable")
getNSSModInfo()
Gets all NSS modules in a dictionary of dictionaries gathered from the
'echo modules > /dev/nsscmd' section of novell-nss.txt.
 
Args:           None
Returns:        Dictionary of Dictionaries
Each module name is the key to a dictionary for it's version, build and snap date information. 
Each module has the following keys:
 
<module_name> (string) - The name of the module found in the novell-nss.txt file. It is always uppercase.
version (string) - The module version string.
build (string) - The module build number
snapDate (string) - The date the module was built.
 
Example:
 
NSS_MODULES = oes.getNSSModInfo()
FOUND = False
MODULE_NAME = 'NSS'
BAD_VERSION = '4.12a'
for MOD in NSS_MODULES:
        if( MODULE_NAME == MOD ):
                FOUND = True
                break
if( FOUND ):
        if( NSS_MODULES[MODULE_NAME]['version'] == BAD_VERSION ):
                Core.updateStatus(Core.WARN, "Update to resolve potential " + MODULE_NAME + " module issues")
        else:
                Core.updateStatus(Core.IGNORE, "We do not care about this " + MODULE_NAME + " module version")
else:
        Core.updateStatus(Core.ERROR, "NSS module not found: " + MODULE_NAME)
getNSSPools()
Gets all NSS Pools in a list of dictionaries
 
Args:           None
Returns:        List of Dictionaries
        Each list entry is an NSS Pool dictionary with the following keys
        poolName (string) = The pool name
        poolState (string) = The pool state
        mounted (boolean) = True if the pool device is mounted, otherwise false
        shared (boolean) = True if the pool is shared for clustering, otherwise false
        poolVolumes (list) = List of volumes the pool owns
 
        All additional attributes are taken from the key/value pairs in the pool's 
        Manage_NSS/Pool/<poolName>/PoolInfo.xml section of the novell-nss.txt file. 
        The xml file is flattened with no regard to sub sections as the keys currently 
        are unique, regardless of section. When a duplicate key shows up, they are stored
        in duplicateKeys and the key is deleted from the dictionary. Report a bug if a 
        duplicate key is found.
 
        <salvage>
        <highWaterMark>20</highWaterMark>
        <lowWaterMark>10</lowWaterMark>
        <maxKeepTime>0</maxKeepTime>
        <minKeepTime>0</minKeepTime>
        <freeableSize>0 (0.00  B)</freeableSize>
        <nonFreeableSize>0 (0.00  B)</nonFreeableSize>
        <deletedFiles>0</deletedFiles>
        </salvage>
 
        would be flattened to:
 
        highWaterMark=20
        lowWaterMark=10
        maxKeepTime=0
        minKeepTime=0
        freeableSize=0
        nonFreeableSize=0
        deletedFiles=0
 
Example:
 
NSS_POOLS = oes.getNSSPools()
POOL_WARNINGS = []
MIN_AVAILABLE = 10
ATTRIBUTE_ERROR = False
if( len(NSS_POOLS) > 0 ):
        for POOL in NSS_POOLS:
                if( "percentAvailableSpace" in POOL ):
                        if( int(POOL['percentAvailableSpace']) < MIN_AVAILABLE ):
                                POOL_WARNINGS.append(POOL['Name'])
                        else:
                                ATTRIBUTE_ERROR = True
else:
        Core.updateStatus(Core.ERROR, "No NSS Pools found")
 
if( len(POOL_WARNINGS) > 0 ):
        Core.updateStatus(Core.WARN, "Pools with limited available space: " + str(POOL_WARNINGS))
elif( ATTRIBUTE_ERROR ):
        Core.updateStatus(Core.ERROR, "Some pools missing percentAvailableSpace attribute")
else:
        Core.updateStatus(Core.IGNORE, "All pools have acceptable available space")
getNSSVolumes()
Gets all NSS Volumes in a list of dictionaries
 
Args:           None
Returns:        List of Dictionaries
        Each list entry is an NSS Volume dictionary with the following keys
        baseName (string) = The volume name from /dev/nsscmd, volumeName will be assigned
                from VolumeInfo.xml.
        basePool (string) = The pool name associated with the volume from nss /pool, poolName
                will be assgined from VolumeInfo.xml
        baseState (string) = The volume state from /dev/nsscmd, volumeState will be assigned
                from VolumeInfo.xml.
        mounted (boolean) = True if the volume is mounted, otherwise false
        shared (boolean) = True if the volume is shared for clustering, otherwise false
        duplicateKeys (list) = List of duplicate keys found in VolumeInfo.xml
 
        All additional attributes are taken from the key/value pairs in the volume's 
        Manage_NSS/Volume/<volumeName>/VolumeInfo.xml section of the novell-nss.txt file. 
        The xml file is flattened with no regard to sub sections as the keys currently 
        are unique, regardless of section. When a duplicate key shows up, they are stored
        in duplicateKeys and the key is deleted from the dictionary. Report a bug if a 
        duplicate key is found.
 
        <salvage>
        <highWaterMark>20</highWaterMark>
        <lowWaterMark>10</lowWaterMark>
        <maxKeepTime>0</maxKeepTime>
        <minKeepTime>0</minKeepTime>
        <freeableSize>0 (0.00  B)</freeableSize>
        <nonFreeableSize>0 (0.00  B)</nonFreeableSize>
        <deletedFiles>0</deletedFiles>
        </salvage>
 
        would be flattened to:
 
        highWaterMark=20
        lowWaterMark=10
        maxKeepTime=0
        minKeepTime=0
        freeableSize=0
        nonFreeableSize=0
        deletedFiles=0
        
 
Example:
 
NSS_VOLUMES = oes.getNSSVolumes()
if( len(NSS_VOLUMES) > 0 ):
        for VOLUME in NSS_VOLUMES:
                if( VOLUME['Shared'] ):
                        Core.updateStatus(Core.IGNORE, "Volume " + str(VOLUME['Name']) + " is a shared volume")
                else:
                        Core.updateStatus(Core.WARN, "Volume " + str(VOLUME['Name']) + " is not shared")
else:
        Core.updateStatus(Core.ERROR, "No NSS Volumes found")
ncsActive()
Returns true is Novell Cluster Services is active on the server, otherwise it returns false.
 
Args:           None
Returns:        Boolean
        True = NCS is active
        False = NCS is not active
 
Example:
 
if( oes.ncsActive() ):
        Core.updateStatus(Core.IGNORE, "NCS is Active on the Server")
else:
        Core.updateStatus(Core.WARN, "NCS is NOT active on the Server")
shadowVolumesFound()
Checks if Dynamic Storage Technology (DST) shadow volumes are present.
 
Args:           None
Returns:        Boolean
        True = DST Shadow Volumes in use
        False = No DST Shadow Volumes in use
 
Example:
 
if( oes.shadowVolumesFound() ):
        Core.updateStatus(Core.IGNORE, "DST Shadow Volumes in Use")
else:
        Core.updateStatus(Core.WARN, "No DST Shadow Volumes in Use")