Skip to main content

HL - Host List, a simple flexible fuzzy search/execute tool for lists of hosts

Project description

HL - a simple flexible fuzzy host search/execute

HL (Host List) provides omni-box style query interface (inspired by next to any modern browser). HL uses easy to understand weighted fuzzy-matching over hierarchical host lists. Things considered in full-text matching process are project name, env (prod, qa, dev, etc.), tags, ports and FQDN itself.

Note that what defines project name, or environment, etc. is your own arbitrary convention and they all work the same in HL. In reality, HL accepts any hierarchical classification with each level considered as a tag. Upper classification tags have proportionally more weight then any other below, this property is used to disambiguate fuzzy string matches.

Installation

pip install --user hl

Example

Imaginary config for simple project with API and DBs, having 2 environments - staging on AWS and production on bare metal in 2 DCs. Note that admins are funky and DB have their own unique and inconsistent names + different ports, that we want to classify properly our with tags.

# our-project.yml:
---
prod:
    api:
        us-east-dc:
            hosts: api-[0-4]-east-prod.our-company.cloud
            ports:
                http: 8080
        us-west-dc:
            hosts: api-[0-4]-west-prod.our-company.cloud
            ports:
                http: 8080
    db:
        us-east-dc:
            # list of host patterns is acceptable
            hosts:
                - ricky-the-great.our-company.cloud
                - mikky-the-malicious.our-company.cloud
            ports:
                postgres: 5432
         us-east-dc:
            # list of different host entries as well
            - hosts: east-mcgram-db.our-company.cloud
              ports:
                postgres: 5432
            - hosts: east-paul-db.our-company.cloud
              ports:
                postgres: 6432
qa:
    aws:
        api:
            hosts: api-[0-4]-aws-staging.ec2.cloud
            ports:
                http: 8080
        db:
            hosts: db-aws-staging.ec2.cloud
            ports:
                postgres: 5432

Enter hl tool:

hl aws

Algorithm

Algorithm is simple (subject to change) - first we traverse the graph of host patterns and consider each tag as a token inversly weighted by depth (the deeper, the less weight). Then we apply sensible tokenization of hostname (split by '-', '_' and '.'), each token gets minimal weight. The result is then merged tags and hostname tokens.

Query is tokenized in the same way as hostnames. After that the two frequency dictionaries are multipled like sparse vectors, to minimize sharp effect of repeated words, weights in query is smoothed by sigmoid (this will likely change in the future).

Next step is to use trigramms or similar to fix typos in query and still find closest token to match.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hl-0.2.0a0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hl-0.2.0a0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file hl-0.2.0a0.tar.gz.

File metadata

  • Download URL: hl-0.2.0a0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.2

File hashes

Hashes for hl-0.2.0a0.tar.gz
Algorithm Hash digest
SHA256 9cc391d694f47d095e075c85b5282ca8b547df790e325ae01795da6fdd9f6cd4
MD5 494f6909de40b697845c17a2c18f71e4
BLAKE2b-256 3343ec8958d3e5a50299fa31e7faa825cf7bd95ca0e1f89beef33ce31dbe182f

See more details on using hashes here.

File details

Details for the file hl-0.2.0a0-py3-none-any.whl.

File metadata

  • Download URL: hl-0.2.0a0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.2

File hashes

Hashes for hl-0.2.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed31457fcb464c7adf739fe1398b94e4a24b7e3c914790339c9361f7fe845098
MD5 f2396e7ad6dfcb8734aeecda93949aa4
BLAKE2b-256 4d64b772560d7e7808e4c57374cccc5a5fbbeed4a885b46369ceb4b4150f9697

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page