当前位置: 首页>>代码示例>>Python>>正文


Python nrpe.get_nagios_hostname方法代码示例

本文整理汇总了Python中charmhelpers.contrib.charmsupport.nrpe.get_nagios_hostname方法的典型用法代码示例。如果您正苦于以下问题:Python nrpe.get_nagios_hostname方法的具体用法?Python nrpe.get_nagios_hostname怎么用?Python nrpe.get_nagios_hostname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在charmhelpers.contrib.charmsupport.nrpe的用法示例。


在下文中一共展示了nrpe.get_nagios_hostname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config():
    # python-dbus is used by check_upstart_job
    apt_install('python-dbus')
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)
    nrpe.copy_nrpe_checks()
    nrpe.add_init_service_checks(nrpe_setup, services(), current_unit)
    nrpe.add_haproxy_checks(nrpe_setup, current_unit)
    api_port = determine_api_port(config('bind-port'),
                                  singlenode_mode=True)
    nrpe_setup.add_check(
        shortname="swift-proxy-healthcheck",
        description="Check Swift Proxy Healthcheck",
        check_cmd="/usr/lib/nagios/plugins/check_http \
                  -I localhost -u /healthcheck -p {} \
                  -e \"OK\"".format(api_port)
    )
    nrpe_setup.write() 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:21,代码来源:swift_hooks.py

示例2: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config():
    # python-dbus is used by check_upstart_job
    apt_install('python-dbus')
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)
    nrpe.copy_nrpe_checks()
    nrpe.add_init_service_checks(nrpe_setup, services(), current_unit)
    nrpe.add_haproxy_checks(nrpe_setup, current_unit)
    conf = nrpe_setup.config
    check_http_params = conf.get('nagios_check_http_params')
    if check_http_params:
        nrpe_setup.add_check(
            shortname='vhost',
            description='Check Virtual Host {%s}' % current_unit,
            check_cmd='check_http %s' % check_http_params
        )
    nrpe_setup.write() 
开发者ID:openstack,项目名称:charm-openstack-dashboard,代码行数:20,代码来源:horizon_hooks.py

示例3: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config():
    # python-dbus is used by check_upstart_job
    apt_install('python-dbus')
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)
    nrpe.copy_nrpe_checks()
    _services = []
    for service in services():
        if service.startswith('snap.'):
            service = service.split('.')[1]
        _services.append(service)
    nrpe.add_init_service_checks(nrpe_setup, _services, current_unit)
    nrpe.add_haproxy_checks(nrpe_setup, current_unit)
    nrpe_setup.write() 
开发者ID:openstack,项目名称:charm-keystone,代码行数:17,代码来源:keystone_hooks.py

示例4: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config():
    # python-dbus is used by check_upstart_job
    apt_install('python-dbus')
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)
    nrpe.copy_nrpe_checks()
    nrpe.add_init_service_checks(nrpe_setup, services(), current_unit)
    nrpe.add_haproxy_checks(nrpe_setup, current_unit)
    nrpe_setup.write() 
开发者ID:openstack,项目名称:charm-nova-cloud-controller,代码行数:12,代码来源:nova_cc_hooks.py

示例5: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config():
    # python-dbus is used by check_upstart_job
    apt_install('python-dbus')
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)
    monitored_services = services()
    try:
        # qemu-kvm is a one-shot service
        monitored_services.remove('qemu-kvm')
    except ValueError:
        pass
    nrpe.add_init_service_checks(nrpe_setup, monitored_services, current_unit)
    nrpe_setup.write() 
开发者ID:openstack,项目名称:charm-nova-compute,代码行数:16,代码来源:nova_compute_hooks.py

示例6: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config():
    # python-dbus is used by check_upstart_job
    apt_install('python3-dbus')
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)
    nrpe_setup.add_check(
        shortname='ceph-osd',
        description='process check {%s}' % current_unit,
        check_cmd=('/bin/cat /var/lib/ceph/osd/ceph-*/whoami |'
                   'xargs [email protected] status ceph-osd [email protected] && exit 0 || exit 2')
    )
    nrpe_setup.write() 
