Table Of Contents

Previous topic

Set of examples related to Cloud object

Next topic

Frontier & Squid data related examples

Site Downtimes examples

See also

List downtimes

list_downtimes function or agis-list-downtimes CLI tool can be used to retrieve downtime information of a site being in.

>>> # initialize AGIS
>>> from agis.api.AGIS import AGIS
>>> a=AGIS(hostp='atlas-agis-api-dev.cern.ch:80')

Show only ongoing downtimes for sites:

>>> from datetime import datetime
>>> now = datetime.utcnow().replace(microsecond=0)
>>> r=a.list_downtimes(ongoing_time=now)
>>> r.keys()
[u'UTD-HEP']
>>> d=r['UTD-HEP'][0]
>>> print d.site, d.start_time, d.info_url, d.classification, d.severity, d.affected_services, d.description
UTD-HEP 2011-07-13 13:00:00 None SCHEDULED OUTAGE CE Maintenance and handling other site related issues.

Check specific site(s) or cloud:

>>> r=a.list_downtimes(ongoing_time=now, site='pic')
>>> r=a.list_downtimes(ongoing_time=now, site='PIC')
>>> r=a.list_downtimes(ongoing_time=now, cloud='US')
>>> r=a.list_downtimes(ongoing_time=now, tier_level=1)

bstart_time and bend_time parameters could be specified to filter by downtimes with the beginning time not earlier (not later) than start_time (end_time) values given.

For example, following snippet retrieves past and future downtimes separately:

>>> # get past downtimes for site 'pic'
>>> r=a.list_downtimes(bend_time=now, site='pic')
>>> # get future downtimes for site 'pic'
>>> r=a.list_downtimes(bstart_time=now, site='pic')

agis-list-downtimes tool could be used to quickly retrieve downtime’s info:

$ agis-list-downtimes --help

Show ongoing downtimes:

$ agis-list-downtimes --server=atlas-agis-api-dev.cern.ch:80
# AGIS: {'hostp': 'atlas-agis-api-dev.cern.ch'}
# query: {'ongoing_time': '2011-07-17 12:29:17'}
# site                  start_time           end_time             severity  classific.   aff.services    description #
UTD-HEP               2011-07-13 13:00:00  2011-07-20 13:00:00  OUTAGE    SCHEDULED    CE              Maintenance and handling other site related issues.
# found matches: 1

Filter by site: pic, show future downtimes only:

$ agis-list-downtimes --server=atlas-agis-api-dev.cern.ch:80 --site=pic --show=future

Other filters:

$ agis-list-downtimes --server=atlas-agis-api-dev.cern.ch:80 --tier_level=1 --cloud=US
$ agis-list-downtimes --server=atlas-agis-api-dev.cern.ch:80--ongoing_time="2011-07-01 12:00:00"

Retrieving a list of downtime affected services

Both list_downtimes function or agis-list-downtimes CLI tool allow to retrieve the list of affected services (e.g. SRM, CE, LFC, FTS) described in AGIS.

>>> # initialize AGIS
>>> from agis.api.AGIS import AGIS
>>> a=AGIS(hostp='atlas-agis-api-dev.cern.ch:80')

For example:

>>> r=a.list_downtimes(site='BU_ATLAS_Tier2', severity='outage')
>>> len(r['BU_ATLAS_Tier2'])
4
>>> print d.description, d.affected_services, d.start_time, d.end_time, d.site
OSG upgrade CE, SRMv2, GridFtp 2010-01-28 10:00:00 2010-01-28 23:00:00 BU_ATLAS_Tier2
>>> # extract list of affected Service objects
>>> len(d.services)
2
>>> s=d.services[0] # first affected service
>>> print s.site, s.state, s.type, s.endpoint
BU_ATLAS_Tier2 ACTIVE CE atlas.bu.edu:2119
>>> s=d.services[1] # second affected service
>>> print s.site, s.state, s.type, s.endpoint
BU_ATLAS_Tier2 ACTIVE SRM srm://atlas.bu.edu:8443/srm/v2/server

agis-list-downtimes --show-services option could be used to print a list of downtime affected services:

$ agis-list-downtimes --server=atlas-agis-api-dev.cern.ch:80 --show-services