• Stars
    star
    118
  • Rank 299,923 (Top 6 %)
  • Language
    Go
  • License
    Eclipse Public Li...
  • Created over 10 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

MQTT client

mqttcli -- MQTT Client for shell scripting

mqttcli is an MQTT 3.1.1 Client which has almost same options with mosquitto_pub/sub. However, it has additional functionality and a pubsub command which is suite for the shell script pipelining.

Install

Download from here. Please choose your artitecture. (and chmod ugo+x if needed)

curl https://raw.githubusercontent.com/shirou/mqttcli/master/install.sh | sh

Or if you have golang environment, type this to build on your host.

go get github.com/shirou/mqttcli

Usage

common

You can set host, port, username and password on the Environment variables.

export MQTT_HOST="localhost"
export MQTT_PORT="1883"
export MQTT_USERNAME="user"
export MQTT_PASSWORD="blahblah"

or using a config file. You can specify a config file by --conf option. or automatically load from ~/.mqttcli.cfg.

% mqttcli sub --conf yoursettings.json -t "some/topic"

example:

{
  "host": "localhost",
  "port": 1883,
  "username": "user",
  "password": "blahblah"
}

If you use AWS IoT, you can use these JSON as mqttcli config file, such as

{
  "host": "A3HVHEAALED.iot.ap-northeast-1.amazonaws.com",
  "port": 8883,
  "clientId": "something",
  "thingName": "something",
  "caCert": "path/to/root-CA.crt",
  "clientCert": "path/to/2a338xx2xxf-certificate.pem.crt",
  "privateKey": "path/to/aad380efffx-private.pem.key"
}

You may change cert files path to where you placed.

Pub

mqttcli pub -t "some/where" -m "your message"

or

tail -f /var/log/nginx.log | mqttcli pub -t "some/where" -s

-s is diffrent from mosquitto_pub, it sends one line to one message.

Sub

mqttcli sub -t "some/#"

PubSub

Note: This subcommand is just a concept work. Might be delete in the future.

Publish from stdin AND Subscribe from some topics and print stdout.

tail -f /vag/log/nginx.log | mqttcli pubsub --pub "some/a" --sub "some/#" > filterd.log

This is useful when other client manuplate something and send back to the topic.

Reference

paho.mqtt.golang.git
http://godoc.org/git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git

License

Eclipse Public License - v 1.0 (same as Paho's)

More Repositories

1

gopsutil

psutil for golang
Go
10,407
star
2

toybox

golang implemenation of busybox
Go
84
star
3

mqforward

MQTT to influxdb forwarder
Go
75
star
4

vscode-dired

Filer like emacs-dired for VSCode
TypeScript
59
star
5

kptool

KeePass v1 DB tool
Python
26
star
6

fluent-plugin-pghstore

Fluentd output plugin which can write to PostgreSQL hstore extension.
Ruby
16
star
7

sphinxcontrib-ansibleautodoc

autodoc for ansible playbook
Python
14
star
8

noblechild

noble proxy library for paypal/gatt, works on kernel 3.10 (ex, Intel Edison)
Go
10
star
9

mqtunnel

TCP tunnel via MQTT
Go
9
star
10

prometheus_remote_kinesis

prometheus remote write integration for AWS kinesis
Go
9
star
11

pg2any

Generate any format from PostgreSQL DB Schema
Go
8
star
12

pesand

MQTT v3.1 broker written in golang
Go
8
star
13

storm-mqtt

storm-mqtt is a sample implementation of Storm spout which can receive MQTT messages.
Java
7
star
14

sphinxcontrib-indesignbuilder

sphinx indesignbuilder
Python
7
star
15

awslogsgo

Go port of awslogs
Go
6
star
16

infodrawer

Python
6
star
17

db2structs

db2structs produces Go structs from DB such as MySQL
Go
6
star
18

goagen_js

javascript client module generator for goa.design
JavaScript
6
star
19

sphinx-websupport-demo-for-heroku

Python
5
star
20

sphinxcontrib-reviewbuilder

Sphinx to Re:VIEW
Python
5
star
21

goash

ash(Almquist Shell) implementation in pure golang.
Go
5
star
22

menes

Menes is an web application which generates a PDF file from Sphinx builder
Python
5
star
23

erlang-ltsv

Labeled Tab-separated Values Parser for Erlang
Erlang
4
star
24

antlr-grammars-v4-go

ANTLR grammers for golang
Go
4
star
25

opencensus-exporter-trace-xray

Opencensus trace exporter for AWS X-Ray
Java
4
star
26

devstash

This tiny tool can store the information from stdin on the remote server via ssh.
Go
4
star
27

logrusmqtt

MQTT hook for logrus
Go
4
star
28

sphinxcontrib-redpen

sphinx extension for Redpen
Python
4
star
29

blockdiag_interactive_shell_for_fluxflex

Python
4
star
30

sphinxcontrib-textstyle

Python
3
star
31

sphinxcontrib-satysfibuilder

sphinx SATysFi builder just for fun
Python
3
star
32

shirou

3
star
33

toodledobackup

Toodledo Task Backup Tool
Python
3
star
34

gofaker

Go
2
star
35

umq

Universal Message Queue
Go
2
star
36

golightan

[DISCONTINUTED] Syntax highlighter for golang
Python
2
star
37

ansible-docker

ansible testing with docker connection plugin
Python
2
star
38

gostat

Go
2
star
39

distroless-debug-test

distroless test
Dockerfile
2
star
40

emacs-functions

Emacs functions to Visual Studio Code
TypeScript
2
star
41

cowsay

install Ansible-most-important-prerequirement software. This can be used from ansible-galaxy.
2
star
42

dping

dping is Distributed ping application based on riak_core. (This is just a test application)
Erlang
1
star
43

shirou.github.com

github pages
1
star
44

mqagent

Go
1
star
45

macsetup

Ansible-galaxy role for setup your Mac OS X
1
star
46

cloudwatch-slack

AWS CloudWatch to Slack
Go
1
star
47

fluent-plugin-docker-inspect

fluentd plugin which can emit docker inspections.
Ruby
1
star
48

VSNowm

Personal note taking and task management on VS-Code
TypeScript
1
star
49

all-write

Sample project of lucene on GAE/J
Java
1
star
50

goagen_proto

goa generator for protocol buffer
Go
1
star
51

grpc-sample-server

golang gRPC sample server implementation
Go
1
star