Skip to content

A CLI program that helps you check your endpoints by requesting the given servers and send a report message in any supported channel like Telegram

License

Notifications You must be signed in to change notification settings

husseinferas/api-monitor

Repository files navigation

API Monitor logo

API Monitor

A CLI program that help you check your endpoints by requesting the given servers and send a report message in any supported channel ( Telegram )



This is a CLI project that build with Laravel Zero

Features

  • Check API endpoints status.
  • Save the endpoints in sqlite database.
  • Provide a bin command so you can execute via terminal or schedule the execution in crontab.
  • Send a report message to the supported channels ( Telegram ).

Usage

  • Clone this repo:
git clone https://github.com/husseinferas/api-monitor && cd  api-monitor
  • Install the dependencies:
composer install
  • Setup env and databases:
cp .env.example .env
  • Edit .env file:
CONSUMER_KEY=[your-app-key]
DB_DATABASE=[your-sqlite-database-file-path]
DATA_SEED=[your-data-seed-file]

TELEGRAM_TOKEN=[your-telegram-token]
TELEGRAM_CHAT=[your-chat-id-which-chat-you-want-to-send]
  • Setup data seed:
cp data.example.php .data.php
  • Edit data.php and add your endpoints
return [
    [
        'app' => 'app-name',
        'name' => 'endpoint-name',
        'url' => 'endpoint-url',
    ],
];
  • Seed the database:
php api-monitor migrate:fresh --seed 
  • Setup telegram channel:

    • Create a telegram bot and get your token using BotFather
    • Add your telegram bot to channel or group where you what it to send the reports (it can send it to you directly)
    • Get the chat id using this command curl https://api.telegram.org/bot$[TELEGRAM_BOT_TOKEN]/getUpdates
  • Now you can test the application using this command:

php api-monitor check

Note: you can add this command to crontab and setup a schedule for monitoring.

Contributing

Pull requests are welcome. For major changes.

License

API Monitor is an open-source software licensed under the MIT license.

About

A CLI program that helps you check your endpoints by requesting the given servers and send a report message in any supported channel like Telegram

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published