Chinese 中文 | English 英文
Channel Monitor is a tool designed for monitoring OneAPI/NewAPI channels. It directly reads the channels data table and tests the availability of each channel's models at regular intervals. Based on whether the requests are successful, it updates the available models and writes them to the data table, thus achieving automated monitoring of the channels. This ensures high availability of the overall OneAPI/NewAPI and minimizes the number of error returns.
- Directly read and write to the OneAPI/NewAPI database
- Test the availability of each model in the channels
- Automatically fetch available models from upstream
- Automatically update the available models in the database for each channel
- Support exclusion of channels and models from monitoring
- Support configurable intervals
- Support multiple database types, including MySQL, SQLite, PostgreSQL, and SQL Server
- Concurrent testing
- Request rate limiting at the second level
- Support Uptime Kuma, push URL during testing to visualize model availability
- Support update notifications via SMTP email and Telegram Bot
- Support both JSON and YAML configuration formats
Download the latest version of the binary file from the Releases page. After configuring config.json
or config.yaml
in the same directory, you can run it. It is recommended to use tools like screen
or nohup
to run it in the background.
Note
mkdir ChannelMonitor && cd ChannelMonitor
wget https://github.com/DullJZ/ChannelMonitor/releases/download/v0.1.0/ChannelMonitor_linux_amd64
chmod +x ChannelMonitor_linux_amd64
# Download and modify the configuration file (choose JSON or YAML format)
wget https://raw.githubusercontent.com/DullJZ/ChannelMonitor/refs/heads/main/config_example.json -O config.json
# or use YAML format
# wget https://raw.githubusercontent.com/DullJZ/ChannelMonitor/refs/heads/main/config_example.yaml -O config.yaml
nano config.json # or nano config.yaml
screen -S ChannelMonitor
./ChannelMonitor_linux_amd64
docker pull dulljz/channel-monitor
# Download and modify the configuration file (choose JSON or YAML format)
wget https://raw.githubusercontent.com/DullJZ/ChannelMonitor/refs/heads/main/config_example.json -O config.json
# or use YAML format
# wget https://raw.githubusercontent.com/DullJZ/ChannelMonitor/refs/heads/main/config_example.yaml -O config.yaml
nano config.json # or nano config.yaml
# If using the host's database, you can simply use the host mode,
# and use localhost:3306 as the database address
docker run -d --name ChannelMonitor -v ./config.json:/app/config.json --net host dulljz/channel-monitor
# If using YAML format
# docker run -d --name ChannelMonitor -v ./config.yaml:/app/config.yaml --net host dulljz/channel-monitor
# If using an SQLite database, mount the database file
# docker run -d --name ChannelMonitor -v ./config.json:/app/config.json -v /path/to/database.db:/app/database.db dulljz/channel-monitor
version: '3'
services:
channel-monitor:
image: dulljz/channel-monitor
volumes:
- ./config.json:/app/config.json
# or use YAML format
# - ./config.yaml:/app/config.yaml
# If using an SQLite database, mount the database file
# - /path/to/database.db:/app/database.db
# If using the host's database, you can simply use the host mode,
# and use localhost:3306 as the database address
network_mode: host
# Download and modify the configuration file (choose JSON or YAML format)
wget https://raw.githubusercontent.com/DullJZ/ChannelMonitor/refs/heads/main/config_example.json -O config.json
# or use YAML format
# wget https://raw.githubusercontent.com/DullJZ/ChannelMonitor/refs/heads/main/config_example.yaml -O config.yaml
nano config.json # or nano config.yaml
docker-compose up -d
The configuration file can be either config.json
, config.yaml
, or config.yml
in the same directory. The program will automatically detect and use the available configuration file in the order of config.yaml
-> config.yml
-> config.json
.
Click to expand/collapse JSON configuration example
{
"oneapi_type": "oneapi",
"exclude_channel": [5],
"exclude_model": ["advanced-voice", "minimax_s2v-01", "minimax_video-01", "minimax_video-01-live2d"],
"models": ["gpt-3.5-turbo", "gpt-4o"],
"force_models": false,
"force_inside_models": false,
"time_period": "1h",
"max_concurrent": 5,
"rps": 5,
"db_type": "YOUR_DB_TYPE",
"db_dsn": "YOUR_DB_DSN",
"do_not_modify_db": false,
"base_url": "http://localhost:3000",
"system_token": "YOUR_SYSTEM_TOKEN",
"uptime-kuma": {
"status": "disabled",
"model_url": {
"gpt-3.5-turbo": "https://demo.kuma.pet/api/push/A12n43563?status=up&msg=OK&ping=",
"gpt-4o": "https://demo.kuma.pet/api/push/ArJd2BOUJN?status=up&msg=OK&ping="
},
"channel_url": {
"5": "https://demo.kuma.pet/api/push/ArJd2BOUJN?status=up&msg=OK&ping="
}
},
"notification": {
"smtp": {
"enabled": false,
"host": "smtp.example.com",
"port": 25,
"username": "[email protected]",
"password": "your-password",
"from": "[email protected]",
"to": "[email protected]"
},
"webhook": {
"enabled": false,
"type": "telegram",
"telegram": {
"chat_id": "YOUR_CHAT_ID",
"retry": 3
},
"secret": "YOUR_WEBHOOK_SECRET"
}
}
}
Click to expand/collapse YAML configuration example
oneapi_type: oneapi
exclude_channel: [5]
exclude_model:
- advanced-voice
- minimax_s2v-01
- minimax_video-01
- minimax_video-01-live2d
models:
- gpt-3.5-turbo
- gpt-4o
force_models: false
force_inside_models: false
time_period: 1h
max_concurrent: 5
rps: 5
db_type: YOUR_DB_TYPE
db_dsn: YOUR_DB_DSN
do_not_modify_db: false
base_url: http://localhost:3000
system_token: YOUR_SYSTEM_TOKEN
uptime-kuma:
status: disabled
model_url:
gpt-3.5-turbo: https://demo.kuma.pet/api/push/A12n43563?status=up&msg=OK&ping=
gpt-4o: https://demo.kuma.pet/api/push/ArJd2BOUJN?status=up&msg=OK&ping=
channel_url:
"5": https://demo.kuma.pet/api/push/ArJd2BOUJN?status=up&msg=OK&ping=
notification:
smtp:
enabled: false
host: smtp.example.com
port: 25
username: [email protected]
password: your-password
from: [email protected]
to: [email protected]
webhook:
enabled: false
type: telegram
telegram:
chat_id: YOUR_CHAT_ID
retry: 3
secret: YOUR_WEBHOOK_SECRET
Configuration explanation:
- oneapi_type: Type of OneAPI, including oneapi, newapi, onehub (reserved field, currently has no effect)
- exclude_channel: IDs of channels to exclude from monitoring
- exclude_model: IDs of models to exclude from monitoring
- models: List of models, used only when unable to retrieve models from the channel (/v1/models)
- force_models: If true, only the above models will be tested, and channel models will not be fetched. Default is false
- force_inside_models: If true, only the models set in OneAPI will be tested, and the model list will not be fetched. Default is false. If force_models is true, this option is invalid.
- time_period: Interval for testing model availability, recommended not less than 30 minutes, accepts time formats s, m, h
- max_concurrency: Maximum number of concurrent tests within a channel, default is 5
- rps: Requests per second within a channel, default is 5
- db_type: Database type, including mysql, sqlite, postgres, sqlserver
- db_dsn: Database DSN string, the format varies by database type. Examples below
- do_not_modify_db: If true, the available models in the database will not be modified. Default is false
- base_url: The base URL for OneAPI/NewAPI/OneHub. If using host mode, you can directly use http://localhost:3000. Currently, only OneHub requires this field.
- system_token: System token, currently only required for OneHub.
- uptime-kuma: Configuration for Uptime Kuma. The status can be
enabled
ordisabled
. The model_url and channel_url are the availability Push URLs for models and channels. - notification: Configuration for update notifications, including SMTP email and Telegram Bot
- notification.smtp: SMTP email configuration, where enabled is
true
orfalse
, host is the SMTP server address, port is the server port, username and password are login credentials, from is the sender's email, and to is the recipient's email - notification.webhook: Webhook configuration, where enabled is
true
orfalse
, type currently only supportstelegram
, telegram contains Telegram Bot settings, chat_id is your telegram ID, retry is the number of retry attempts, and secret is the API key
{
"db_type": "mysql",
"db_dsn": "username:password@tcp(host:port)/dbname"
}
{
"db_type": "sqlite",
"db_dsn": "/path/to/database.db"
}
{
"db_type": "postgres",
"db_dsn": "host=host port=port user=username password=password dbname=dbname sslmode=disable"
}
{
"db_type": "sqlserver",
"db_dsn": "sqlserver://username:password@host:port?database=dbname"
}