示例#1
0
def run(url):
    log.info("Processing vo feed: %s" % url)

    # Get services from the VO feed, i.e
    # list of tuples (hostname, flavor, endpoint)
    feed = VOFeed(url)
    services = feed.get_services()

    # Add hosts, each tagged with corresponding flavors
    # creates /etc/ncgx/conf.d/generated_hosts.cfg
    h = Hosts()
    for service in services:
        h.add(service[0], tags=[service[1]])
    h.serialize()

    # Add corresponding metrics to tags
    # creates /etc/ncgx/conf.d/generated_checks.cfg
    c = Checks()
    c.add_all(CREAM_METRICS, tags=[
        "CREAM-CE",
    ])
    c.add_all(ARC_METRICS, tags=[
        "ARC-CE",
    ])
    c.add_all(CONDOR_METRICS, tags=[
        "HTCONDOR-CE",
    ])
    c.add_all(WN_METRICS, tags=["ARC-CE", "CREAM-CE", "HTCONDOR-CE"])
    c.add_all(SRM_METRICS, tags=[
        "SRMv2",
    ])

    for service in services:  # special handling for HTCONDOR-CEs (no BDII)
        if service[1] == 'HTCONDOR-CE':
            c.add(
                'org.sam.CONDOR-JobState-/lhcb/Role=production',
                (service[0], ),
                params={'args': {
                    '--resource': 'htcondor://%s' % service[0]
                }})
            c.add(
                'org.sam.CONDOR-JobState-/lhcb/Role=pilot', (service[0], ),
                params={'args': {
                    '--resource': 'htcondor://%s' % service[0]
                }})
    c.serialize()

    # Add host groups
    sites = feed.get_groups("LHCb_Site")
    hg = Groups("host_groups")
    for site, hosts in sites.iteritems():
        for host in hosts:
            hg.add(site, host)
    hg.serialize()
示例#2
0
def run():
    log.info("Processing webdav LHCb feed: %s" % len(HTTP_URIS))
    h = Hosts()
    c = Checks()
    for uri in HTTP_URIS:
        puri = urlparse.urlparse(uri)
        if puri.hostname:
            c.add('webdav.HTTP-All-/lhcb/Role=production',
                  hosts=(puri.hostname, ),
                  params={
                      'args': {
                          '--uri': uri
                      },
                      '_unique_tag': 'HTTPS'
                  })
            h.add(puri.hostname, tags=('HTTPS', ))
            for metric in WEBDAV_METRICS:
                c.add(metric,
                      hosts=(puri.hostname, ),
                      params={'_unique_tag': 'HTTPS'})
    h.serialize(fname='/etc/ncgx/conf.d/generated_hosts_webdav.cfg')
    c.serialize(fname='/etc/ncgx/conf.d/generated_webdav.cfg')