开发者ID:openstack,项目名称:charm-ceph-osd,代码行数:15,代码来源:ceph_hooks.py

示例7: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config():
    # python-dbus is used by check_upstart_job
    apt_install('python-dbus')
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)
    nrpe.copy_nrpe_checks()
    nrpe.add_init_service_checks(nrpe_setup, services(), current_unit)

    nrpe.add_haproxy_checks(nrpe_setup, current_unit)
    nrpe_setup.write() 
开发者ID:openstack,项目名称:charm-neutron-api,代码行数:13,代码来源:neutron_api_hooks.py

示例8: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config():
    # python-dbus is used by check_upstart_job
    apt_install(['python-dbus', 'lockfile-progs'])
    log('Refreshing nagios checks')
    if os.path.isdir(NAGIOS_PLUGINS):
        rsync(os.path.join(os.getenv('CHARM_DIR'), 'files', 'nagios',
                           'check_ceph_status.py'),
              os.path.join(NAGIOS_PLUGINS, 'check_ceph_status.py'))

    script = os.path.join(SCRIPTS_DIR, 'collect_ceph_status.sh')
    rsync(os.path.join(os.getenv('CHARM_DIR'), 'files',
                       'nagios', 'collect_ceph_status.sh'),
          script)
    cronjob = "{} root {}\n".format('*/5 * * * *', script)
    write_file(STATUS_CRONFILE, cronjob)

    # Find out if nrpe set nagios_hostname
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)
    check_cmd = 'check_ceph_status.py -f {} --degraded_thresh {}' \
        ' --misplaced_thresh {}' \
        ' --recovery_rate {}'.format(STATUS_FILE,
                                     config('nagios_degraded_thresh'),
                                     config('nagios_misplaced_thresh'),
                                     config('nagios_recovery_rate'))
    if config('nagios_ignore_nodeepscub'):
        check_cmd = check_cmd + ' --ignore_nodeepscrub'
    nrpe_setup.add_check(
        shortname="ceph",
        description='Check Ceph health {{{}}}'.format(current_unit),
        check_cmd=check_cmd
    )
    nrpe_setup.write() 
开发者ID:openstack,项目名称:charm-ceph-mon,代码行数:36,代码来源:ceph_hooks.py

示例9: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config():
    # python-dbus is used by check_upstart_job
    # lockfile-create is used by collect_ceph_status
    apt_install(['python-dbus', 'lockfile-progs'])
    log('Refreshing nagios checks')
    if os.path.isdir(NAGIOS_PLUGINS):
        rsync(os.path.join(os.getenv('CHARM_DIR'), 'files', 'nagios',
                           'check_ceph_status.py'),
              os.path.join(NAGIOS_PLUGINS, 'check_ceph_status.py'))

    script = os.path.join(SCRIPTS_DIR, 'collect_ceph_status.sh')
    rsync(os.path.join(os.getenv('CHARM_DIR'), 'files',
                       'nagios', 'collect_ceph_status.sh'),
          script)
    cronjob = "{} root {}\n".format('*/5 * * * *', script)
    write_file(STATUS_CRONFILE, cronjob)

    # Find out if nrpe set nagios_hostname
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)
    nrpe_setup.add_check(
        shortname="ceph",
        description='Check Ceph health {%s}' % current_unit,
        check_cmd='check_ceph_status.py -f {}'.format(STATUS_FILE)
    )
    nrpe_setup.write() 
开发者ID:openstack,项目名称:charm-ceph,代码行数:29,代码来源:ceph_hooks.py

示例10: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config(svc):
    # python-dbus is used by check_upstart_job
    fetch.apt_install('python-dbus')
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)
    nrpe.add_init_service_checks(nrpe_setup, [SVCNAME], current_unit)
    nrpe_setup.write() 
开发者ID:tasdomas,项目名称:juju-charm-prometheus,代码行数:10,代码来源:prometheus.py

