Coder Social home page Coder Social logo

pushit's Introduction

DEPRECATED

As this tool is very similar to this one, it has been deprecated and repository archived.

The only service not supported directly by notify is pushitbot but it can be used with their custom provider, eg:

custom:
  - id: pushitmd
    custom_webook_url: https://tgbots.skmobi.com/pushit/<TOKEN PROVIDED BY PUSHITBOT>
    custom_method: POST
    custom_format: 'format=Markdown&msg={{data}}'

Another feature that might be missed from this tool is the --web flag has been added in my notify fork: plan is to clean it up and open a PR but fork has its own releases and docker image.

pushit

Similar to notify-push (in python), pushit is a CLI tool to push notifications straight to your phone.

The usual sysadmin method is to send alerts via email but there are tons of services out there with mobile apps that allow us to send push notifications, why not use those for faster and cleaners alerts?

Instalation

Use go get:

go get github.com/fopina/pushit

Or download a pre-built binary from releases.
The pre-built binary has the --update flag to allow easier updates in the future.

Usage

$ pushit -h
Usage of pushit:
  -c, --conf string       configuration file (default "/Users/fopina/.pushit.conf")
  -h, --help              this
  -l, --lines int         number of lines of the input that will be pushed - ignored if --stream is used (default 10)
  -o, --output            echo input - very useful when piping commands
  -p, --profile string    profile to use
  -s, --stream            stream the output, sending each line in separate notification
  -u, --update            Auto-update pushit with latest release
  -v, --version           display version
  -w, --web               Run as webserver, using raw POST data as message
  -b, --web-bind string   Address and port to bind web server (default "127.0.0.1:8888")

Configuration

The configuration file is required but an example is available here in the repo.

default: pushitbot-demo

profiles:
  pushitbot-demo:
    service: pushitbot
    params:
      token: 105e48ff92b92263f3397ed55f275a81
      format: Markdown
  • default is the default profile when --profile is not specified
  • profiles is a mapping with configured profiles
    • pushitbot-demo is the profile name, free choice
    • service is the notification service, check below for options
    • params is a mapping of options specific to the service, check below for options

CLI

Pushing messages is now as simple as:

$ pushit hello world

Or using stdin (useful for shell piping):

$ pushit
hello
$ echo hello world | pushit

A flag worth highlighting is --stream that will post a message per line read from stdin, just try:

$ (echo one; sleep 1; echo done) | pushit --stream

Web

In some restricted (container?) environments it might be useful to have a single pushit installation (and configuration) available for multiple services/scripts to use it.

--web starts a local webserver and anything POSTed to that URL will be pushed as if it was stdin.

$ pushit -w
Up and running!

Post raw data to http://127.0.0.1:8888/, as in:

	curl http://127.0.0.1:8888/ -d 'testing 1 2 3'

This will send that data as message using the default profile.
To use a specific one, post to http://127.0.0.1:8888/PROFILE

Docker

--web mode is specially useful in a cluster of containers so that pushit does not need to be installed and configured in every image.

An image is ready to be used in the hub:

$ docker run --rm \
             -v ~/.pushit.conf:/.pushit.conf:ro \
             -p 8888:8888 \
             fopina/pushit \
             -w -b 0.0.0.0:8888

Services

Params are the possible values to use in configuration file params profile entry

Service Description Params
slack Use Slack Incoming Webhooks url: webhook URL (required)
channel: channel to post the message to
username: username to display
icon_emoji: emoji to use as bot picture
icon_url: URL to use as bot picture
pushitbot Use PushItBot token: token provided by @PushItBot (required)
format: blank (default), HTML or Markdown, as defined in the service documentation
telegram Use Telegram Bot API token: token provided by @BotFather (required)
chat_id: target user/group ID - use @myidbot to find your ID or a group ID (required)
requestbin Use Requestbin.com - demo service for testing/debugging url: requestbin.com generated endpoint
Any other params defined will be posted to the endpoint as well

pushit's People

Contributors

fopina avatar

Stargazers

Duarte Duarte avatar

Watchers

 avatar James Cloos avatar  avatar

pushit's Issues

Initial release

ToDo

  • Initial services:
    • Telegram
    • PushItBot
    • Slack webhook
    • Request.bin (testing and fun)
  • GoRelease in .travis-ci
  • Stream line per line or send last X lines after done

Initial release

ToDo

  • Initial services:
    • Telegram
    • PushItBot
    • Slack webhook
    • Request.bin (testing and fun)
  • GoRelease in .travis-ci
  • Stream line per line or send last X lines after done

Initial beta

ToDo

  • Initial services:
    • Telegram
    • PushItBot
    • Slack webhook
    • Request.bin (testing and fun)
  • GoRelease in .travis-ci
  • Stream line per line or send last X lines after done

Service for fallback

Support fallback service in configuration file, when the default one fails, such as:

default: telegram_profile
fallback: smtp_gmail_profile

override params from command line

command line flag to override/add service parameters.
As -p is for profile, -o?

So (based on conf.example in the repo):

pushit -p slack-demo -o channel='#other' "post to other channel"

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.