JSPM

simple-container-monitor

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19
  • Score
    100M100P100Q67932F
  • License MIT

Docker container monitoring with Notion page integration

Package Exports

  • simple-container-monitor
  • simple-container-monitor/dist/SimpleContainerMonitor.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-container-monitor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Docker Container Monitor with Notion Integration

An easily-inspectable TypeScript file without dependencies that you run as a Docker container to show CPU and memory usage stats for all containers in the free Notion mobile app or on the web.

Create a free Notion account with a page and an integration and pass in the information to this monitor and it will update the container stats on the page every minute.

No need to open ports and configure web routes or sign up for expensive monitoring services to get basic container stats in your mobile phone.

Setup

  1. Create a Notion integration:
  • Go to https://www.notion.so/my-integrations
  • Click "New integration" and create an internal integration
  • Name your integration (e.g., "Container Monitor")
  • Select the workspace where you want to use the integration
  • Set the capabilities needed (Read content, Update content, Insert content)
  • Click "Submit" to create the integration
  • Copy the "Internal Integration Token" - this is your NOTION_TOKEN
  1. Create a Notion page for the stats and associate it with your integration:
  1. Deploy the monitor in a container
  • From NPM
    docker run -d --name container-monitor \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -e NOTION_TOKEN=secret_abcdefghijklmnopqrstuvwxyz1234567890 \
    -e NOTION_PAGE_ID=page_id \
    node:18-alpine \
    npx simple-container-monitor
  • With Docker Compose, add the following service definition to your docker-compose.yml file:
    services:
      container-monitor:
        image: node:18-alpine
        container_name: container-monitor
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
        environment:
          NOTION_TOKEN: secret_abcdefghijklmnopqrstuvwxyz1234567890
          NOTION_PAGE_ID: page_id
        command: npx simple-container-monitor
        restart: unless-stopped
  • Or if you want to run the code directly from this repo to inspect the file before running
    Clone this repo or download the SimpleContainerMonitor.ts file, then run the following Docker command.
    docker run -d --name container-monitor \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /absolute_path/to/SimpleContainerMonitor.ts:/app/SimpleContainerMonitor.ts \
    -e NOTION_TOKEN=secret_abcdefghijklmnopqrstuvwxyz1234567890 \
    -e NOTION_PAGE_ID=page_id \
    -w /app \
    node:18-alpine \
    npx tsx SimpleContainerMonitor.ts

Also runnable as a service outside Docker if Node 18+ is installed by setting the NOTION_TOKEN and NOTION_PAGE_ID environment variables end exectuing npx simple-container-monitor

Environment Variables

  • NOTION_TOKEN (required): The integration token from step 1
  • NOTION_PAGE_ID (required): ID of an existing page to update

Prerequisites

  • Node.js 18 or higher
  • Notion account

License

This project is licensed under the MIT License.