parser=argparse.ArgumentParser(description='Schedule or remove powerdown downtimes via Icinga2 API')
parser=argparse.ArgumentParser(description='Schedule or remove downtimes via Icinga2 API (check out helpsection of subcommands for more options)')
parser.add_argument('--config',default='/etc/cip-monitoring-tools/icinga2-api.conf',help='path to the configuration file storing the Icinga2 API credentials.')
parser.add_argument('--host',default=socket.gethostname(),help='use this hostname to override local hostname.')
parser.add_argument('--downtime-start',type=int,default=curtime,help='start of the scheduled downtime as UNIX timestamp. (default: now)')
parser.add_argument('--downtime-end',type=int,default=curtime+7200,help='end of the scheduled downtime as UNIX timestamp. (default: in 2 hours)')
parser.add_argument('--downtime-author',default='powerdown',help='author of the scheduled downtime.')
parser.add_argument('--downtime-comment',default='Downtime scheduled by {}'.format(sys.argv[0]),help='comment for the scheduled downtime.')
parser_schedule=subparsers.add_parser('schedule',help='Schedules a downtime for the specified host including all of its services')
parser_remove=subparsers.add_parser('remove',help='Removes downtimes for specified host')
parser_service=subparsers.add_parser('services',help='Schedules downtime for a set of services (e.g. salt-highstate)')
parser_schedule.add_argument('--downtime-start',type=int,default=curtime,help='start of the scheduled downtime as UNIX timestamp. (default: now)')
parser_schedule.add_argument('--downtime-end',type=int,default=curtime+7200,help='end of the scheduled downtime as UNIX timestamp. (default: in 2 hours)')
parser_schedule.set_defaults(func=self.schedule)
parser_service.add_argument('--downtime-start',type=int,default=curtime,help='start of the scheduled downtime as UNIX timestamp. (default: now)')
parser_service.add_argument('--downtime-end',type=int,default=curtime+7200,help='end of the scheduled downtime as UNIX timestamp. (default: in 2 hours)')
parser_service.add_argument('--services',nargs='+',help='list of services to schedule a downtime for')