Package: roboger
What is Roboger?Do you like the old good "echo alarm | sendmail me@mydomain" trick in crontab?Does your software or servers send you mail/sms alerts when something is
wrong?Want to build own notification bot for Telegram, Slack or whatever else?Tired of getting emails from robots?Then Roboger is definitely for you!Actually nowadays the majority of emails are sent from robots and people don't
need to reply. People eventually use emails much less, preferring messengers
and alternative apps. And we made Roboger - a new generation messenger designed
specifically for robots.What can Roboger do?It can get notifications and forward them to specified endpointsIt supports endpoint types: email, JSON webhooks, Slack, Telegram and
Roboger Smartphone App (only viahttps://roboger.com/)It can be easily extended with endpoint pluginsThis software actually allows you to run your own Roboger server, in case you
don't want to usehttps://roboger.com/, want to have a backup alternativeReal life exampleYou get information messages from your server to Slack, warnings to Slack and
Telegram, errors to messengers and by mail and on critical events you want to
additionally hook API of your PBX to call you on mobile.In the past you would have needed to write a code, call APIs, manage event
routing and finish in a script hell without any idea what and where notifies
you.Now you can use Roboger, where everything is already coded, organized and can
be set up with a couple of commands.How to useStart Roboger serverroboger-control start
# launch in front for debugging
roboger-control launchThen create address, endpoints and subscriptions withrobogerctl:> robogerctl address create
attr    value
--------------------------------------------------------------------------
res     9                                                                <<< address resource id
a       5VpTb3jp8yUd138saNnOVDkcTPQBDM9k4kpas2QQW6vZyYr19PvXofmHAfTrkm77 <<< your address
active  1

# let's craate endpoint for slack
> robogerctl endpoint create 9 slack
attr         value
--------------------
res          9.7     <<< endpoint resource id
active       1
config       {}
description
plugin_name  slack

# lets create one subscription for this endpoint
> robogerctl subscription create 9.7
attr         value
---------------------
res          9.7.16
active       1
endpoint_id  7
level        20
level_match  ge
location
sender
tag
# edit endpoint configuration
> robogerctl endpoint edit 9.7make sure it looks likeactive:1config:url:http://slack-web-hook/urldescription:some my chatThen use Roboger API to send event notifications:POST http://your-roboger-host:7719/push < JSON
{
    'addr': 'towhere',
    'sender': 'from (e.g. from robot1)',
    'location': 'where something is happened',
    'tag': 'event tag, eg, serverfail, alarm, achtung',
    'subject': 'what we are talking about',
    'msg': 'message body',
    'level': 'event level (debug, info, warning, error or critical)',
    'media': 'base64-encoded binary eg. photo from surveillance camera',
    'media_file': 'media file name'
}
(all fields except address are optional, default level is "info")Or withroboger-pushconsole client in the old good crontab or any other
software/scripts:echo Everything is down | roboger-push -l warningroboger-pushapp is written in pure bash, so it will run almost everywhere,
addresses are defined in /usr/local/etc/roboger_push.ini.Note: if you want to send media attachments with roboger-push, you should have
localopensslCLI installed (it's actually installed everywhere by default,
we just warn you about that)Python client moduleClient module for Python 3:https://github.com/alttch/pyrpush. The module can
be installed with pip3:pip3 install pyrpushUsage example:frompyrpushimportClientasRPushClientr=RPushClient()r.sender='bot1'r.location='lab'r.push('test message')r.push(msg='sending you image',media_file='1.jpg',level='warning')The module requiresroboger-pushclient installed (uses its config only, you
can removeroboger-pushscript after the installation)InstallationOn the local machineInstall with pip:pip3 install roboger
pip3 install gunicorn # if not installedGet sample configuration file from github repo, put it either to/opt/roboger/etc/or to/usr/local/etc/roboger.ymlor wherever you want and
point there ROBOGER_CONFIG env variable.Note: Roboger database v2 is not compatible with v1. Please reinstall Roboger
from scratch, for the existing resources use auto-deployment.Roboger can work with SQLite, MySQL and PostgreSQL, however SQLite is not
recommended for production due to possible database locks.Docker/KubernetesPre-built image available athttps://hub.docker.com/r/altertech/robogerMount server configuration somewhere and point there ROBOGER_CONFIG env
variableInstalling roboger-pushlog in as rootexecute the following command:curl -shttps://raw.githubusercontent.com/alttch/roboger/master/bin/install-roboger-push| bash /dev/stdin YOUR_ROBOGER_ADDRESScustomize /usr/local/etc/roboger_push.ini if requiredManagingInstall robogerctl (not included in server):pip3 install robogerctlEndpoint pluginsemailSends email notificationsendpoint config:{"rcpt":"some@mail_address"}server config:-name:emailconfig:smtp:host:your-smtp-host# requiredport:your-smtp-port# tls: true # use tls# ssl: true # use ssl# login: someuser # SMTP server login# password: "123" # SMTP server password# default-location: location # if not specified, host name is usedwebhookSends event web hook HTTP/POST request.endpoint config:{"url":"http://some.domain/some-webhook-url","template":"{ "event_id" : $event_id, "name": "value", "name2": "value2" }"}You may use the following variables in template (quotes for variables are not
required, plugin quotes variables automatically, if necessary):$event_idevent uuid$addrevent recipient address$msgmessage text$subjectsubject$formatted_subjectpre-formatted extended subject$levellevel number (10 = DEBUG, 20 = INFO, 30 = WARNING, 40 = ERROR, 50
= CRITICAL)$level_namelevel name$locationevent location (if specified)$tagevent tag (if specified)$senderevent sender (if specified)$mediabase64-encoded media, if attachedserver config: not requiredshellExecutes server command, specified in endpoint configuration. The command is
executed with the user permissions of Roboger server process. Should be enabled
only in trusted environments, where regular users have no direct access to
the endpoint configuration.endpoint config:{"command":"server shell command"}Variables: same as in webhook plugin. Variables are sent to command without
quotes.chainAllows to forward event to another Roboger server. Be careful to avoid event
loops!endpoint config:{"url":"http://another-roboger-server","addr":"roboger address on target server"}Note:/pushuri is not required in "url" field.server config: not requiredslackSends notification in Slack.endpoint config:{"url":"http://some-slack-web-hook.domain/your-webhook-url","rich":true}If "rich" is true, rich text notification will be sent. Note that this plugin
doesn't support attachments.server config: not requiredtelegramsends notifications in Telegramendpoint config:{"chat_id":"encrypted chat id, obtained from roboger bot"}server config:-name:telegramconfig:token:your-telegram-bot-tokenHow it works with Telegram:Firstly you need to register your own bot and obtain bot token
(https://core.telegram.org/bots#6-botfather)Make sure you have "url" param in "roboger" section of server config.
Telegram plugin uses this param to process and register web hooks.Put bot token to plugin configuration in server config and restart roboger serverFind your bot in Telegram and write something to chatBot will instantly report your encrypted Chat ID.Note: roboger Chat ID is different from integer Telegram Chat ID. Actually it's
encrypted with your bot token to avoid people brute forcing chat IDs of shared
bots.Server resources-as-a-codeSingle resourceUserobogerctl <addr|endpoint|subscription> apply -f file.ymlto apply
resource configuration.BatchIf you want to deploy in batch, userobogerctl deploy -f file.ymlcommand.
Looksample-deploy.ymlfor deployment example.API documentationSwagger API docs are athttp://your-roboger-host:7719/