The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Ym - a command line tool for manipulating Nagios configuration.

SYNOPSIS

    Usage: ./ym -c COMMAND
            Valid commands are:
    add-command - Define a new command(s).
            -o command|READ_FILE=file [-o object2 -o object3]
            -p command_line="$USER1$/local/tryumount $SERVICESTATE$"
    
    add-host - Add one or more hosts.
            -o hostname|READ_FILE=file [-o object2 -o object3]                                                                                                    
            -p use=default-host -p contact_groups=some-admins
    
    add-hostgroup - Add new hostgroup(s).
            -o hostgroup_name|READ_FILE=file [-o object2 -o object3]
            -p property=value (example: -p alias='Web Servers')
    
    add-service - Add service(s) to host(s)
            Possible arguments (may be multiple) are:
              -o <servicename>
              -d|--dest <hostname>
              -g <hostgroupname>
              -p <key>=<value> (example: -p use=default-service -p contact_groups=some-admins)
            Arg values may be comma|space|semicolon separated names;
              /regex/ or READ_FILE=filename macros.
    
    cleanup - Remove unused elements from config.
            (--type host_templates|service_templates|contacts|
                    contact_templates|timeperiods
            )      - cleanup for a particular type of object
            Another possible keys:
            --ask  - Ask before delete any element
            --diff - Be verbose
            --dump - Dump unused object
    
    copy-host - Make a clone(s) of a host with all its services.
            --host source_host
            -d|--dest hostname|READ_FILE=file [-d dest2 -d dest3]
    
    copy-service - Make a clone(s) of a service on one host.
            --service source_service
            -d|--dest service|READ_FILE=file [-d dest2 -d dest3]
            --host source_host
    
    delete-command - Delete command(s).
            -o command|/REGEX/|READ_FILE=file [-o object2 -o object3]
    
    delete-host - Delete one or more hosts.
            Possible arguments (may be multiple) are:
              -o <hostname>
              -g <hostgroupname>
            Arg values may be comma|space|semicolon separated names; 
              /regex/ or READ_FILE=filename macros.
    
    delete-hostgroup - Delete hostgroup(s).
            -o hostgroup_name|/REGEX/|READ_FILE=file [-o object2 -o object3]
    
    delete-service - Delete service(s) from host(s)
            Possible arguments (may be multiple) are:      
              -o <servicename>
              -d|--dest <hostname>
              -g|--group <hostgroupname>
            Arg values may be comma|space|semicolon separated names;
              /regex/ or READ_FILE=filename macros.
    
    dump - Dump all attributes for specified objects name and type.
            (--type host_templates|hostgroups|service_templates|
                    commands|contact_templates|contactgroups|contacts|
                    timeperiods|service_dependencies|host_dependencies
            ) or
            (--type services --host source_host)
    
            -o object_name|/REGEX/|READ_FILE=file [-o object2 -o object3]
    
    flush-cache - Delete objects cache from disk. Use this command after manual change of Nagios configs.
    
    list - List object's names of specified type.
            (--type host_templates|hostgroups|service_templates|
                    commands|contact_templates|contactgroups|contacts|
                    timeperiods|service_dependencies|host_dependencies
            ) or
            (--type services --host source_host)
    
            -o object_name|/REGEX/|READ_FILE=file [-o object2 -o object3]
    
    make-cfg - Generate nagios configuration files.
    
    modify-command - Modify attributes of one or more cpmmands.
            -o command|/REGEX/|READ_FILE=file [-o object2 -o object3]
            -p command_line="$USER1$/local/tryumount $SERVICESTATE$"
    
    modify-host - Modify attributes of one or more hosts.
            Possible arguments (may be multiple) are:
              -o <hostname>
              -g <hostgroupname>
              -p <key>=<value> (example: -p use=default-host -p contact_groups=some-admins)
              -r|--remove <attribute>
            Arg values may be comma|space|semicolon separated names;
              /regex/ or READ_FILE=filename macros.
    
    modify-hostgroup - Modify attributes of one or more hostgroups.
            -o hostgroup_name|/REGEX/|READ_FILE=file [-o object2 -o object3]
            -p property=value (example: -p alias='Web Servers')
            -r|--remove attribute|/REGEX/|READ_FILE=file [-r|--remove attribute2 -r|--remove attribute3]
    
    modify-item - Add|Delete counting values to an attribute. Like members in hostgroup.
            (--name object_name 
            --type  host_templates|hostgroups|service_templates|
                    commands|contact_templates|contactgroups|
                    contacts|timeperiods|service_dependencies|
                    host_dependencies
            ) or
            (--type hosts --host hostname [--service])
            --action add|delete
            --attr name (for example: members)
    
            -o object_name|/REGEX/|READ_FILE=file [-o object2 -o object3]
    
    modify-service - Modify service(s) attributes on host(s)
            Possible arguments (may be multiple) are:
              -o <servicename>
              -d|--dest <hostname>
              -g|--group <hostgroupname>
              -p <key>=<value> (example: -p use=default-service -p contact_groups=some-admins)
              -r|--remove <attribute>
            Arg values may be comma|space|semicolon separated names;
              /regex/ or READ_FILE=filename macros.
    
    renew-cache - Delete objects cache from disk, parse Nagios configs and make a new cache
    
    show-contactroup-members - Print a list of contactgroup members.
            -o <contactgroup>
            Arg values may be comma|space|semicolon separated names;
              /regex/ or READ_FILE=filename macros.
    
    show-hostgroup-members - Print a list of hostgroup members.
            -o <hostgroup>
            Arg values may be comma|space|semicolon separated names;
              /regex/ or READ_FILE=filename macros.
    
    show-membership - Show group names where hosts or contacts are members.
            -o object_name|/REGEX/|READ_FILE=file [-o object2 -o object3]
            --type hosts|contacts
    
    verify-cfg - Generate nagios configuration files in workspace for verification.

CREDITS

Thank you to Yandex team:

  Petya Kohts
  Dmitry Parfenov

for their bug reports, suggestions and contributions.

AUTHORS

Andrey Grunau <andrey-grunau@yandex.ru>

COPYRIGHT

Copyright 2008 - 2010 Andrey Grunau.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.