Giter Site home page Giter Site logo

jacobgabrielson / sqs-ping Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 39 KB

sqs-ping sends data to an SQS queue, in a manner vaguely resembling the ping(8) command.

License: Apache License 2.0

Makefile 2.24% Go 97.76%
aws-sqs aws-sqs-demo golang-utility golang

sqs-ping's Introduction

sqs-ping sends data to an SQS queue, in a manner vaguely resembling the ping command.

Installation

git clone https://github.com/JacobGabrielson/sqs-ping.git
cd sqs-ping
make

Usage

sqs-ping [options] <queue>
  • <queue> can either be the name of the queue or its URL.

Options

  -c int
    	send the message this many times (default 1)
  -command string
    	command to run
  -f string
    	file to send
  -i duration
    	how long to wait between sends (default 200ms)
  -region string
    	AWS region (default "local")
  • If -file is not specified, then a JSON blob will be sent containing the hostname and time of day on that host.
  • If -file is set to - then stdin will be read.

Examples

Send default ping 5 times

$ sqs-ping -region eu-north-1 -c 5 demo-queue
100 bytes to https://sqs.eu-north-1.amazonaws.com/123456789012/demo-queue: time=206 ms
100 bytes to https://sqs.eu-north-1.amazonaws.com/123456789012/demo-queue: time=205 ms
100 bytes to https://sqs.eu-north-1.amazonaws.com/123456789012/demo-queue: time=206 ms
100 bytes to https://sqs.eu-north-1.amazonaws.com/123456789012/demo-queue: time=205 ms
100 bytes to https://sqs.eu-north-1.amazonaws.com/123456789012/demo-queue: time=203 ms

(Note the bytes is only reflective of the SQS MessageBody size and does not include HTTP headers or other arguments to SQS SendMessage).

Send output of systemd-analyze blame

$ sqs-ping -command "systemd-analyze blame" demo-queue
11288 bytes to https://sqs.us-west-2.amazonaws.com/123456789012/demo-queue: time=395 ms

The message sent will include the following JSON that looks something like this (\n converted to actual newline, and output truncated with ... for readability):

{
  "Hostname": "labrador.example.com",
  "Timestamp": "Wed, 03 Mar 2021 09:13:39 -0800",
  "Command": "systemd-analyze blame",
  "ExecError": "",
  "Stdout": "10.804s alsatian.service
10.014s blah.service
 8.310s NetworkManager-wait-online.service
 3.618s docker.service
 1.585s [email protected]
  866ms ufw.service
  827ms fwupd-refresh.service
  669ms dev-mapper-vg0\\x2d\\x2dcf3dba\\x2droot.device
    ...
    4ms setvtrgb.service
    4ms sys-fs-fuse-connections.mount
    3ms postfix.service
    3ms sys-kernel-config.mount
    2ms motd-news.service
    1ms docker.socket
  851us snapd.socket
",
  "Stderr": ""
}

License

This code is licensed under the Apache License 2.0.

sqs-ping's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.