示例11: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config():
    # python-dbus is used by check_upstart_job
    apt_install('python-dbus')
    log('Refreshing nrpe checks')
    if not os.path.exists(NAGIOS_PLUGINS):
        mkpath(NAGIOS_PLUGINS)
    rsync(os.path.join(os.getenv('CHARM_DIR'), 'files', 'nrpe-external-master',
                       'check_swift_storage.py'),
          os.path.join(NAGIOS_PLUGINS, 'check_swift_storage.py'))
    rsync(os.path.join(os.getenv('CHARM_DIR'), 'files', 'nrpe-external-master',
                       'check_swift_service'),
          os.path.join(NAGIOS_PLUGINS, 'check_swift_service'))
    rsync(os.path.join(os.getenv('CHARM_DIR'), 'files', 'sudo',
                       'swift-storage'),
          os.path.join(SUDOERS_D, 'swift-storage'))

    # Find out if nrpe set nagios_hostname
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)

    # check the rings and replication
    nrpe_setup.add_check(
        shortname='swift_storage',
        description='Check swift storage ring hashes and replication'
                    ' {%s}' % current_unit,
        check_cmd='check_swift_storage.py {}'.format(
            config('nagios-check-params'))
    )
    nrpe.add_init_service_checks(nrpe_setup, SWIFT_SVCS, current_unit)
    nrpe_setup.write() 
开发者ID:openstack,项目名称:charm-swift-storage,代码行数:33,代码来源:swift_storage_hooks.py

示例12: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config():
    # python-dbus is used by check_upstart_job
    apt_install('python-dbus')
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)
    nrpe.add_init_service_checks(nrpe_setup, ['mysql'], current_unit)
    nrpe_setup.add_check(
        shortname='mysql_proc',
        description='Check MySQL process {%s}' % current_unit,
        check_cmd='check_procs -c 1:1 -C mysqld'
    )
    nrpe_setup.write() 
开发者ID:openstack,项目名称:charm-percona-cluster,代码行数:15,代码来源:percona_hooks.py

示例13: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config():
    # python-dbus is used by check_upstart_job
    apt_install('python-dbus')
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname)
    nrpe.add_init_service_checks(nrpe_setup, services(), current_unit)
    nrpe_setup.write() 
开发者ID:openstack,项目名称:charm-ceilometer-agent,代码行数:10,代码来源:ceilometer_hooks.py

示例14: update_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def update_nrpe_config(unused=None):
    # List of systemd services that will be checked
    services = ('snap.etcd.etcd',)

    # The current nrpe-external-master interface doesn't handle a lot of logic,
    # use the charm-helpers code for now.
    hostname = nrpe.get_nagios_hostname()
    current_unit = nrpe.get_nagios_unit_name()
    nrpe_setup = nrpe.NRPE(hostname=hostname, primary=False)
    nrpe.add_init_service_checks(nrpe_setup, services, current_unit)
    nrpe_setup.write() 
开发者ID:juju-solutions,项目名称:layer-etcd,代码行数:13,代码来源:etcd.py

示例15: remove_nrpe_config

# 需要导入模块: from charmhelpers.contrib.charmsupport import nrpe [as 别名]
# 或者: from charmhelpers.contrib.charmsupport.nrpe import get_nagios_hostname [as 别名]
def remove_nrpe_config(nagios=None):
    remove_state('nrpe-external-master.initial-config')

    # List of systemd services for which the checks will be removed
    services = ('snap.etcd.etcd',)

    # The current nrpe-external-master interface doesn't handle a lot of logic,
    # use the charm-helpers code for now.
    hostname = nrpe.get_nagios_hostname()
    nrpe_setup = nrpe.NRPE(hostname=hostname, primary=False)

    for service in services:
        nrpe_setup.remove_check(shortname=service) 
开发者ID:juju-solutions,项目名称:layer-etcd,代码行数:15,代码来源:etcd.py


注:本文中的charmhelpers.contrib.charmsupport.nrpe.get_nagios_hostname方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。