Giter Site home page Giter Site logo

tborychowski / unifi-event-monitor Goto Github PK

View Code? Open in Web Editor NEW
26.0 5.0 3.0 59 KB

Monitors Unifi Controller events and push them as notifications to slack (or any other platform)

Home Page: https://hub.docker.com/repository/docker/tborychowski/unifi-event-monitor

License: GNU General Public License v3.0

JavaScript 96.11% Dockerfile 3.89%
unifi-controller unifi monitoring notifications slack docker docker-image

unifi-event-monitor's Introduction

Listens for events from Unifi controller and pushes them as notifications to apprise.

Get started

Create .apprise file with your channels, e.g.:

slack://<token1>/<token2>/<token3>
mailtos://<userid>:<pass>@<domain.com>

2. Unifi Controller credentials

Create .env file with the following:

HOST=https://<controllerIP>:8443
USERNAME=<username>
PASSWORD=<password>

Setup using docker image

1. Create docker-compose.yml file:

---
version: "3.7"
services:
  unifi-event-monitor:
    container_name: unifi-event-monitor
    image: tborychowski/unifi-event-monitor
    restart: unless-stopped
    env_file:
      - ./.env
    volumes:
      - ./.apprise:/app/.apprise
      - ./blacklist.txt:/app/blacklist.txt

2a. Run:

docker-compose up -d

2b. Alternatively, you can run:

docker run -d --rm --env-file=./.env \
  --mount "type=bind,src=/absolute/path/to/.apprise,dst=/app/.apprise" \
  --mount "type=bind,src=/absolute/path/to/blacklist.txt,dst=/app/blacklist.txt" \
  tborychowski/unifi-event-monitor:latest

Filtering events

By default the app listens to all events and forwards the messages as notifications. It is possible to filter out some of the messages.

  • Create blacklist.txt file (in the same folder as the .apprise)
  • Add text of a message that you don't want to be pushed to your selected notification platform
  • You can have multiple filters, but keep 1 filter per line, e.g.
    my laptop disconnected from
    my laptop has connected to
    
  • This file is re-read before every event, so there's no need to restart the app after changing the file.

Setup locally (with nodejs)

git clone https://github.com/tborychowski/unifi-event-monitor.git
cd unifi-event-monitor
npm ci
node index.js

Credit

I used some code from: https://github.com/oznu/unifi-events

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.