Skip to content
A simple Python module for writing xymon external scripts
Branch: master
Clone or download
Latest commit cc7cd66 Oct 4, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
example Fix the pylint warning: Used * or ** magic (star-args) Mar 25, 2017
.gitignore Initial commit Mar 10, 2017
LICENSE Update Oct 4, 2018 Add python3 support, add lifetime Feb 14, 2018

Codacy Badge Code Climate License


PyXymon is a simple Python module that can help you write Xymon external scripts in Python. PyXymon provides some methods for rendering the messages you want to display in the Xymon web page and for sending them to the Xymon server. PyXymon reads the required informations from the Xymon environment variables, so you do not need to add any extra configuration file.


Just copy the module in the xymon ext directory.


Create a script using the following schema:


import os
import sys
import pyxymon as pymon

CHECK_NAME = 'yourcheck'

def run_check():
    """Check the status of whatever you want..."""
    xymon = pymon.XymonClient(CHECK_NAME)
    check_script = os.path.basename(__file__)
    # do your logic...
    # you can set the criticity of the final xymon message by using:
    #    xymon.color = pymon.STATUS_WARNING
    # or
    #    xymon.color = pymon.STATUS_CRITICAL
    # The default criticity is set to 'pymon.STATUS_OK' 
    # Optionally you can set the LIFETIME (in minutes) using:
    #    xymon.lifetime = 15
    xymon.title('Title in the xymon check page')
    xymon.section('Section Title',
                  'Text containing the lines you want to display')
    # You can add here other sections, if required.
    xymon.footer(check_script, CHECK_VERSION)

def main():

if __name__ == '__main__':

Configure your extension module in the file $XYMONCLIENTHOME/etc/xymonclient.cfg.

        ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
        LOGFILE $XYMONCLIENTLOGS/yourcheck.log
        INTERVAL 10m

You can find a full example here.


If you need to run your Python check with root privileges, just prefix the CMD directive in xymonclient.cfg with the sudo command:


By default sudo does not preserve the environment variables exported by Xymon. To preserve the variables required by PyXymon, add the following lines to the sudo configuration:

 Defaults env_keep:xymon += "XYMSRV"
 Defaults env_keep:xymon += "XYMONDPORT"
 Defaults env_keep:xymon += "MACHINE"
You can’t perform that action at this time.