pong

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2022 License: MIT

README

PONG 🏓

Codecov GitHub Workflow Status Go Reference

Pong status checker.

Currently support only REST.

Usage

Give a json or yaml file with the following structure:

# LogLevel is the log level, default info
log_level: "debug"

client:
  rest:
  - concurrent: 1
    check:
      # URL could be multiple URLs, separated by space
    - url: "https://api.punkapi.com/v2/beers/1 https://api.punkapi.com/v2/beers/2"
      # Method is the HTTP method to use, default is GET
      method: GET
      # Timeout is in millisecond, default is 0 (no timeout)
      timeout: 1000
      # Status to check, default 200
      status: 200
pong test.yaml

With Ansible

Get pong binary in release page add the plugin modules area.

make build
docker run -it --rm -v ${PWD}:/workspace williamyeh/ansible:debian9 /bin/bash

Inside the container

echo localhost ansible_connection=local > /etc/ansible/hosts

mkdir -p /usr/share/ansible/plugins/modules/
cp /workspace/pong /usr/share/ansible/plugins/modules

ansible-playbook /workspace/testdata/ansible/deploy_check.yml

Example of playbook

- name: Check image exists
  pong:
    client:
      rest:
        - concurrent: 1
          check:
            - url: "{% for k,item in yaml_return.ansible_facts.compose.services.items() %} https://hub.docker.com/v2/repositories/{{ item.image.split(':')[0] }}/tags/{{ item.image.split(':')[1] }} {% endfor %}"
              timeout: 1000
  register: http_result
  failed_when: http_result.failed

Development

Run make command to see available commands.

Local generate binary and docker image

goreleaser release --snapshot --rm-dist

Directories

Path Synopsis
cmd
pong command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL