Code Monkey home page Code Monkey logo

pagermon's Introduction

Discord GitHub issues GitHub pull requests GitHub GitHub stars GitHub forks GitHub tag (latest SemVer) GitHub commit activity GitHub contributors GitHub Workflow Status (branch) GitHub Workflow Status (branch)

PagerMon is an API driven client/server framework for parsing and displaying pager messages from multimon-ng.

It is built around POCSAG messages, but should easily support other message types as required.

The UI is built around a Node/Express/Angular/Bootstrap stack, while the client scripts are Node scripts that receive piped input.

Features

  • Capcode aliasing with colors and FontAwesome icons
  • API driven extensible architecture
  • Multi-user support
  • SQLite or MySQL database backing
  • Configurable via UI
  • Pagination and searching
  • Filtering by capcode or agency
  • Duplicate message filtering
  • Native POCSAG / FLEX / EAS Client Support
  • Keyword highlighting
  • WebSockets support - messages are delivered to clients in near realtime
  • Pretty HTML5
  • Native browser notifications
  • Plugin Support - Current Plugins:
    • Pushover near realtime muti-device notification service
    • Prowl near realtime iOS notification service with Apple Watch support
    • Telegram near realtime cloud based multi-device messaging
    • Discord near realtime cloud based messaging service
    • Gotify Self-Hosted messaging service
    • Twitter
    • Microsoft Teams Team colaboration platform
    • Slack Team colabortation platform
    • SMTP Email Support for conventional SMTP email notifications
    • Regex Filters - Filter incoming messages via regex
    • Regex Replace - Modify incoming messages via regex
    • Message Repeat - Repeat incoming messages to another pagermon server
  • May or may not contain cute puppies

Planned Features

  • Horizontal scaling
  • Enhanced message filtering
  • Bootstrap 4 + Angular 2 support
  • Enhanced alias control
  • Graphing

Screenshots

main view

desktop view

alias edit

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • nodejs 12.x or higher
  • sqlite3
  • Probably some other stuff

Recommended

  • nvm
  • nginx or some kind of reverse proxy for SSL offloading

Running the server

Local setup

  1. Copy server/process-default.json to server/process.json and modify according to your environment
  2. Launch the app from the Terminal:
    $ sudo apt-get install npm sqlite3
    $ npm install npm@latest -g
    $ npm install pm2 -g
    $ cd server
    $ npm install
    $ export NODE_ENV=production
    $ pm2 start process.json
  1. To start on boot, let pm2 handle it:
    $ sudo pm2 startup
    $ pm2 save
  1. You probably want to rotate logs, too:
    $ pm2 install pm2-logrotate
    $ sudo pm2 logrotate -u user
  1. Now login via the website, default port is 3000, default credentials are 'admin' / 'changeme'
  2. Head to /admin, change your password, and generate some API keys
  3. Grab your API keys and drop them in the PagerMon client, then you're good to go!

Alternatively a production ready setup guide is available here https://github.com/pagermon/pagermon/wiki/Tutorial---Production-Ready-Ubuntu,-PM2,-Nginx-Reverse-Proxy,-Let's-Encrypt-SSL,-Pagermon-server

Docker

Manual build

You can use image already built for you or you can build it yourself:

# For PC
docker build -t pagermon/pagermon .

# For Raspberry Pi
docker build -t pagermon/pagermon:latest-armhf -f Dockerfile.armhf .

Running

docker create \
  --name=pagermon \
  -e APP_NAME=pagermon \
  -p 3000:3000 \
  -e TZ=Europe/London \
  -v </path/to/config-mount>:/config \
  --restart unless-stopped \
  pagermon/pagermon:<VERSION>
docker start pagermon

docker-compose

version: "2"
services:
  pagermon:
    #build: ./server # To build localy
    image: pagermon/pagermon:<VERSION>
    container_name: pagermon
    environment:
      - APP_NAME=pagermon
      - PUID=1000 # Not required since node user inside docker has UID 1000
      - PGID=1000 # Not required since node user inside docker has GID 1000
      - TZ=Europe/London
    ports:
      - "3000:3000"
    volumes:
      - </path/to/config-mount>:/config
    restart: unless-stopped

Then run:

# Building with compose file
docker-compose build

# Running from compose file in foreground
docker-compose up

# Running from compose file in background
docker-compose up -d

Parameters

Parameter Function
-e APP_NAME=<name> Application name
-e HOSTNAME=<hostname> Hostname
-e USE_COOKIE_HOST=true Use cookie host.
-e NO_CHOWN=true Disable fixing permissions.
-e PUID=1000 for UserID
-e PGID=1000 for GroupID
-e SKIP_APP=true Don't start app, useful for development.
-e TZ=Europe/London Specify a timezone to use eg. Europe/London.
-v <path>:/config Mount config diretory, so config persist during container restarts (option 1)
-v <volumename>:/config Create named volume for config diretory, so config persist during container restarts (option 2)
-v /config Create unnamed volume for config diretory, so config persist during container restarts (option 3)
-p 3000:3000 Expose container port

Note:

  • Configuration is stored in /config inside container and it is owned by node user with UID/GID 1000. To fix config directory ownership use -e PUID=<UID> and -e PGID=<GID>. (Here are database and config file stored)
  • The local port 3000 will be forwarded to the docker container to port 3000 (by -p 3000:3000)
  • In case you would like to follow the logfile, run docker logs -f pagermon (by --name pagermon)
  • To shutdown and remove the container (if using compose), run docker-compose down
  • If you make changes to the app for testing, you will need to re-build the image, run docker-compose down && docker-compose up --build
  • To run on Raspberry Pi use armhf variant (add -armhf at the end of version), but be aware that OracleDB does not work there.

See additional parameters.

Tip: You probably want to setup docker log rotation before, more can be found here.

Running the client

Local setup

Prerequisites

These programs/libraries are required for Pagermon Client to work

  • RTL-SDR - RTL-SDR tools/libraries to access RTL-SDR dongle
  • RTL-SDR dongle - You can get these from Ebay, Amazon or other stores (Has to have RTL2832U chip)
  • nodejs - JavaScript Programming Language (Only if installing separate from server)
  • npm - Javascript Package Manager (Only if installing separate from server)
  • Git Client - Github.com client for getting source code (Only if installing separate from server)

To install the Prerequisites run sudo apt install nodejs npm git rtl-sdr

Installing Pagermon Client

Run the following commands from Terminal:

git clone https://github.com/pagermon/pagermon.git
cd pagermon/client
npm install

edit reader.sh and edit frequency and rtl_device number, Edit Multimon-ng command

rtl_fm -d 0 -E dc -F 0 -A fast -f 148.5875M -s22050 - |
multimon-ng -q -b1 -c -a POCSAG512 -f alpha -t raw /dev/stdin |
node reader.js

-d 0 - change this to your rtl_device number using rtl_test

-f 148.5875M - change this to the frequency you are decoding

Multimon-ng Command examples

POCSAG

multimon-ng -q -b1 -c -a POCSAG512 -f alpha -t raw /dev/stdin

FLEX

multimon-ng -a FLEX -t raw /dev/stdin

EAS

multimon-ng -a EAS -t raw /dev/stdin

Configuring Pagermon Client

Before running Pagermon Client you have to configure it to send the decoded info to the pagermon server.

copy default.json to config.json

cp config/default.json config/config.json 

Edit config.json with your favorite editor

{
  "apikey": "changeme",
  "hostname": "http://127.0.0.1:3000",
  "identifier": "TEST",
  "sendFunctionCode": false,
  "useTimestamp": true,
  "EAS": {
    "excludeEvents": [],
    "includeFIPS": [],
    "addressAddType": true
  }
}

Pager Options

apikey: This is the API key generate on the Pagermon Server http://serverip/admin/settings

hostname: The host name or IP of the Pagermon server (If you run Pagermon Server and Client on same PC then you can put this as http://127.0.0.1:3000

identifier: This will show up in the source column on the server web page good for when you have multiple sources and want to know which one the pager message is coming from

sendFunctionCode: This will appand the function code to the address of the message true or false

useTimestamp: This will use the time in the message true or false

EAS Options

excludeEvents: Allows a list of Events to exclude ie ["RWT","RMT","SVA"]

includeFIPS: Allows you to filter on a list of FIPS to alert on ie ["031109", "031000"]

addressAddType: Will append the event code to the address so KOAX-WXR would become KOAX-WXR-W for ZCZC-WXR-TOR-031109+0015-3650000-KOAX/NWS - true or false

PagermonPi - Raspberry Pi Image

Check out our Raspberry Pi Image for Pi3 & Pi4 which has Pagermon pre-loaded on it.

Check out the following links:

Releases for the latest version Wiki for PagermonPi support

Support

General PagerMon support can be requested in the #support channel of the PagerMon discord server.

Click Here to join

Bugs and Feature requests can be logged via the GitHub issues page.

Contributing

All are welcome to contribute. Contributors should submit a pull request with the requested changes.

CHANGELOG.md is to be updated on each pull request.

If a pull request is the first pull request since a release, then the version number should be bumped in CHANGELOG.md, server/app.js, and server/package.json.

If a database schema change is required, this must be done using KnexJS Migration files. Insert Instructions for this here

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See the list of contributors who participated in this project.

License

This project is licensed under The Unlicense - because fuck licenses. Do what you want with it. :>

Acknowledgments

pagermon's People

Contributors

all3kcis avatar cramshack avatar damiankw avatar danielwilliamsmsc avatar danrwau avatar davidmckenzie avatar dingosgotmybaby avatar e-bits avatar eopo avatar geelongmicrosoldering avatar japalie avatar jjeffhendryx avatar marshyonline avatar maxwelldps avatar mitchdrage avatar mrmstn avatar nicko170 avatar ryaneastland avatar s3m1s0n1c avatar shaggs avatar slocomptech avatar stubbers avatar zamana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pagermon's Issues

Right click

Hey @davidmckenzie
Would it be possible to enable the right click options to open links in new tabs on source capcode agency and alias on the index pages please? Atleast in Chrome these can only be opened by left clicking.

image

Error on 0.1.1 Admin pages

Hey I have set up PagerMon in my VM and whenever I browse to an admin page it says:
jquery.min.js:2 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.6.4/$injector/modulerr?p0=app&p1=Error%3A%20%…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.4%2Fangular.min.js%3A22%3A179)
at angular.js:38
at angular.js:4920
at q (angular.js:403)
at g (angular.js:4880)
at eb (angular.js:4802)
at c (angular.js:1914)
at Sc (angular.js:1935)
at ue (angular.js:1820)
at HTMLDocument. (angular.js:33367)
at j (jquery.min.js:2)

Implement DB indexes

Just some feedback for you mate, I have imported like 1000 capcodes from my other system and it now runs much slower than before when loading the index page and search pages.

I imagine it might be to do with the capcode - alias matching you have set up. Not a major issue really, but something to look at down the track?

Break out configuration

Have a configuration file that feeds many of the main variables.

  • DB file
  • DB type
  • Duplicate message filtering
  • Duplicate message limit (default 10)
  • Log level
  • Authentication
  • Defaults (page limit, etc)
  • Rotation settings

Request: Force login

Please add a option to force users to be registered and logged in to be able to view the application

Condense duplicate messages on different capcodes

When multiple identical messages are received for different capcodes, condense them down to a single row. Add an expand caret next to these messages to show which capcodes/aliases it was sent to.

Duplicate messages ignored by time

Hey @davidmckenzie
Just wondering if you could please add an option to ignore messages if it is within 20 (maybe have this user selectable?) seconds of the same message to the same address [as well as the current option to ignore if received in the last 10 messages].

Advanced Filtering

Allow users to construct a multi-part filter through right click (#47) or through a filter builder.

Filters generate a bookmarkable URL.

E.g.

((Address contains "0101%", AND address doesn't contain "0101123") OR address contains "1234567") AND agency is "derp AND message contains "poopin"

Regex matching

Alot of messages in NZ are in the same format (e.g. Ambo dispatch and Fire dispatch) so I use regex's to show data on them, e.g. fire messages all look like:

(PUKE431) 111-MIN 123 FAKE ST SAINT ANDREWS HAMILTON CITY. (XStr HEATH ST/BEERESCOURT RD) .ALARM ACTIVATION - RESIDENTIAL. #F1234567,

So I have a webpage that uses the regex info to for instance translate what "PUKE431" means etc.

Are you planning on implementing a similar feature?

Allow PDW style "filter only mode"

Only messages with capcodes matching those in the DB will be output to /

Have a "missed" page in admin panel to review missed messages, and click on capcodes to create an alias

Standalone install app

Downloads prereq's, handles initial config (including setting password), generates first API key, generates nodemon config.

Maybe handles installation into a different dir for prod usage, sets up init scripts for start on boot.

Probably needs to be command-line based.

0.1.0 Pre-release cleanup

  • Clean up stale modules
  • Remove verbose logging
  • Clean out stale code
  • Test deploy and tweak npm modules

Filtering messages scrolls to bottom

Just a minor issue, if you click on a capcode on the main page it takes you to the page where only the messages to that capcode is displayed. But it keeps the scroll position - so if you scrolled half way down the page then clicked on the capcode it will scroll halfway down the page when on the filtered messages view

Browser notifications

Utilise native browser notifications to pop up new messages, based on user setting.

website

Hi you just said :Now login via the website, default credentials are 'admin' / 'changeme'

But what is the website where did you stored the website data?

Stricter wildcard capcode matching

  • Pad 0s on message/address
  • Look at converting address column to text to support leading 0s
  • Investigate other options of wildcard matching

Message field

One other question, is it possible to have another field in the, messages table to do the following:
basically on import i'm going to check the message against a set pattern/regex and if it matches then i'd like to record which pattern is used to match it - that way in the UI at some stage you would be able to click a button to filter it to only show messages which matched pattern x.

This way when messages come in - like ambo dispatches - they can be seen and any other messages sent to the pager number are just in the background / only show up when you view by capcode etc.

Does that make sense? Let me know if not?

Admin panel design

  • Update aliases (modal?)
  • Checkboxes for bulk actions
  • Colour picker for aliases
  • Icon picker for aliases
  • Settings page
  • Edit/delete messages
  • Help page

Websocket issue?

Brower looks like it is trying to update, new line appears as follows
Invalid date Invalid date undefined Unknown

I do believe a message is coming at the time it does this, but the messages is set to reject.

Console Shows

New Message ID: 167 currentPage: 1
angular.js:14525 TypeError: Cannot read property 'replace' of undefined
at (index):40
at m.$digest (angular.js:17999)
at m.$apply (angular.js:18269)
at l (angular.js:12387)
at XMLHttpRequest.A.onload (angular.js:12541)
(anonymous) @ angular.js:14525
(anonymous) @ angular.js:11008
$digest @ angular.js:18017
$apply @ angular.js:18269
l @ angular.js:12387
A.onload @ angular.js:12541

Sending data to API

Hey @davidmckenzie , sorry for the million bugs/questions!
I'm sending this message to the server
POCSAG512: 2017-06-17 13:54:30 [000780001] ALN HAPPY TO SAY YOU'VE BROKEN
Using a custom program (that basically waits a minute for fragmented messages then combines them and sends them to the server).
If i send this message without the ' character it goes through OK, but if I keep it it will fail.
I tried URL encoding it but when I do that it does not decode them. Is there anything I should be doing to get the ' to come through properly?

Database rotation

  • Set up DB initialisation in app
  • Set up configurable rotation policy (with vacuum)
  • Ensure DB handles close properly

Ignoring POCSAG2400 ?

Hi. I have everything set up and running.
Launching testMessage.sh is succesfull, but I'm not getting any messages from the POCSAG2400 that I'm receiving in my area ( my receiving setup works piping to a txt-file)
If I edit the testMessage.sh to test with "pocsag2400" like this, i don't receive the test message.
`
#!/bin/bash

cd .. && echo "POCSAG2400: Address: 1000000 Function: 0 Alpha: Test message, disregard" | node ./reader.js
`

Duplicate filtering is disabled, and sending the POCSAG512 test message multiple times works every time.

BooX

Filtered Messages showing ALL new messages

When you click on a capcope on the main page to filter by that capcode - this works and displays only the messages to that capcode. But when a new message comes in from the decoder it gets shown at the top even though it does not match the filter.

Combine api.init and api.messages

  • Pagination doesn't change url - just updates scope
    • How to deal with page reloads? Need to retain page id
    • Store page number in cookies?
    • Could be nasty...
  • Init call should deal with deleted rows - use count(*) and first ID
  • Refactor pagination to use native angular-ui

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.