PKGCpython_surveilclient-0.13.3.data/data/share/surveil.bash_completion# bash completion for openstack surveil _surveil_opts="" # lazy init _surveil_flags="" # lazy init _surveil_opts_exp="" # lazy init _surveil() { local cur prev kbc COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" if [ "x$_surveil_opts" == "x" ] ; then kbc="`surveil bash-completion | sed -e "s/ -h / /"`" _surveil_opts="`echo "$kbc" | sed -e "s/--[a-z0-9_-]*//g" -e "s/[ ][ ]*/ /g"`" _surveil_flags="`echo " $kbc" | sed -e "s/ [^-][^-][a-z0-9_-]*//g" -e "s/[ ][ ]*/ /g"`" _surveil_opts_exp="`echo $_surveil_opts | sed -e "s/[ ]/|/g"`" fi if [[ " ${COMP_WORDS[@]} " =~ " "($_surveil_opts_exp)" " && "$prev" != "help" ]] ; then COMPREPLY=($(compgen -W "${_surveil_flags}" -- ${cur})) else COMPREPLY=($(compgen -W "${_surveil_opts}" -- ${cur})) fi return 0 } complete -o default -F _surveil surveil PKGsurveilclient/__init__.pyPKGk!zzsurveilclient/shell.py# Copyright 2014 - Savoir-Faire Linux inc. # Copyright (c) 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """ Command-line interface to the surveil API. """ from __future__ import print_function from surveilclient import client as surveil_client from surveilclient.common import utils from surveilclient import exc import argparse import sys class SurveilShell(object): default_api_version = '2_0' def __init__(self): self.parser = self.get_base_parser() def get_base_parser(self): parser = argparse.ArgumentParser( prog='surveil', description=__doc__.strip(), epilog='See "surveil help COMMAND" ' 'for help on a specific command.', add_help=False, formatter_class=HelpFormatter, ) parser.add_argument('-h', '--help', action='store_true') parser.add_argument('--surveil-api-url', default=utils.env( 'SURVEIL_API_URL', default='http://localhost:5311/v2'), help='Defaults to env[SURVEIL_API_URL].') parser.add_argument('--surveil-api-version', default=utils.env( 'SURVEIL_API_VERSION', default=self.default_api_version), help='Defaults to env[SURVEIL_API_VERSION] or %s' % self.default_api_version) parser.add_argument('-j', '--json', action='store_true', help='output raw json response') return parser def get_subcommand_parser(self, version=default_api_version): parser = self.get_base_parser() self.subcommands = {} subparsers = parser.add_subparsers(metavar='', dest='subcommand') submodule = utils.import_versioned_module(version, 'shell') self._find_actions(subparsers, submodule) self._find_actions(subparsers, self) self._add_bash_completion_subparser(subparsers) self.parser = parser return parser def _add_bash_completion_subparser(self, subparsers): subparser = subparsers.add_parser( 'bash_completion', add_help=False, formatter_class=HelpFormatter ) self.subcommands['bash_completion'] = subparser subparser.set_defaults(func=self.do_bash_completion) def _find_actions(self, subparsers, actions_module): for attr in (a for a in dir(actions_module) if a.startswith('do_')): # I prefer to be hyphen-separated instead of underscores. command = attr[3:].replace('_', '-') callback = getattr(actions_module, attr) desc = callback.__doc__ or '' help = desc.strip().split('\n')[0] arguments = getattr(callback, 'arguments', []) subparser = subparsers.add_parser(command, help=help, description=desc, formatter_class=HelpFormatter) self.subcommands[command] = subparser for (args, kwargs) in arguments: subparser.add_argument(*args, **kwargs) subparser.set_defaults(func=callback) @utils.arg('command', metavar='', nargs='?', help='Display help for .') def do_help(self, args=None): """Display help about this program or one of its subcommands.""" if getattr(args, 'command', None): if args.command in self.subcommands: self.subcommands[args.command].print_help() else: raise exc.CommandError("'%s' is not a valid subcommand" % args.command) else: self.parser.print_help() def do_bash_completion(self, args): """Prints all of the commands and options to stdout. The surveil.bash_completion script doesn't have to hard code them. """ commands = set() options = set() for sc_str, sc in self.subcommands.items(): commands.add(sc_str) for option in list(sc._optionals._option_string_actions): options.add(option) commands.remove('bash-completion') commands.remove('bash_completion') print(' '.join(commands | options)) def main(self, argv): cfg, args = self.parser.parse_known_args(argv) parser = self.get_subcommand_parser(cfg.surveil_api_version) if not argv or (cfg.help and not args): self.do_help() return 0 cfg = parser.parse_args(argv) if cfg.help or cfg.func == self.do_help: self.do_help(cfg) return 0 if cfg.func == self.do_bash_completion: self.do_bash_completion(cfg) return 0 endpoint = cfg.surveil_api_url if not endpoint: raise exc.CommandError("you must specify a Surveil API URL" " via either --surveil-api-url or" " env[SURVEIL_API_URL]") client = surveil_client.Client(endpoint, version=cfg.surveil_api_version) return cfg.func(client, cfg) class HelpFormatter(argparse.HelpFormatter): def start_section(self, heading): # Title-case the headings heading = '%s%s' % (heading[0].upper(), heading[1:]) super(HelpFormatter, self).start_section(heading) def main(): try: SurveilShell().main(sys.argv[1:]) except exc.CommandError as err: print(err, file=sys.stderr) sys.exit(1) except KeyboardInterrupt: print("... terminating surveil client", file=sys.stderr) sys.exit(130) except Exception as e: import traceback print(str(e), file=sys.stderr) print(traceback.format_exc()) sys.exit(1) if __name__ == "__main__": main() PKG`Ièsurveilclient/exc.py# Copyright 2014 - Savoir-Faire Linux inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import json class CommandError(BaseException): """Invalid usage of CLI.""" class ClientException(Exception): """The base exception class for all exceptions this library raises.""" pass class HttpError(ClientException): """The base exception class for all HTTP exceptions.""" http_status = 0 message = "HTTP Error" def __init__(self, message=None, details=None, response=None, request_id=None, url=None, method=None, http_status=None): self.http_status = http_status or self.http_status self.message = message or self.message self.details = details self.request_id = request_id self.response = response self.url = url self.method = method formatted_string = "%s (HTTP %s)" % (self.message, self.http_status) if request_id: formatted_string += " (Request-ID: %s)" % request_id super(HttpError, self).__init__(formatted_string) def from_response(response, body, method, url): """Returns an instance of :class:`HttpError` or subclass based on response. :param response: instance of `requests.Response` class :param method: HTTP method used for request :param url: URL used for request """ if response.getheader('Content-Type').startswith('application/json'): try: loaded_body = json.loads(body) if 'faultstring' in loaded_body: body = loaded_body['faultstring'] except ValueError: pass return HttpError( response=response, url=url, method=method, http_status=response.status, message=body )PKGL<<surveilclient/client.py# Copyright (c) 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from surveilclient.common import utils def Client(*args, **kwargs): version = kwargs.pop('version', '2_0') module = utils.import_versioned_module(version, 'client') return module.Client(*args, **kwargs) PKGsurveilclient/v2_0/__init__.pyPKG`#surveilclient/v2_0/shell.py# Copyright 2014-2015 - Savoir-Faire Linux inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import json from surveilclient.common import utils from surveilclient.openstack.common import cliutils def _dict_from_args(args, arg_names): result = {} for arg in arg_names: value = getattr(args, arg, None) if value is not None: result[arg] = value return result @cliutils.arg("--business_impact_modulation_name", help="New name of the business impact modulation") @cliutils.arg("--business_impact") @cliutils.arg("--modulation_period") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_businessimpactmodulation_list(sc, args): """List all config business impact modulations.""" arg_names = ['business_impact_modulation_name', 'business_impact', 'modulation_period', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) businessimpactmodulations = sc.config.businessimpactmodulations.list(lq) if args.json: print(utils.json_formatter(businessimpactmodulations)) else: cols = [ 'business_impact_modulation_name', 'business_impact', 'modulation_period' ] formatters = { 'business_impact_modulation_name': lambda x: x.get( 'business_impact_modulation_name', ''), 'business_impact': lambda x: x.get('business_impact', ''), 'modulation_period': lambda x: x.get('modulation_period', '') } utils.print_list(businessimpactmodulations, cols, formatters=formatters) @cliutils.arg("--original_business_impact_modulation_name", help="Original name of the business impact modulation") @cliutils.arg("--business_impact_modulation_name", help="New name of the business impact modulation") @cliutils.arg("--business_impact") @cliutils.arg("--modulation_period") def do_config_businessimpactmodulation_update(sc, args): """Update a config business impact modulation.""" arg_names = ['business_impact_modulation_name', 'business_impact', 'modulation_period' ] businessimpactmodulation = _dict_from_args(args, arg_names) sc.config.businessimpactmodulations.update( args.original_business_impact_modulation_name, businessimpactmodulation) @cliutils.arg("--business_impact_modulation_name", help="Name of the business impact modulation") @cliutils.arg("--business_impact") @cliutils.arg("--modulation_period") def do_config_businessimpactmodulation_create(sc, args): """Create a config business impact modulation.""" arg_names = ['business_impact_modulation_name', 'business_impact', 'modulation_period' ] businessimpactmodulation = _dict_from_args(args, arg_names) sc.config.businessimpactmodulations.create(**businessimpactmodulation) @cliutils.arg("--business_impact_modulation_name", help="Name of the business impact modulation") def do_config_businessimpactmodulation_show(sc, args): """Show a specific business impact modulation.""" businessimpactmodulation = sc.config.businessimpactmodulations.get( args.business_impact_modulation_name) if args.json: print(utils.json_formatter(businessimpactmodulation)) elif businessimpactmodulation: """ Specify the shown order and all the properties to display """ businessimpactmodulationProperties = [ 'business_impact_modulation_name', 'business_impact', 'modulation_period'] utils.print_item(businessimpactmodulation, businessimpactmodulationProperties) @cliutils.arg("--business_impact_modulation_name", help="Name of the business impact modulation") def do_config_businessimpactmodulation_delete(sc, args): """Delete a config business impact modulation.""" sc.config.businessimpactmodulations.delete( args.business_impact_modulation_name) @cliutils.arg("--checkmodulation_name", help="New name of the check modulation") @cliutils.arg("--check_command") @cliutils.arg("--check_period") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_checkmodulation_list(sc, args): """List all config check modulations.""" arg_names = ['checkmodulation_name', 'check_command', 'check_period', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) checkmodulations = sc.config.checkmodulations.list(lq) if args.json: print(utils.json_formatter(checkmodulations)) else: cols = [ 'checkmodulation_name', 'check_command', 'check_period' ] formatters = { 'checkmodulation_name': lambda x: x.get('checkmodulation_name', ''), 'check_command': lambda x: x.get('check_command', ''), 'check_period': lambda x: x.get('check_period', '') } utils.print_list(checkmodulations, cols, formatters=formatters) @cliutils.arg("original_checkmodulation_name", help="Original name of the check modulation") @cliutils.arg("--checkmodulation_name", help="New name of the check modulation") @cliutils.arg("--check_command") @cliutils.arg("--check_period") def do_config_checkmodulation_update(sc, args): """Update a config check modulation.""" arg_names = ['checkmodulation_name', 'check_command', 'check_period' ] checkmodulation = _dict_from_args(args, arg_names) sc.config.checkmodulations.update( args.original_checkmodulation_name, checkmodulation) @cliutils.arg("--checkmodulation_name") @cliutils.arg("--check_command") @cliutils.arg("--check_period") def do_config_checkmodulation_create(sc, args): """Create a config check modulation.""" arg_names = ['checkmodulation_name', 'check_command', 'check_period' ] checkmodulation = _dict_from_args(args, arg_names) sc.config.checkmodulations.create(**checkmodulation) @cliutils.arg("--checkmodulation_name", help="Name of the check modulation") def do_config_checkmodulation_show(sc, args): """Show a specific check modulation.""" checkmodulation = sc.config.checkmodulations.get(args.checkmodulation_name) if args.json: print(utils.json_formatter(checkmodulation)) elif checkmodulation: """ Specify the shown order and all the properties to display """ checkmodulationProperties = [ 'checkmodulation_name', 'check_command', 'check_period'] utils.print_item(checkmodulation, checkmodulationProperties) @cliutils.arg("--checkmodulation_name", help="Name of the check modulation") def do_config_checkmodulation_delete(sc, args): """Delete a config check modulation.""" sc.config.checkmodulations.delete(args.checkmodulation_name) @cliutils.arg("--command_name", help="New name of the command") @cliutils.arg("--command_line", help="Address of the command") @cliutils.arg("--module_type") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_command_list(sc, args): """List all config commands.""" arg_names = ['command_name', 'command_line', 'module_type', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) commands = sc.config.commands.list(lq) if args.json: print(utils.json_formatter(commands)) else: cols = [ 'command_name', 'command_line', 'module_type' ] formatters = { 'command_name': lambda x: x.get('command_name', ''), 'command_line': lambda x: x.get('command_line', ''), 'module_type': lambda x: x.get('module_type', ''), } utils.print_list(commands, cols, formatters=formatters) @cliutils.arg("original_command_name", help="Original name of the command") @cliutils.arg("--command_name", help="New name of the command") @cliutils.arg("--command_line", help="Address of the command") @cliutils.arg("--module_type") def do_config_command_update(sc, args): """Update a config command.""" arg_names = ['command_name', 'command_line', 'module_type'] command = _dict_from_args(args, arg_names) sc.config.commands.update(args.original_command_name, command) @cliutils.arg("--command_name") @cliutils.arg("--command_line") @cliutils.arg("--module_type") def do_config_command_create(sc, args): """Create a config command.""" arg_names = ['command_name', 'command_line', 'module_type'] command = _dict_from_args(args, arg_names) sc.config.commands.create(**command) @cliutils.arg("--command_name", help="Name of the command") def do_config_command_show(sc, args): """Show a specific command.""" command = sc.config.commands.get(args.command_name) if args.json: print(utils.json_formatter(command)) elif command: """ Specify the shown order and all the properties to display """ command_properties = [ 'command_name', 'command_line', 'module_type' ] utils.print_item(command, command_properties) @cliutils.arg("--command_name", help="Name of the command") def do_config_command_delete(sc, args): """Delete a config command.""" sc.config.commands.delete(args.command_name) @cliutils.arg("--contactgroup_name", help="New name of the contactgroup") @cliutils.arg("--members") @cliutils.arg("--alias") @cliutils.arg("--contactgroup_members") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_contactgroup_list(sc, args): """List all contact groups.""" arg_names = ['contactgroup_name', 'members', 'alias', 'contactgroup_members', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) contactgroups = sc.config.contactgroups.list(lq) if args.json: print(utils.json_formatter(contactgroups)) else: cols = [ 'contactgroup_name', 'members', 'alias', 'contactgroup_members' ] formatters = { 'contactgroup_name': lambda x: x.get('contactgroup_name', ''), 'members': lambda x: x.get('members', ''), 'alias': lambda x: x.get('alias', ''), 'contactgroup_members': lambda x: x.get('contactgroup_members', '') } utils.print_list(contactgroups, cols, formatters=formatters) @cliutils.arg("original_contactgroup_name", help="Original name of the contact group") @cliutils.arg("--contactgroup_name", help="New name of the contactgroup") @cliutils.arg("--members", nargs='+') @cliutils.arg("--alias") @cliutils.arg("--contactgroup_members", nargs='+') def do_config_contactgroup_update(sc, args): """Update a config contact group.""" arg_names = ['contactgroup_name', 'members', 'alias', 'contactgroup_members' ] contactgroup = _dict_from_args(args, arg_names) sc.config.contactgroups.update( args.original_contactgroup_name, contactgroup) @cliutils.arg("--contactgroup_name", help="New name of the contactgroup") @cliutils.arg("--members", nargs='+') @cliutils.arg("--alias") @cliutils.arg("--contactgroup_members", nargs='+') def do_config_contactgroup_create(sc, args): """Create a config contact group.""" arg_names = ['contactgroup_name', 'members', 'alias', 'contactgroup_members' ] contactgroup = _dict_from_args(args, arg_names) sc.config.contactgroups.create(**contactgroup) @cliutils.arg("--contactgroup_name", help="Name of the contact group") def do_config_contactgroup_show(sc, args): """Show a specific contact group.""" contactgroup = sc.config.contactgroups.get(args.contactgroup_name) if args.json: print(utils.json_formatter(contactgroup)) elif contactgroup: """ Specify the shown order and all the properties to display """ contactgroupProperties = [ 'contactgroup_name', 'members', 'alias', 'contactgroup_members' ] utils.print_item(contactgroup, contactgroupProperties) @cliutils.arg("--contactgroup_name", help="Name of the contact group") def do_config_contactgroup_delete(sc, args): """Delete a config contact group.""" sc.config.contactgroups.delete(args.contactgroup_name) @cliutils.arg("--contact_name", help="New name of the contact") @cliutils.arg("--host_notifications_enabled") @cliutils.arg("--service_notifications_enabled") @cliutils.arg("--host_notification_period") @cliutils.arg("--service_notification_period") @cliutils.arg("--host_notification_options") @cliutils.arg("--service_notification_options") @cliutils.arg("--host_notification_commands") @cliutils.arg("--service_notification_commands") @cliutils.arg("--email") @cliutils.arg("--pager") @cliutils.arg("--can_submit_commands") @cliutils.arg("--is_admin") @cliutils.arg("--retain_status_information") @cliutils.arg("--retain_nonstatus_information") @cliutils.arg("--min_business_impact") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_contact_list(sc, args): """List all contacts.""" arg_names = ['contact_name', 'host_notifications_enabled', 'service_notifications_enabled', 'host_notification_period', 'service_notification_period', 'host_notification_options', 'service_notification_options', 'host_notification_commands', 'service_notification_commands', 'email', 'pager', 'can_submit_commands', 'is_admin', 'retain_status_information', 'retain_nonstatus_information', 'min_business_impact', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) contacts = sc.config.contacts.list(lq) if args.json: print(utils.json_formatter(contacts)) else: cols = [ 'contact_name', 'host_notifications_enabled', 'service_notifications_enabled', 'host_notification_period', 'service_notification_period', 'host_notification_options', 'service_notification_options', 'host_notification_commands', 'service_notification_commands', 'email', 'pager', 'can_submit_commands', 'is_admin', 'retain_status_information', 'retain_nonstatus_information', 'min_business_impact' ] formatters = { 'contact_name': lambda x: x.get('contact_name', ''), 'host_notifications_enabled': lambda x: x.get( 'host_notifications_enabled', ''), 'service_notifications_enabled': lambda x: x.get( 'service_notifications_enabled', ''), 'host_notification_period': lambda x: x.get( 'host_notification_period', ''), 'service_notification_period': lambda x: x.get( 'service_notification_period', ''), 'host_notification_options': lambda x: x.get( 'host_notification_options', ''), 'service_notification_options': lambda x: x.get( 'service_notification_options', ''), 'host_notification_commands': lambda x: x.get( 'host_notification_commands', ''), 'service_notification_commands': lambda x: x.get( 'service_notification_commands', ''), 'email': lambda x: x.get('email', ''), 'pager': lambda x: x.get('pager', ''), 'can_submit_commands': lambda x: x.get('can_submit_commands', ''), 'is_admin': lambda x: x.get('is_admin', ''), 'retain_status_information': lambda x: x.get( 'retain_status_information', ''), 'retain_nonstatus_information': lambda x: x.get( 'retain_nonstatus_information', ''), 'min_business_impact': lambda x: x.get('min_business_impact', '') } utils.print_list(contacts, cols, formatters=formatters) @cliutils.arg("original_contact_name", help="Original name of the contact ") @cliutils.arg("--contact_name", help="New name of the contact") @cliutils.arg("--host_notifications_enabled") @cliutils.arg("--service_notifications_enabled") @cliutils.arg("--host_notification_period") @cliutils.arg("--service_notification_period") @cliutils.arg("--host_notification_options", nargs='+') @cliutils.arg("--service_notification_options", nargs='+') @cliutils.arg("--host_notification_commands", nargs='+') @cliutils.arg("--service_notification_commands", nargs='+') @cliutils.arg("--email") @cliutils.arg("--pager") @cliutils.arg("--can_submit_commands") @cliutils.arg("--is_admin") @cliutils.arg("--retain_status_information", nargs='+') @cliutils.arg("--retain_nonstatus_information", nargs='+') @cliutils.arg("--min_business_impact") def do_config_contact_update(sc, args): """Update a config contact.""" arg_names = [ 'contact_name', 'host_notifications_enabled', 'service_notifications_enabled', 'host_notification_period', 'service_notification_period', 'host_notification_options', 'service_notification_options', 'host_notification_commands', 'service_notification_commands', 'email', 'pager', 'can_submit_commands', 'is_admin', 'retain_status_information', 'retain_nonstatus_information', 'min_business_impact' ] contact = _dict_from_args(args, arg_names) sc.config.contacts.update( args.original_contact_name, contact) @cliutils.arg("--contact_name", help="New name of the contact") @cliutils.arg("--host_notifications_enabled") @cliutils.arg("--service_notifications_enabled") @cliutils.arg("--host_notification_period") @cliutils.arg("--service_notification_period") @cliutils.arg("--host_notification_options", nargs='+') @cliutils.arg("--service_notification_options", nargs='+') @cliutils.arg("--host_notification_commands", nargs='+') @cliutils.arg("--service_notification_commands", nargs='+') @cliutils.arg("--email") @cliutils.arg("--pager") @cliutils.arg("--can_submit_commands") @cliutils.arg("--is_admin") @cliutils.arg("--retain_status_information", nargs='+') @cliutils.arg("--retain_nonstatus_information", nargs='+') @cliutils.arg("--min_business_impact") def do_config_contact_create(sc, args): """Create a config contact.""" arg_names = [ 'contact_name', 'host_notifications_enabled', 'service_notifications_enabled', 'host_notification_period', 'service_notification_period', 'host_notification_options', 'service_notification_options', 'host_notification_commands', 'service_notification_commands', 'email', 'pager', 'can_submit_commands', 'is_admin', 'retain_status_information', 'retain_nonstatus_information', 'min_business_impact' ] contact = _dict_from_args(args, arg_names) sc.config.contacts.create(**contact) @cliutils.arg("--contact_name", help="Name of the contact") def do_config_contact_show(sc, args): """Show a specific contact.""" contact = sc.config.contacts.get(args.contact_name) if args.json: print(utils.json_formatter(contact)) elif contact: """ Specify the shown order and all the properties to display """ contactProperties = [ 'contact_name', 'host_notifications_enabled', 'service_notifications_enabled', 'host_notification_period', 'service_notification_period', 'host_notification_options', 'service_notification_options', 'host_notification_commands', 'service_notification_commands', 'email', 'pager', 'can_submit_commands', 'is_admin', 'retain_status_information', 'retain_nonstatus_information', 'min_business_impact' ] utils.print_item(contact, contactProperties) @cliutils.arg("--contact_name", help="Name of the contact") def do_config_contact_delete(sc, args): """Delete a config contact.""" sc.config.contacts.delete(args.contact_name) @cliutils.arg("--hostgroup_name", help="New name of the host group") @cliutils.arg("--members") @cliutils.arg("--alias") @cliutils.arg("--hostgroup_members") @cliutils.arg("--notes") @cliutils.arg("--notes_url") @cliutils.arg("--action_url") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_hostgroup_list(sc, args): """List all config host groups.""" arg_names = ['hostgroup_name', 'members', 'alias', 'hostgroup_members', 'notes', 'notes_url', 'action_url', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) hostgroups = sc.config.hostgroups.list(lq) if args.json: print(utils.json_formatter(hostgroups)) else: cols = [ 'hostgroup_name', 'members', 'alias', 'hostgroup_members', 'notes', 'notes_url', 'action_url' ] formatters = { 'hostgroup_name': lambda x: x.get('hostgroup_name', ''), 'members': lambda x: x.get('members', ''), 'alias': lambda x: x.get('alias', ''), 'hostgroup_members': lambda x: x.get('hostgroup_members', ''), 'notes': lambda x: x.get('notes', ''), 'notes_url': lambda x: x.get('notes_url', ''), 'action_url': lambda x: x.get('action_url', ''), } utils.print_list(hostgroups, cols, formatters=formatters) @cliutils.arg("original_hostgroup_name", help="Original name of the host group") @cliutils.arg("--hostgroup_name", help="New name of the host group") @cliutils.arg("--members") @cliutils.arg("--alias") @cliutils.arg("--hostgroup_members") @cliutils.arg("--notes") @cliutils.arg("--notes_url") @cliutils.arg("--action_url") def do_config_hostgroup_update(sc, args): """Create a config host group.""" arg_names = ['hostgroup_name', 'members', 'alias', 'hostgroup_members', 'notes', 'notes_url', 'action_url'] hostgroup = _dict_from_args(args, arg_names) sc.config.hostgroups.update(args.original_hostgroup_name, hostgroup) @cliutils.arg("--hostgroup_name", help="Name of the host group") @cliutils.arg("--members", nargs='+') @cliutils.arg("--alias") @cliutils.arg("--hostgroup_members", nargs='+') @cliutils.arg("--notes") @cliutils.arg("--notes_url") @cliutils.arg("--action_url") def do_config_hostgroup_create(sc, args): """Create a config host group.""" arg_names = ['hostgroup_name', 'members', 'alias', 'hostgroup_members', 'notes', 'notes_url', 'action_url'] hostgroup = _dict_from_args(args, arg_names) sc.config.hostgroups.create(**hostgroup) @cliutils.arg("--hostgroup_name", help="Name of the host") def do_config_hostgroup_show(sc, args): """Show a specific host group.""" hostgroup = sc.config.hostgroups.get(args.hostgroup_name) if args.json: print(utils.json_formatter(hostgroup)) elif hostgroup: """ Specify the shown order and all the properties to display """ hostgroupProperties = [ 'hostgroup_name', 'members', 'alias', 'hostgroup_members', 'notes', 'notes_url', 'action_url' ] utils.print_item(hostgroup, hostgroupProperties) @cliutils.arg("--hostgroup_name", help="Name of the host group") def do_config_hostgroup_delete(sc, args): """Delete a config host group.""" sc.config.hostgroups.delete(args.hostgroup_name) @cliutils.arg("--host_name", help="New name of the host") @cliutils.arg("--address", help="Address of the host") @cliutils.arg("--max_check_attempts") @cliutils.arg("--check_period") @cliutils.arg("--contacts", nargs='+') @cliutils.arg("--contact_groups", nargs='+') @cliutils.arg("--custom_fields") @cliutils.arg("--notification_interval") @cliutils.arg("--notification_period") @cliutils.arg("--use", nargs='+') @cliutils.arg("--name") @cliutils.arg("--register") @cliutils.arg("--check_interval") @cliutils.arg("--retry_interval") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_host_list(sc, args): """List all config hosts.""" arg_names = ['host_name', 'address', 'live_query', 'page_size', 'page', 'max_check_attempts', 'check_period', 'contacts', 'contact_groups', 'custom_fields', 'notification_interval', 'notification_period', 'use', 'name', 'register', 'check_interval', 'retry_interval' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) hosts = sc.config.hosts.list(lq) if args.json: print(utils.json_formatter(hosts)) else: cols = [ 'host_name', 'address', ] formatters = { 'host_name': lambda x: x.get('host_name', ''), 'address': lambda x: x.get('address', '') } utils.print_list(hosts, cols, formatters=formatters) @cliutils.arg("original_host_name", help="Original name of the host") @cliutils.arg("--host_name", help="New name of the host") @cliutils.arg("--address", help="Address of the host") @cliutils.arg("--max_check_attempts") @cliutils.arg("--check_period") @cliutils.arg("--contacts", nargs='+') @cliutils.arg("--contact_groups", nargs='+') @cliutils.arg("--custom_fields") @cliutils.arg("--notification_interval") @cliutils.arg("--notification_period") @cliutils.arg("--use", nargs='+') @cliutils.arg("--name") @cliutils.arg("--register") @cliutils.arg("--check_interval") @cliutils.arg("--retry_interval") def do_config_host_update(sc, args): """Update a config host.""" arg_names = ['host_name', 'address', 'max_check_attempts', 'check_period', 'contacts', 'contact_groups', 'custom_fields', 'notification_interval', 'notification_period', 'use', 'name', 'register', 'check_interval', 'retry_interval'] host = _dict_from_args(args, arg_names) sc.config.hosts.update(args.original_host_name, host) @cliutils.arg("--host_name", help="Name of the host") @cliutils.arg("--address", help="Address of the host") @cliutils.arg("--max_check_attempts") @cliutils.arg("--check_period") @cliutils.arg("--contacts", nargs='+') @cliutils.arg("--contact_groups", nargs='+') @cliutils.arg("--custom_fields") @cliutils.arg("--notification_interval") @cliutils.arg("--notification_period") @cliutils.arg("--use", nargs='+') @cliutils.arg("--name") @cliutils.arg("--register") @cliutils.arg("--check_interval") @cliutils.arg("--retry_interval") def do_config_host_create(sc, args): """Create a config host.""" arg_names = ['host_name', 'address', 'max_check_attempts', 'check_period', 'contacts', 'contact_groups', 'custom_fields', 'notification_interval', 'notification_period', 'use', 'name', 'register', 'check_interval', 'retry_interval'] host = _dict_from_args(args, arg_names) if "custom_fields" in host: host["custom_fields"] = json.loads(host["custom_fields"]) sc.config.hosts.create(**host) @cliutils.arg("--host_name", help="Name of the host") def do_config_host_show(sc, args): """Show a specific host.""" host = sc.config.hosts.get(args.host_name) if args.json: print(utils.json_formatter(host)) elif host: """ Specify the shown order and all the properties to display """ hostProperties = [ 'host_name', 'address', 'check_period', 'contact_groups', 'contacts', 'custom_fields', 'max_check_attempts', 'notification_interval', 'notification_period', 'use', 'name', 'register', 'check_interval', 'retry_interval' ] utils.print_item(host, hostProperties) @cliutils.arg("--host_name", help="Name of the host") def do_config_host_delete(sc, args): """Delete a config host.""" sc.config.hosts.delete(args.host_name) @cliutils.arg("--macromodulation_name", help="New name of the macromodulation") @cliutils.arg("--modulation_period") @cliutils.arg("--macros") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_macromodulation_list(sc, args): """List all config macromodulations.""" arg_names = ['macromodulation_name', 'modulation_period', 'macros' 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) macromodulations = sc.config.macromodulations.list(lq) if args.json: print(utils.json_formatter(macromodulations)) else: cols = [ 'macromodulation_name', 'modulation_period', 'macros' ] formatters = { 'macromodulation_name': lambda x: x.get( 'macromodulation_name', ''), 'modulation_period': lambda x: x.get('modulation_period', ''), 'macros': lambda x: x.get('macros', ''), } utils.print_list(macromodulations, cols, formatters=formatters) @cliutils.arg("original_macromodulation_name", help="Original name of the macromodulation") @cliutils.arg("--macromodulation_name", help="New name of the macromodulation") @cliutils.arg("--modulation_period") @cliutils.arg("--macros") def do_config_macromodulation_update(sc, args): """Update a config macromodulation.""" arg_names = ['macromodulation_name', 'modulation_period', 'macros'] macromodulation = _dict_from_args(args, arg_names) sc.config.macromodulations.update(args.original_macromodulation_name, macromodulation) @cliutils.arg("--macromodulation_name", help="Name of the macromodulation") @cliutils.arg("--modulation_period") @cliutils.arg("--macros") def do_config_macromodulation_create(sc, args): """Create a config macromodulation.""" arg_names = ['macromodulation_name', 'modulation_period', 'macros'] macromodulation = _dict_from_args(args, arg_names) if "macros" in macromodulation: macromodulation["macros"] = json.loads(macromodulation["macros"]) sc.config.macromodulations.create(**macromodulation) @cliutils.arg("--macromodulation_name", help="Name of the macromodulation") def do_config_macromodulation_show(sc, args): """Show a specific macromodulation.""" macromodulation = sc.config.macromodulations.get(args.macromodulation_name) if args.json: print(utils.json_formatter(macromodulation)) elif macromodulation: """ Specify the shown order and all the properties to display """ macromodulationProperties = ['macromodulation_name', 'modulation_period', 'macros' ] utils.print_item(macromodulation, macromodulationProperties) @cliutils.arg("--macromodulation_name", help="Name of the host") def do_config_macromodulation_delete(sc, args): """Delete a config macromodulation.""" sc.config.macromodulations.delete(args.macromodulation_name) @cliutils.arg("--notificationway_name", help="New name of the notificationway") @cliutils.arg("--host_notification_period") @cliutils.arg("--service_notification_period") @cliutils.arg("--host_notification_options", nargs='+') @cliutils.arg("--service_notification_options", nargs='+') @cliutils.arg("--host_notification_commands", nargs='+') @cliutils.arg("--service_notification_commands", nargs='+') @cliutils.arg("--min_business_impact") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_notificationway_list(sc, args): """List all config notificationways.""" arg_names = ['notificationway_name', 'host_notification_period', 'service_notification_period', 'host_notification_options', 'service_notification_options', 'service_notification_commands', 'host_notification_commands', 'min_business_impact', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) notificationways = sc.config.notificationways.list(lq) if args.json: print(utils.json_formatter(notificationways)) else: cols = [ 'notificationway_name', 'host_notification_period', 'service_notification_period', 'host_notification_options', 'service_notification_options', 'service_notification_commands', 'host_notification_commands' ] formatters = { 'notificationway_name': lambda x: x.get( 'notificationway_name', ''), 'host_notification_period': lambda x: x.get( 'host_notification_period', ''), 'service_notification_period': lambda x: x.get( 'service_notification_period', ''), 'host_notification_options': lambda x: x.get( 'host_notification_options', ''), 'service_notification_options': lambda x: x.get( 'service_notification_options', ''), 'host_notification_commands': lambda x: x.get( 'host_notification_commands', ''), 'service_notification_commands': lambda x: x.get( 'service_notification_commands', ''), } utils.print_list(notificationways, cols, formatters=formatters) @cliutils.arg("original_notificationway_name", help="Original name of the notificationway") @cliutils.arg("--notificationway_name", help="New name of the notificationway") @cliutils.arg("--host_notification_period") @cliutils.arg("--service_notification_period") @cliutils.arg("--host_notification_options", nargs='+') @cliutils.arg("--service_notification_options", nargs='+') @cliutils.arg("--host_notification_commands", nargs='+') @cliutils.arg("--service_notification_commands", nargs='+') @cliutils.arg("--min_business_impact") def do_config_notificationway_update(sc, args): """Update a config notificationway.""" arg_names = ['notificationway_name', 'host_notification_period', 'service_notification_period', 'host_notification_options', 'service_notification_options', 'service_notification_commands', 'host_notification_commands', 'min_business_impact'] notificationway = _dict_from_args(args, arg_names) sc.config.notificationways.update(args.original_notificationway_name, notificationway) @cliutils.arg("--notificationway_name", help="Name of the notificationway") @cliutils.arg("--host_notification_period") @cliutils.arg("--service_notification_period") @cliutils.arg("--host_notification_options", nargs='+') @cliutils.arg("--service_notification_options", nargs='+') @cliutils.arg("--host_notification_commands", nargs='+') @cliutils.arg("--service_notification_commands", nargs='+') @cliutils.arg("--min_business_impact") def do_config_notificationway_create(sc, args): """Create a config notificationway.""" arg_names = ['notificationway_name', 'host_notification_period', 'service_notification_period', 'host_notification_options', 'service_notification_options', 'service_notification_commands', 'host_notification_commands', 'min_business_impact'] notificationway = _dict_from_args(args, arg_names) sc.config.notificationways.create(**notificationway) @cliutils.arg("--notificationway_name", help="Name of the notificationway") def do_config_notificationway_show(sc, args): """Show a specific notificationway.""" notificationway = sc.config.notificationways.get(args.notificationway_name) if args.json: print(utils.json_formatter(notificationway)) elif notificationway: """ Specify the shown order and all the properties to display """ notificationwayProperties = [ 'notificationway_name', 'host_notification_period', 'service_notification_period', 'host_notification_options', 'service_notification_options', 'service_notification_commands', 'host_notification_commands', 'min_business_impact' ] utils.print_item(notificationway, notificationwayProperties) @cliutils.arg("--notificationway_name", help="Name of the notificationway") def do_config_notificationway_delete(sc, args): """Delete a config notificationway.""" sc.config.notificationways.delete(args.notificationway_name) @cliutils.arg("--realm_name", help="New name of the realm") @cliutils.arg("--realm_members", nargs='+') @cliutils.arg("--default") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_realm_list(sc, args): """List all config realms.""" arg_names = ['realm_name', 'realm_members', 'default', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) realms = sc.config.realms.list(lq) if args.json: print(utils.json_formatter(realms)) else: cols = [ 'realm_name', 'realm_members', 'default' ] formatters = { 'realm_name': lambda x: x.get('realm_name', ''), 'realm_members': lambda x: x.get('realm_members', ''), 'default': lambda x: x.get('default', '') } utils.print_list(realms, cols, formatters=formatters) @cliutils.arg("original_realm_name", help="Original name of the realm") @cliutils.arg("--realm_name", help="New name of the realm") @cliutils.arg("--realm_members", nargs='+') @cliutils.arg("--default") def do_config_realm_update(sc, args): """Update a config realm.""" arg_names = ['realm_name', 'realm_members', 'default'] realm = _dict_from_args(args, arg_names) sc.config.realms.update(args.original_realm_name, realm) @cliutils.arg("--realm_name", help="Name of the realm") @cliutils.arg("--realm_members", nargs='+') @cliutils.arg("--default") def do_config_realm_create(sc, args): """Create a config realm.""" arg_names = ['realm_name', 'realm_members', 'default'] realm = _dict_from_args(args, arg_names) sc.config.realms.create(**realm) @cliutils.arg("--realm_name", help="Name of the realm") def do_config_realm_show(sc, args): """Show a specific realm.""" realm = sc.config.realms.get(args.realm_name) if args.json: print(utils.json_formatter(realm)) elif realm: """ Specify the shown order and all the properties to display """ realmProperties = [ 'realm_name', 'realm_members', 'default' ] utils.print_item(realm, realmProperties) @cliutils.arg("--realm_name", help="Name of the realm") def do_config_realm_delete(sc, args): """Delete a config realm.""" sc.config.realms.delete(args.realm_name) @cliutils.arg("--servicegroup_name", help="New name of the service group") @cliutils.arg("--members") @cliutils.arg("--alias") @cliutils.arg("--servicegroup_members") @cliutils.arg("--notes") @cliutils.arg("--notes_url") @cliutils.arg("--action_url") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_servicegroup_list(sc, args): """List all config service groups.""" arg_names = ['servicegroup_name', 'members', 'alias', 'servicegroup_members', 'notes', 'notes_url', 'action_url', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) servicegroups = sc.config.servicegroups.list(lq) if args.json: print(utils.json_formatter(servicegroups)) else: cols = [ 'servicegroup_name', 'members', 'alias', 'servicegroup_members', 'notes', 'notes_url', 'action_url' ] formatters = { 'servicegroup_name': lambda x: x.get('servicegroup_name', ''), 'members': lambda x: x.get('members', ''), 'alias': lambda x: x.get('alias', ''), 'servicegroup_members': lambda x: x.get( 'servicegroup_members', ''), 'notes': lambda x: x.get('notes', ''), 'notes_url': lambda x: x.get('notes_url', ''), 'action_url': lambda x: x.get('action_url', '') } utils.print_list(servicegroups, cols, formatters=formatters) @cliutils.arg("original_servicegroup_name", help="Original name of the service group") @cliutils.arg("--servicegroup_name", help="New name of the service group") @cliutils.arg("--members", nargs='+') @cliutils.arg("--alias") @cliutils.arg("--servicegroup_members", nargs='+') @cliutils.arg("--notes") @cliutils.arg("--notes_url") @cliutils.arg("--action_url") def do_config_servicegroup_update(sc, args): """Update a config service group.""" arg_names = ['servicegroup_name', 'members', 'alias', 'servicegroup_members', 'notes', 'notes_url', 'action_url'] servicegroup = _dict_from_args(args, arg_names) sc.config.servicegroups.update(args.original_servicegroup_name, servicegroup) @cliutils.arg("--servicegroup_name", help="Name of the service group") @cliutils.arg("--members", nargs='+') @cliutils.arg("--alias") @cliutils.arg("--servicegroup_members", nargs='+') @cliutils.arg("--notes") @cliutils.arg("--notes_url") @cliutils.arg("--action_url") def do_config_servicegroup_create(sc, args): """Create a config service group.""" arg_names = ['servicegroup_name', 'members', 'alias', 'servicegroup_members', 'notes', 'notes_url', 'action_url'] servicegroup = _dict_from_args(args, arg_names) sc.config.servicegroups.create(**servicegroup) @cliutils.arg("--servicegroup_name", help="Name of the service group") def do_config_servicegroup_show(sc, args): """Show a specific service group.""" servicegroup = sc.config.servicegroups.get(args.servicegroup_name) if args.json: print(utils.json_formatter(servicegroup)) elif servicegroup: """ Specify the shown order and all the properties to display """ servicegroupProperties = ['servicegroup_name', 'members', 'alias', 'servicegroup_members', 'notes', 'notes_url', 'action_url' ] utils.print_item(servicegroup, servicegroupProperties) @cliutils.arg("--servicegroup_name", help="Name of the service group") def do_config_servicegroup_delete(sc, args): """Delete a config service group.""" sc.config.servicegroups.delete(args.servicegroup_name) @cliutils.arg("--host_name") @cliutils.arg("--service_description") @cliutils.arg("--check_command") @cliutils.arg("--max_check_attempts") @cliutils.arg("--check_interval") @cliutils.arg("--retry_interval") @cliutils.arg("--check_period") @cliutils.arg("--notification_interval") @cliutils.arg("--notification_period") @cliutils.arg("--contacts") @cliutils.arg("--contact_groups") @cliutils.arg("--passive_checks_enabled") @cliutils.arg("--use") @cliutils.arg("--name") @cliutils.arg("--register") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_service_list(sc, args): """List all config services.""" arg_names = ['host_name', 'service_description', 'check_command', 'max_check_attempts', 'check_interval', 'retry_interval', 'check_period', 'notification_interval', 'notification_period', 'contacts', 'contact_groups', 'passive_checks_enabled', 'use', 'name', 'register', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) services = sc.config.services.list(lq) if args.json: print(utils.json_formatter(services)) else: cols = [ 'host_name', 'service_description', 'check_period', 'contact_groups', ] formatters = { 'service_description': lambda x: x.get('service_description', ''), 'host_name': lambda x: x.get('host_name', ''), 'check_period': lambda x: x.get('check_period', ''), 'contact_groups': lambda x: x.get('contact_groups', ''), } utils.print_list(services, cols, formatters=formatters) @cliutils.arg("--host_name", nargs='+') @cliutils.arg("--service_description") @cliutils.arg("--check_command") @cliutils.arg("--max_check_attempts") @cliutils.arg("--check_interval") @cliutils.arg("--retry_interval") @cliutils.arg("--check_period") @cliutils.arg("--notification_interval") @cliutils.arg("--notification_period") @cliutils.arg("--contacts", nargs='+') @cliutils.arg("--contact_groups", nargs='+') @cliutils.arg("--passive_checks_enabled") @cliutils.arg("--use", nargs='+') @cliutils.arg("--name") @cliutils.arg("--register") def do_config_service_create(sc, args): """Create a config service.""" arg_names = ['host_name', 'service_description', 'check_command', 'max_check_attempts', 'check_interval', 'retry_interval', 'check_period', 'notification_interval', 'notification_period', 'contacts', 'contact_groups', 'passive_checks_enabled', 'use', 'name', 'register'] service = _dict_from_args(args, arg_names) sc.config.services.create(**service) @cliutils.arg("--host_name", help="Name of the host") @cliutils.arg("--service_description", help="The service_description") def do_config_service_delete(sc, args): """Create a config service.""" sc.config.services.delete(args.host_name, args.service_description) @cliutils.arg("--timeperiod_name", help="New name of the timeperiod") @cliutils.arg("--exclude") @cliutils.arg("--periods", nargs='+') @cliutils.arg("--alias") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_config_timeperiod_list(sc, args): """List all config timeperiods.""" arg_names = ['timeperiod_name', 'exclude', 'periods', 'alias', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) timeperiods = sc.config.timeperiods.list(lq) if args.json: print(utils.json_formatter(timeperiods)) else: cols = [ 'timeperiod_name', 'exclude', 'periods' ] formatters = { 'timeperiod_name': lambda x: x.get('timeperiod_name', ''), 'exclude': lambda x: x.get('exclude', ''), 'periods': lambda x: x.get('periods', '') } utils.print_list(timeperiods, cols, formatters=formatters) @cliutils.arg("original_timeperiod_name", help="Original name of the timeperiod") @cliutils.arg("--timeperiod_name", help="New name of the timeperiod") @cliutils.arg("--exclude") @cliutils.arg("--periods", nargs='+') @cliutils.arg("--alias") def do_config_timeperiod_update(sc, args): """Update a config timeperiod.""" arg_names = ['timeperiod_name', 'exclude', 'periods', 'alias'] timeperiod = _dict_from_args(args, arg_names) sc.config.timeperiods.update(args.original_timeperiod_name, timeperiod) @cliutils.arg("--timeperiod_name", help="Name of the timeperiod") @cliutils.arg("--exclude") @cliutils.arg("--periods", nargs='+') @cliutils.arg("--alias") def do_config_timeperiod_create(sc, args): """Create a config timeperiod.""" arg_names = ['timeperiod_name', 'exclude', 'periods', 'alias'] timeperiod = _dict_from_args(args, arg_names) sc.config.timeperiods.create(**timeperiod) @cliutils.arg("--timeperiod_name", help="Name of the timeperiod") def do_config_timeperiod_show(sc, args): """Show a specific timeperiod.""" timeperiod = sc.config.timeperiods.get(args.timeperiod_name) if args.json: print(utils.json_formatter(timeperiod)) elif timeperiod: """ Specify the shown order and all the properties to display """ timeperiodProperties = ['timeperiod_name', 'exclude', 'periods' ] utils.print_item(timeperiod, timeperiodProperties) @cliutils.arg("--timeperiod_name", help="Name of the timeperiod") def do_config_timeperiod_delete(sc, args): """Delete a config timeperiod.""" sc.config.timeperiods.delete(args.timeperiod_name) def do_config_reload(sc, args): """Trigger a config reload.""" print(sc.config.reload_config()['message']) @cliutils.arg("--host_name", help="Host Name") @cliutils.arg("--address", help="address") @cliutils.arg("--state", help="state") @cliutils.arg("--last_check", help="Last check") @cliutils.arg("--last_state_change", help="Last state change") @cliutils.arg("--long_output", help="Long output") @cliutils.arg("--services", help="Services") @cliutils.arg("--childs", help="childs") @cliutils.arg("--parents", help="Parents") @cliutils.arg("--description", help="description") @cliutils.arg("--acknowledge", help="Acknowledge") @cliutils.arg("--plugin_output", help="Plugin output") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_status_host_list(sc, args): """List all status hosts.""" arg_names = ['host_name', 'address', 'state', 'last_check', 'last_state_change', 'long_output', 'description', 'acknowledged', 'plugin_output', 'services', 'childs', 'parents', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) services = sc.status.hosts.list(lq) if args.json: print(utils.json_formatter(services)) else: cols = [ 'host_name', 'address', 'state', 'last_check', 'plugin_output', ] formatters = { 'host_name': lambda x: x.get('host_name', ''), 'address': lambda x: x.get('address', ''), 'state': lambda x: x.get('state', ''), 'last_check': lambda x: x.get('last_check', ''), 'plugin_output': lambda x: x.get('plugin_output', '')[0:30] + '...', } utils.print_list(services, cols, formatters=formatters) @cliutils.arg("--host_name", help="The host_name") def do_status_host_show(sc, args): host = sc.status.hosts.get(args.host_name) if args.json: print(utils.json_formatter(host)) elif host: hostProperties = [ 'host_name', 'address', 'state', 'last_check', 'last_state_change', 'long_output', 'description', 'acknowledged', 'plugin_output', 'services', 'childs', 'parents', ] utils.print_item(host, hostProperties) @cliutils.arg("--host_name", help="Host name") @cliutils.arg("--service_description", help="Service description") @cliutils.arg("--state", help="State") @cliutils.arg("--last_check", help="Last check") @cliutils.arg("--plugin_output", help="Plugin Output") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_status_service_list(sc, args): """List all status services.""" arg_names = ['host_name', 'service_description', 'state', 'last_check', 'plugin_output', 'live_query', 'page_size', 'page' ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) services = sc.status.services.list(lq) if args.json: print(utils.json_formatter(services)) else: cols = [ 'host_name', 'service_description', 'state', 'last_check', 'plugin_output', ] formatters = { 'host_name': lambda x: x.get('host_name', ''), 'service_description': lambda x: x.get('service_description', ''), 'state': lambda x: x.get('state', ''), 'last_check': lambda x: x.get('last_check', ''), 'plugin_output': lambda x: x.get('plugin_output', '')[0:30], } utils.print_list(services, cols, formatters=formatters) @cliutils.arg("--host_name", help="Name of the host") @cliutils.arg("--metric_name", help="Name of the metric") @cliutils.arg("--start_time", help="begin of the metric") @cliutils.arg("--end_time", help="end of the metric") @cliutils.arg("--service_description", help="Service description") @cliutils.arg("--live_query", help="Live query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") def do_status_metrics_list(sc, args): """List all status metrics.""" arg_names = ['host_name', 'metric_name', 'start_time', 'end_time', 'service_description', 'live_query', 'page_size', 'page', ] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) metrics = sc.status.hosts.metrics.list(lq) if args.json: print(utils.json_formatter(metrics)) else: cols = utils.get_columns(metrics, []) formatters = reduce(_create_format, cols, {}) utils.print_list(metrics, cols, formatters=formatters) @cliutils.arg("--host_name", help="Name of the host") @cliutils.arg("--metric_name", help="Name of the metric") @cliutils.arg("--service_description", help="Service description") def do_status_metrics_show(sc, args): """Give the last status metrics.""" arg_names = ['host_name', 'metric_name', 'service_description', ] arg = _dict_from_args(args, arg_names) metrics = sc.status.hosts.metrics.get(**arg) if args.json: print(utils.json_formatter(metrics)) else: if isinstance(metrics, dict): metrics = [metrics] cols = utils.get_columns(metrics, ['metric_name', ]) formatters = reduce(_create_format, cols, {}) utils.print_list(metrics, cols, formatters=formatters) @cliutils.arg("--host_name", help="Name of the host") @cliutils.arg("--service_description", help="Service description") @cliutils.arg("--output", help="The output of the plugin") @cliutils.arg("--return_code", help="The return code of the plugin") def do_status_submit_check_result(sc, args): """Submit a check result.""" if args.service_description: sc.status.services.submit_check_result( args.host_name, args.service_description, output=args.output, return_code=int(args.return_code), ) else: sc.status.hosts.submit_check_result( args.host_name, output=args.output, return_code=int(args.return_code), ) @cliutils.arg("--host_name", help="Name of the host") @cliutils.arg("--service_description", help="Service description") @cliutils.arg("--time_stamp") def do_action_recheck(sc, args): """Schedule a recheck.""" arg_names = ['host_name', 'service_description', 'time_stamp'] recheck = _dict_from_args(args, arg_names) sc.actions.recheck.create(**recheck) @cliutils.arg("--host_name", help="Name of the host") @cliutils.arg("--service_description", help="Service description") @cliutils.arg("--event_type", help="Event type") @cliutils.arg("--start_time", help="Start of the event to query") @cliutils.arg("--end_time", help="End of the event to query") @cliutils.arg("--page_size", help="Number of returned data") @cliutils.arg("--page", help="Page number") @cliutils.arg("--live_query", help="A live query") def do_status_events_list(sc, args): """List all events.""" arg_names = ['host_name', 'service_description', 'event_type', 'start_time', 'end_time', 'page_size', 'page', 'live_query'] arg_dict = _dict_from_args(args, arg_names) lq = utils.create_query(**arg_dict) events = sc.status.events.list(lq) if args.json: print(utils.json_formatter(events)) else: cols = utils.get_columns(events, ['host_name', 'service_description', 'event_type']) formatters = reduce(_create_format, cols, {}) utils.print_list(events, cols, formatters=formatters) def _create_format(init, col): init[col] = lambda x: x.get(col, '') return init PKGT((surveilclient/v2_0/client.py# Copyright 2015 - Savoir-Faire Linux inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os from surveilclient.common import http from surveilclient.v2_0 import actions from surveilclient.v2_0 import config from surveilclient.v2_0 import status class Client(object): """Client for the Surveil v2_0 API. :param string endpoint: The url of the surveil API """ def __init__(self, endpoint, username=os.environ.get('OS_USERNAME', None), password=os.environ.get('OS_PASSWORD', None), tenant_name=os.environ.get('OS_TENANT_NAME', None), auth_url=None): if auth_url is None: auth_url = os.environ.get( 'SURVEIL_AUTH_URL', os.environ.get('OS_AUTH_URL', endpoint + '/auth') ) if auth_url is None: raise Exception("Must specify auth url") self.http_client = http.HTTPClient( endpoint, username=username, password=password, tenant_name=tenant_name, auth_url=auth_url, ) self.config = config.ConfigManager(self.http_client) self.status = status.StatusManager(self.http_client) self.actions = actions.ActionsManager(self.http_client) PKG::/surveilclient/tests/v2_0/status/test_metrics.py# Copyright 2015 - Savoir-Faire Linux inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import httpretty from surveilclient.tests.v2_0 import clienttest class TestMetrics(clienttest.ClientTest): @httpretty.activate def test_list_host_metrics(self): httpretty.register_uri( httpretty.POST, "http://localhost:5311/v2/status/" "hosts/localhost/metrics/load1", body='[{"min": "2", "warning": "15", "value": "3"},' '{"min": "5", "warning": "200", "value": "150"}]' ) metrics = self.client.status.hosts.metrics.list( 'localhost', 'load1' ) self.assertEqual( metrics, [{"min": "2", "warning": "15", "value": "3"}, {"min": "5", "warning": "200", "value": "150"}] ) @httpretty.activate def test_list_host_metrics_service(self): httpretty.register_uri( httpretty.POST, "http://localhost:5311/v2/status/hosts/localhost" "/services/load/metrics/load1", body='[{"min": "2", "warning": "15", "value": "3"},' '{"min": "5", "warning": "200", "value": "150"}]' ) live_query = ('{"time_interval": { "start_time": ' '"2015-05-22T13:38:08Z",' '"end_time": "2015-05-22T13:38:08Z"}}') metrics = self.client.status.hosts.metrics.list('localhost', 'load1', 'load', query=live_query ) self.assertEqual( metrics, [{"min": "2", "warning": "15", "value": "3"}, {"min": "5", "warning": "200", "value": "150"}] ) @httpretty.activate def test_show_host_metrics(self): httpretty.register_uri( httpretty.GET, "http://localhost:5311/v2/status/hosts/localhost" "/metrics/load1", body='{"min": "2", "warning": "15", "value": "3"}' ) metrics = self.client.status.hosts.metrics.get('localhost', 'load1') self.assertEqual( metrics, {"min": "2", "warning": "15", "value": "3"} ) @httpretty.activate def test_show_host_service_metrics(self): httpretty.register_uri( httpretty.GET, "http://localhost:5311/v2/status/hosts/localhost" "/services/load/metrics/load1", body='{"value": "3"}' ) metrics = self.client.status.hosts.metrics.get('localhost', 'load1', 'load') self.assertEqual( metrics, {"value": "3"} ) @httpretty.activate def test_show_host_service(self): httpretty.register_uri( httpretty.GET, "http://localhost:5311/v2/status/hosts/localhost" "/services/load/metrics", body='[{"metric_name": "load1"},{"metric_name": "load5"}]' ) metrics = self.client.status.hosts.metrics.get( 'localhost', service_description='load') self.assertEqual( metrics, [{"metric_name": "load1"}, {"metric_name": "load5"}] ) PKG˼zz-surveilclient/tests/v2_0/status/test_hosts.py# Copyright 2015 - Savoir-Faire Linux inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import json import httpretty from surveilclient.tests.v2_0 import clienttest class TestHosts(clienttest.ClientTest): @httpretty.activate def test_list(self): httpretty.register_uri( httpretty.POST, "http://localhost:5311/v2/status/hosts", body='[{"host_name": "host1"}]' ) hosts = self.client.status.hosts.list() self.assertEqual( hosts, [{"host_name": "host1"}] ) @httpretty.activate def test_get(self): httpretty.register_uri( httpretty.GET, "http://localhost:5311/v2/status/hosts/hostname", body='{"host_name": "host1"}' ) host = self.client.status.hosts.get("hostname") self.assertEqual( host, {"host_name": "host1"} ) @httpretty.activate def test_submit_host_check_result(self): httpretty.register_uri( httpretty.POST, "http://localhost:5311/v2/status/hosts/localhost" "/results", body='' ) self.client.status.hosts.submit_check_result( "localhost", output="someoutput" ) self.assertEqual( json.loads(httpretty.last_request().body.decode()), {"output": u"someoutput"} )PKGAA(surveilclient/tests/common/test_utils.py# Copyright 2014 - Savoir-Faire Linux inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import json import unittest from surveilclient.common import utils class TestQuery(unittest.TestCase): def test_create_live_query(self): expected = {"filters": '{"is": {"host_name": ["toto"]}}', "paging": {"page": 15}} args = { "live_query": '{"filters":{"is":{"host_name":["toto"]}},' '"paging":{"page":15}}' } result = utils.create_query(**args) self.assertEqual(json.loads(result["filters"]), json.loads(expected["filters"])) self.assertEqual(result["paging"], expected["paging"]) def test_add_filters_to_live_query(self): expected = {"filters": '{"is": {"register": ["0"], ' '"host_name": ["toto"]}}', "paging": {"page_size": 15}} args = { "live_query": '{"filters":{"is":{"host_name":["toto"]}},' '"paging":{"page":10}}', "register": "0", "page_size": 15 } result = utils.create_query(**args) self.assertEqual(json.loads(result["filters"]), json.loads(expected["filters"])) self.assertEqual(result["paging"], expected["paging"]) PKG&surveilclient/tests/common/__init__.pyPKG<%'surveilclient/tests/common/test_http.py# Copyright 2014 - Savoir-Faire Linux inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import json import unittest import httpretty from surveilclient.common import http class TestHttp(unittest.TestCase): def setUp(self): self.surveil_url = 'http://surveil:5311/v1' self.client = http.HTTPClient(self.surveil_url, authenticated=False) @httpretty.activate def test_json_request_get(self): example_result = {'hello': 'surveil'} httpretty.register_uri(httpretty.GET, self.surveil_url + "/test", body=json.dumps(example_result)) resp, body = self.client.json_request('/test', 'GET') self.assertEqual(httpretty.last_request().method, 'GET') self.assertEqual(body, example_result) self.assertEqual( httpretty.last_request().headers['Content-Type'], 'application/json' ) PKG surveilclient/common/__init__.pyPKG9surveilclient/common/http.py# Copyright 2012 OpenStack Foundation # Copyright 2014 - Savoir-Faire Linux inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import requests import requests.exceptions from six.moves import http_client as httplib from surveilclient import exc from surveilclient.openstack.common.py3kcompat import urlutils import copy import json import time USER_AGENT = 'python-surveilclient' class HTTPClient(object): def __init__(self, endpoint, username=None, password=None, tenant_name=None, auth_url=None, authenticated=True): endpoint_parts = urlutils.urlparse(endpoint) self.endpoint_hostname = endpoint_parts.hostname self.endpoint_port = endpoint_parts.port self.endpoint_path = endpoint_parts.path self.authenticated = authenticated if self.authenticated: self.auth_username = username self.auth_password = password self.tenant_name = tenant_name self.auth_url = auth_url self.auth_token = {} def _token_valid(self): if self.auth_token.get('id', None) is None: return False # TODO(aviau): Check expiration date on token. return True def _get_auth_token(self): """Returns an auth token.""" if self._token_valid(): return self.auth_token['id'] auth_url = self.auth_url + '/tokens' credentials = {} resp = None for attempt in range(3): try: resp = requests.post(auth_url, data=json.dumps(credentials)) break except requests.exceptions.ConnectionError, exp: if attempt == 2: raise exp time.sleep(1) access = resp.json() self.auth_token = access['access']['token'] return self.auth_token['id'] def get_connection(self): # TODO(aviau): https con = httplib.HTTPConnection( self.endpoint_hostname, self.endpoint_port ) return con def _http_request(self, url, method, **kwargs): """Send an http request with the specified characteristics. Wrapper around httplib.HTTP(S)Connection.request to handle tasks such as setting headers and error handling. """ kwargs['headers'] = copy.deepcopy(kwargs.get('headers', {})) kwargs['headers'].setdefault('User-Agent', USER_AGENT) if self.authenticated: kwargs['headers']['X-Auth-Token'] = self._get_auth_token() conn = self.get_connection() request_params = urlutils.urlencode( kwargs.pop("params", {}) ) request_url = self.endpoint_path + url + '?' + request_params for attempt in range(3): try: conn.request(method, request_url, **kwargs) break except ( httplib.BadStatusLine, httplib.IncompleteRead ), exp: if attempt == 2: raise exp time.sleep(1) resp = conn.getresponse() body_str = resp.read() if 400 <= resp.status < 600: raise exc.from_response( response=resp, body=body_str, method=method, url=url) elif resp.status == 300: raise exc.from_response( response=resp, body=body_str, method=method, url=url) return resp, body_str def json_request(self, url, method, **kwargs): """Send an http request with the specified characteristics. """ kwargs['headers'] = copy.deepcopy(kwargs.get('headers', {})) kwargs['headers'].setdefault('Content-Type', 'application/json') if 'body' in kwargs: kwargs['body'] = json.dumps(kwargs['body']) resp, body = self.request(url, method, **kwargs) if body != "": body = json.loads(body) return resp, body def request(self, url, method, **kwargs): """Send an http request with the specified characteristics. """ kwargs['headers'] = copy.deepcopy(kwargs.get('headers', {})) resp, body = self._http_request(url, method, **kwargs) return resp, body.decode() PKGNAAsurveilclient/common/utils.py# Copyright (c) 2013 OpenStack Foundation # Copyright 2014 - Savoir-Faire Linux inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import json import os import prettytable from surveilclient.openstack.common import importutils try: from oslo_serialization import jsonutils except ImportError: from oslo.serialization import jsonutils # Decorator for cli-args def arg(*args, **kwargs): def _decorator(func): # Because of the semantics of decorator composition if we just append # to the options list positional options will appear to be backwards. func.__dict__.setdefault('arguments', []).insert(0, (args, kwargs)) return func return _decorator def env(*vars, **kwargs): """ returns the first environment variable set if none are non-empty, defaults to '' or keyword arg default """ for v in vars: value = os.environ.get(v, None) if value: return value return kwargs.get('default', '') def import_versioned_module(version, submodule=None): module = 'surveilclient.v%s' % version if submodule: module = '.'.join((module, submodule)) return importutils.import_module(module) def json_formatter(js): return jsonutils.dumps(js, indent=2, ensure_ascii=False) def print_item(objs, properties): """ Add the missing properties to the objs """ for prop in properties: if prop not in objs: objs[prop] = "" cols = [ 'Property', 'Value' ] """ Override the properties keys pass in parameter """ len_property_max = 0 for property in properties: if len(property) > len_property_max: len_property_max = len(property) # 80 char per line - 7 char (space or | ) len_available = 73 - len_property_max list = [] for property in properties: val_lines = [] if type(objs[property]) is list and objs[property]: value = json.dumps(objs[property]) else: value = objs[property].__str__() for i in range(0, len(value), len_available): val_lines.append(value[i:i + len_available]) val_lines = '\n'.join(val_lines) list.append({'prop': property, 'value': val_lines}) formatters = { 'Property': lambda x: x.get('prop', ''), 'Value': lambda x: x.get('value', ''), } print_list(list, cols, formatters=formatters) def print_list(objs, fields, field_labels=None, formatters={}, sortby=None): field_labels = field_labels or fields pt = prettytable.PrettyTable([f for f in field_labels], caching=False, print_empty=False) pt.align = 'l' for o in objs: row = [] for field in fields: if field in formatters: row.append(formatters[field](o)) else: data = getattr(o, field, None) or '' row.append(data) pt.add_row(row) if sortby is None: print(pt.get_string()) else: print(pt.get_string(sortby=field_labels[sortby])) def get_columns(lines, ordered_columns): columns_dict = {} for line in lines: for key, value in line.iteritems(): if value is not None: columns_dict[key] = True valid_columns = [] for col in ordered_columns: if col in columns_dict: valid_columns.append(col) del columns_dict[col] return valid_columns + sorted(columns_dict.keys()) def create_query(**kwargs): query = {} filters = {} paging = {} time = {} if kwargs: for arg in kwargs: if arg is 'live_query': query = json.loads(kwargs[arg]) elif arg in ['page_size', 'page']: paging[arg] = kwargs[arg] elif arg in ['start_time', 'end_time']: time[arg] = kwargs[arg] else: filters[arg] = [kwargs[arg]] if time: query["time_interval"] = time if paging: query["paging"] = paging if filters: if 'filters' not in query: query["filters"] = {} if 'is' not in query["filters"]: query["filters"]["is"] = filters else: query["filters"]["is"].update(filters) if 'filters' in query: query['filters'] = json.dumps(query['filters']) return query PKG!5-'surveilclient/common/surveil_manager.py# Copyright 2014 - Savoir-Faire Linux inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. class SurveilManager(object): def __init__(self, http_client): self.http_client = http_client PKG#surveilclient/openstack/__init__.pyPKG0Ib}}*surveilclient/openstack/common/cliutils.py# Copyright 2012 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. def add_arg(func, *args, **kwargs): """Bind CLI arguments to a shell.py `do_foo` function.""" if not hasattr(func, 'arguments'): func.arguments = [] # NOTE(sirp): avoid dups that can occur when the module is shared across # tests. if (args, kwargs) not in func.arguments: # Because of the semantics of decorator composition if we just append # to the options list positional options will appear to be backwards. func.arguments.insert(0, (args, kwargs)) def arg(*args, **kwargs): """Decorator for CLI args. Example: >>> @arg("name", help="Name of the new entity") ... def entity_create(args): ... pass """ def _decorator(func): add_arg(func, *args, **kwargs) return func return _decorator PKG*surveilclient/openstack/common/__init__.pyPKGEDsvv-surveilclient/openstack/common/importutils.py# -*- coding: utf-8 -*- # # Copyright 2011 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """ Import related utilities and helper functions. """ import sys import traceback def import_class(import_str): """Returns a class from a string including module and class""" mod_str, _sep, class_str = import_str.rpartition('.') try: __import__(mod_str) return getattr(sys.modules[mod_str], class_str) except (ValueError, AttributeError): raise ImportError('Class %s cannot be found (%s)' % (class_str, traceback.format_exception(*sys.exc_info()))) def import_object(import_str, *args, **kwargs): """Import a class and return an instance of it.""" return import_class(import_str)(*args, **kwargs) def import_object_ns(name_space, import_str, *args, **kwargs): """ Import a class and return an instance of it, first by trying to find the class in a default namespace, then failing back to a full path if not found in the default namespace. """ import_value = "%s.%s" % (name_space, import_str) try: return import_class(import_value)(*args, **kwargs) except ImportError: return import_class(import_str)(*args, **kwargs) def import_module(import_str): """Import a module.""" __import__(import_str) return sys.modules[import_str] def try_import(import_str, default=None): """Try to import a module and if it fails return default.""" try: return import_module(import_str) except ImportError: return default PKG5surveilclient/openstack/common/py3kcompat/__init__.pyPKG(35surveilclient/openstack/common/py3kcompat/urlutils.py# # Copyright 2013 Canonical Ltd. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # """ Python2/Python3 compatibility layer for OpenStack """ import six if six.PY3: # python3 import urllib.error import urllib.parse import urllib.request urlencode = urllib.parse.urlencode urljoin = urllib.parse.urljoin quote = urllib.parse.quote parse_qsl = urllib.parse.parse_qsl unquote = urllib.parse.unquote urlparse = urllib.parse.urlparse urlsplit = urllib.parse.urlsplit urlunsplit = urllib.parse.urlunsplit urlopen = urllib.request.urlopen URLError = urllib.error.URLError pathname2url = urllib.request.pathname2url else: # python2 import urllib import urllib2 import urlparse urlencode = urllib.urlencode quote = urllib.quote unquote = urllib.unquote parse = urlparse parse_qsl = parse.parse_qsl urljoin = parse.urljoin urlparse = parse.urlparse urlsplit = parse.urlsplit urlunsplit = parse.urlunsplit urlopen = urllib2.urlopen URLError = urllib2.URLError pathname2url = urllib.pathname2url PK|G((5python_surveilclient-0.13.3.dist-info/DESCRIPTION.rstPython bindings to the Surveil API ================================== This is a client library for Surveil built on the Surveil API. Command-line API ---------------- Installing this package gets you a shell command, ``surveil``, that you can use to interact with the Surveil API. You'll need to provide the Surveil API URL. You can do this with the ``--surveil-api-url`` parameter, but it's easier to just set it as environment variable:: export SURVEIL_API_URL=http://localhost:5311/v2 export SURVEIL_AUTH_URL=http://localhost:5311/v2/auth You'll find complete documentation on the shell by running ``surveil help``. Bash completion ~~~~~~~~~~~~~~~ Basic command tab completion can be enabled by sourcing the bash completion script:: source /usr/local/share/surveil.bash_completion Python API ---------- To use the python API, simply create a client with the endpoint:: from surveilclient import client c = client.Client('http://localhost:5311/v2', auth_url='http://localhost:5311/v2/auth', version='2_0') hosts = c.config.hosts.list() How to use it ------------- Config-host-update:: surveil config-host-update --host_name [host_name] --address [ADDRESS] --custom_fields '{"_field1": "value1", "_field2": "value2"}' PK|Gv#^666python_surveilclient-0.13.3.dist-info/entry_points.txt[console_scripts] surveil = surveilclient.shell:main PK|G3python_surveilclient-0.13.3.dist-info/metadata.json{"extensions": {"python.commands": {"wrap_console": {"surveil": "surveilclient.shell:main"}}, "python.details": {"document_names": {"description": "DESCRIPTION.rst"}}, "python.exports": {"console_scripts": {"surveil": "surveilclient.shell:main"}}}, "extras": [], "generator": "bdist_wheel (0.24.0)", "metadata_version": "2.0", "name": "python-surveilclient", "run_requires": [{"requires": ["oslo.serialization", "prettytable", "pbr", "six", "requests", "mock"]}], "summary": "Surveil API Client Library", "test_requires": [{"requires": ["hacking (>=0.9.2,<0.10)", "sphinx", "oslosphinx", "testrepository", "mox3 (>=0.7.0)", "httpretty (==0.8.3)"]}], "version": "0.13.3"}PK2Gbm...python_surveilclient-0.13.3.dist-info/pbr.json{"is_release": true, "git_version": "576dec1"}PK|Gҿ3python_surveilclient-0.13.3.dist-info/top_level.txtsurveilclient PK|G4\\+python_surveilclient-0.13.3.dist-info/WHEELWheel-Version: 1.0 Generator: bdist_wheel (0.24.0) Root-Is-Purelib: true Tag: py2-none-any PK|GT^vyy.python_surveilclient-0.13.3.dist-info/METADATAMetadata-Version: 2.0 Name: python-surveilclient Version: 0.13.3 Summary: Surveil API Client Library Home-page: UNKNOWN Author: UNKNOWN Author-email: UNKNOWN License: UNKNOWN Platform: UNKNOWN Requires-Dist: oslo.serialization Requires-Dist: prettytable Requires-Dist: pbr Requires-Dist: six Requires-Dist: requests Requires-Dist: mock Python bindings to the Surveil API ================================== This is a client library for Surveil built on the Surveil API. Command-line API ---------------- Installing this package gets you a shell command, ``surveil``, that you can use to interact with the Surveil API. You'll need to provide the Surveil API URL. You can do this with the ``--surveil-api-url`` parameter, but it's easier to just set it as environment variable:: export SURVEIL_API_URL=http://localhost:5311/v2 export SURVEIL_AUTH_URL=http://localhost:5311/v2/auth You'll find complete documentation on the shell by running ``surveil help``. Bash completion ~~~~~~~~~~~~~~~ Basic command tab completion can be enabled by sourcing the bash completion script:: source /usr/local/share/surveil.bash_completion Python API ---------- To use the python API, simply create a client with the endpoint:: from surveilclient import client c = client.Client('http://localhost:5311/v2', auth_url='http://localhost:5311/v2/auth', version='2_0') hosts = c.config.hosts.list() How to use it ------------- Config-host-update:: surveil config-host-update --host_name [host_name] --address [ADDRESS] --custom_fields '{"_field1": "value1", "_field2": "value2"}' PK|G]tF ,python_surveilclient-0.13.3.dist-info/RECORDpython_surveilclient-0.13.3.data/data/share/surveil.bash_completion,sha256=Hv4KRtG33P8FHxeWozD8Hhb4jvRXQReOabJdAIaVXUo,918 surveilclient/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/shell.py,sha256=K3pqy8AS82H8hFxR4CA4NeQlBbSQXsafiwv8bBGMp2w,6778 surveilclient/exc.py,sha256=1mdC9D5b9r-RCauGQNINSeYi15SE2saBZn0n-5JKrgs,2283 surveilclient/client.py,sha256=ySU7Bi4Ay8u-9NFO3NSJC37p0aA4W9ojOucz93qAT2g,828 surveilclient/v2_0/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/v2_0/shell.py,sha256=bxXa2SUsDgXL3oXue4mqEL-JdMUrCCpCqtsEhybeQ3o,63471 surveilclient/v2_0/client.py,sha256=GSI06hmocpPtutqWSdPRk5G8Bc8-eVMk7fqA5STOfGQ,1832 surveilclient/v2_0/actions/__init__.py,sha256=USTidt8rFK46TyeyLE3EWuSFLjRV7MOAGIN9owGKgKY,1171 surveilclient/v2_0/actions/acknowledge.py,sha256=IYEhRkKvGnH-nbnw0Aa7SGu1in9P-c7HK8t2ofznQ_4,925 surveilclient/v2_0/actions/recheck.py,sha256=Ti_KuHq2J0R1U8o_r8-2XQb56dBeLvAh3wv7lIvBBkE,917 surveilclient/v2_0/actions/downtime.py,sha256=vDBUVbHAFIqjx8VQANWtl-p5hKyUlqArZz8Vom1uQiQ,919 surveilclient/v2_0/config/hostgroups.py,sha256=zUxpy3xWThOVC7Uy4R5xr-Ih6X6jc-_C1DsQsGSuQf0,1978 surveilclient/v2_0/config/__init__.py,sha256=CeQpYFY5hy2ILcD-zS1RaXbNSZBDi-5xGp3Pm2sgnRU,2885 surveilclient/v2_0/config/notificationways.py,sha256=EfllCJokUcFNms2pc3iYcNmsrHtHPB_ZuEYtBeEVAJM,2114 surveilclient/v2_0/config/servicegroups.py,sha256=BYriSL5-Mpp2gqgUh1-6zD8zaaQpq0bGGFzHiyP4F38,2038 surveilclient/v2_0/config/services.py,sha256=6geVzQVAJ1sFStXlHEegU3R8PxG5tbTNgpTJ3-ZkrN8,1943 surveilclient/v2_0/config/contacts.py,sha256=zUXpnoqj-6ekVn1M9BWY8q0hYXg09qEMTEgdwIQ-EtM,1926 surveilclient/v2_0/config/timeperiods.py,sha256=hsxZIt_cjtUOyjnX8e0J3p9B9qfKtoXyA8YgQC1iWgk,1998 surveilclient/v2_0/config/hosts.py,sha256=NDbwvtoTRflL4viOCtFbtnCx1KOmGANKwezXI0UqYyY,2308 surveilclient/v2_0/config/macromodulations.py,sha256=Sj8RkKPRXiRcb5u7QVnzvRoOLOcHL2to9yNvZKZXRgM,2122 surveilclient/v2_0/config/checkmodulations.py,sha256=9fpxo1iSC52eddHUOzHnZvNVrNyboIorZ7gxHradq9A,2108 surveilclient/v2_0/config/contactgroups.py,sha256=83k2ENlr6Nssnl0X9PP_BHLgEIabX0tdBnqm6UWIASE,2038 surveilclient/v2_0/config/businessimpactmodulations.py,sha256=keHl4v0V1fAVELBYOjKvMEYj_I4ONW4Bwge9U1ob83k,2312 surveilclient/v2_0/config/commands.py,sha256=xWk3G9LHM4PuRUyvWeFiCxLQGZHULHGODWrbCpOTaog,1938 surveilclient/v2_0/config/realms.py,sha256=5xK7pxZb9LNK-d-G5HkMaAYZYbH6lYF4jjLtVew4u3c,1898 surveilclient/v2_0/status/__init__.py,sha256=BNorGtCZrTxSt8Lc5aQamjihOZQL70BrkfvJXX0yhR8,1137 surveilclient/v2_0/status/services.py,sha256=7c5pvNZK0JGOptAG3TWBMqaDx8nyitNSUp_-dprUkSA,1356 surveilclient/v2_0/status/hosts.py,sha256=N8gMe6W35kyXTiOejYQPWoCvk6Hej28v7NduXWZ4TrE,1655 surveilclient/v2_0/status/events.py,sha256=8OaZ_dUlA7qEmbsC9z1ummEBgP6FS9sMUuLpP-4NkpA,957 surveilclient/v2_0/status/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/v2_0/status/metrics/metrics.py,sha256=iLJJFL-uIeyKvpBzCsx5odveflQ4hdx9elWHy9NR-Wk,1712 surveilclient/v1_0/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/v1_0/services.py,sha256=Scf7b_GCPcEMH4W_PEcM2FphPGAXyuBLlhS7zqUHjyY,1124 surveilclient/v1_0/shell.py,sha256=2vsEdHJ_d7KdCuCR3143V_4gkukLdIiF6jTCWbvsMXY,1819 surveilclient/v1_0/hosts.py,sha256=v2xcBxA9rVTVa2dG-wm-94I7SaWpms_JFXqZkVPzfgw,1112 surveilclient/v1_0/client.py,sha256=nkdRL2q3NFGCCe29QqVDm8hJJdkdGPKLeEU3wYLXci8,1275 surveilclient/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/tests/test_client.py,sha256=N9IdxRnovTLIShDJAsqSkHgD8SiCoqU1TIufb_CfZjw,1443 surveilclient/tests/test_shell.py,sha256=t9BTWzSLp1MNnivkopK7e1d8yqS985khnSNtlcNe2rc,2628 surveilclient/tests/v2_0/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/tests/v2_0/clienttest.py,sha256=DgGX-gDZoaID03U3kVghj08LB7dAoFvPjrVrDnIean8,1062 surveilclient/tests/v2_0/actions/test_downtime.py,sha256=_85PFwn8HNYfCYjmGB5Ad5bwoaq-gkYWKDB3nCp7vlM,1126 surveilclient/tests/v2_0/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/tests/v2_0/actions/test_acknowledge.py,sha256=Z93QrFUol040N_M0wCSdIgNICrAKjowhgd45XxMpf8I,1135 surveilclient/tests/v2_0/actions/test_recheck.py,sha256=rjlAcrJNKvGd8x42cWTpEz9SniF57nYWOBFfKA38x6E,1230 surveilclient/tests/v2_0/config/test_services.py,sha256=TDBoO_yEibO6eaSyQuEfFFzZLvmaLFw3HeIqyPYNHi8,2597 surveilclient/tests/v2_0/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/tests/v2_0/config/test_realms.py,sha256=MsTLHPGmedOiHI0gdphiahSp3tpjF6dsJ5xPBocW4to,3978 surveilclient/tests/v2_0/config/test_hostgroups.py,sha256=zLKzjS7Lt5X1T1KJTrzWx-RrL2OPKFT28rDWFWbgPQ0,3736 surveilclient/tests/v2_0/config/test_contactgroups.py,sha256=WNI6EO3pDh3xNAsefWyMEtlptoZSVU7R8bsHNAPT2jk,3639 surveilclient/tests/v2_0/config/test_notificationways.py,sha256=hvYVWNf4LGpD9oiQC6a_I5mbFcCD9BFUFel1shSM4GA,7116 surveilclient/tests/v2_0/config/test_businessimpactmodulations.py,sha256=JOo3eFyYqOiXRUfRyY5pqQVPoZ1sOWgMMM_UgYq9qYk,4485 surveilclient/tests/v2_0/config/test_commands.py,sha256=rcCOugAvCZvCHk4SQlm3UGVilt6Bea3IVXBItEYMwvQ,3223 surveilclient/tests/v2_0/config/test_servicegroups.py,sha256=fCo13ZwmUUdiz0I49vy0_V3dFpeTVOoMRlaEon_jPYY,3922 surveilclient/tests/v2_0/config/test_contacts.py,sha256=7aOIg2qEkr2Lyt1FtkJmnB6-acqFCnxD5sy7xcZUsk8,3337 surveilclient/tests/v2_0/config/test_timeperiods.py,sha256=ntPCfs2a4JL_YkaDoLbOiPbAMiSFffPya9-wD7nWis8,4015 surveilclient/tests/v2_0/config/test_macromodulations.py,sha256=w03G4eZqvheuY2jgN6wGhQ83KBHgsGU-Aqe1wYpNY1s,4177 surveilclient/tests/v2_0/config/test_checkmodulations.py,sha256=wfRYPf0JZ0_Hp5-YbX1OSfLL9D_dEv9FNIY2Lbs9c38,3534 surveilclient/tests/v2_0/config/test_hosts.py,sha256=L24S8X-B711AIC28UdkDbn3r6iDrnpzP1JaXFOhFyLs,3659 surveilclient/tests/v2_0/status/test_services.py,sha256=JVsYRkrxb58wjdCaCiV3H5af3t7SVZYQSFiDfGBM0t0,1649 surveilclient/tests/v2_0/status/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/tests/v2_0/status/test_events.py,sha256=1B0cg1XUE1WQg_rfLpMQwo4AOrJE454KLbsobRVLeFU,1489 surveilclient/tests/v2_0/status/test_metrics.py,sha256=r8GbrhW-uBMo1itDpEh8FeCkhtTB_degrAxaGpQ9laE,3898 surveilclient/tests/v2_0/status/test_hosts.py,sha256=mCj4MTaRCOmSMBkySD0dC3JeTHn4w2Bo3h57WXyGZKQ,1914 surveilclient/tests/common/test_utils.py,sha256=EjjzN_khhtRjGqQ4CYZNinXUWtCsYQcJsMSd4gsItY4,1857 surveilclient/tests/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/tests/common/test_http.py,sha256=s2RY2uqYSZ4VP50TniXYkHjMHOm1pchp--ZobWaUJgE,1446 surveilclient/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/common/http.py,sha256=8YTu64IRgufK4_PeAUSmA-rgG60BFY7-rLnzZy5lM84,4880 surveilclient/common/utils.py,sha256=-iAhTWI6obtrzm6ps3lNEqCgC3bAo8auwYgvEytCEhE,4929 surveilclient/common/surveil_manager.py,sha256=PMCueAqhbS0jfcVEq-AMeryDHQ1VJzWF0Fmo964hMk8,699 surveilclient/openstack/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/openstack/common/cliutils.py,sha256=TncuYSUUjgMnmDeSxwiLnA9rAKveh2vaTzTllgoDZ80,1405 surveilclient/openstack/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/openstack/common/importutils.py,sha256=PPo2cDlfH-kdbBmtXVVRf51nGjUgpRsCijYnmLEa0pg,2166 surveilclient/openstack/common/py3kcompat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 surveilclient/openstack/common/py3kcompat/urlutils.py,sha256=JMF3VKy2gVQqO2dMIgbcJx3wwmoRX2kCHgW2K58wfsg,1665 python_surveilclient-0.13.3.dist-info/WHEEL,sha256=54bVun1KfEBTJ68SHUmbxNPj80VxlQ0sHi4gZdGZXEY,92 python_surveilclient-0.13.3.dist-info/entry_points.txt,sha256=cmMw-9drvzDuPGF5HOcv9d2hylF3e67OCRg4Vdqzl68,54 python_surveilclient-0.13.3.dist-info/pbr.json,sha256=M8bJLQw3YtZoCuVD84M38-ojdDmOmtVJglapRDm7yVY,46 python_surveilclient-0.13.3.dist-info/metadata.json,sha256=8gWBBpRPCe7V8K21wEH1diwhLNwfNl_Zrk6jM84JyaQ,670 python_surveilclient-0.13.3.dist-info/RECORD,, python_surveilclient-0.13.3.dist-info/DESCRIPTION.rst,sha256=yMZVDMfKMOTzk2kIS3RQAQm77wRuiiOf-22fMmcnBwE,1320 python_surveilclient-0.13.3.dist-info/top_level.txt,sha256=sMvbhHDgN2flEZrcacp9jRE2TBJs0TV3PdDgN_dP_IY,14 python_surveilclient-0.13.3.dist-info/METADATA,sha256=7kH8DYv3gWKIskuSg5NmuzWrvvprbQq5b0ghF86J-GI,1657 PKGCpython_surveilclient-0.13.3.data/data/share/surveil.bash_completionPKGsurveilclient/__init__.pyPKGk!zz.surveilclient/shell.pyPKG`Ièsurveilclient/exc.pyPKGL<<'surveilclient/client.pyPKGj+surveilclient/v2_0/__init__.pyPKG`#+surveilclient/v2_0/shell.pyPKGT((#surveilclient/v2_0/client.pyPKG::/surveilclient/tests/v2_0/status/test_metrics.pyPKG˼zz-wsurveilclient/tests/v2_0/status/test_hosts.pyPKGAA(<surveilclient/tests/common/test_utils.pyPKG&surveilclient/tests/common/__init__.pyPKG<%'surveilclient/tests/common/test_http.pyPKG surveilclient/common/__init__.pyPKG90 surveilclient/common/http.pyPKGNAAzsurveilclient/common/utils.pyPKG!5-'/surveilclient/common/surveil_manager.pyPKG#2surveilclient/openstack/__init__.pyPKG0Ib}}*73surveilclient/openstack/common/cliutils.pyPKG*8surveilclient/openstack/common/__init__.pyPKGEDsvv-D9surveilclient/openstack/common/importutils.pyPKG5Bsurveilclient/openstack/common/py3kcompat/__init__.pyPKG(35XBsurveilclient/openstack/common/py3kcompat/urlutils.pyPK|G((5,Ipython_surveilclient-0.13.3.dist-info/DESCRIPTION.rstPK|Gv#^666Npython_surveilclient-0.13.3.dist-info/entry_points.txtPK|G31Opython_surveilclient-0.13.3.dist-info/metadata.jsonPK2Gbm... Rpython_surveilclient-0.13.3.dist-info/pbr.jsonPK|Gҿ3Rpython_surveilclient-0.13.3.dist-info/top_level.txtPK|G4\\+Rpython_surveilclient-0.13.3.dist-info/WHEELPK|GT^vyy.Spython_surveilclient-0.13.3.dist-info/METADATAPK|G]tF ,cZpython_surveilclient-0.13.3.dist-info/RECORDPKVVV{