2018-02-27 23:38:05 +01:00
|
|
|
|
**mastobotmon** monitors your bots on Mastodon.
|
|
|
|
|
|
|
|
|
|
# Install
|
|
|
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
|
|
* Tested OS: Linux
|
|
|
|
|
* C++ compiler (tested: gcc 6.4, clang 5.0)
|
|
|
|
|
* [cmake](https://cmake.org/) (tested: 3.9.6)
|
2018-03-07 11:41:16 +01:00
|
|
|
|
* [mastodon-cpp](https://github.com/tastytea/mastodon-cpp) (at least: 0.6.0)
|
2018-03-07 09:21:13 +01:00
|
|
|
|
* [jsoncpp](https://github.com/open-source-parsers/jsoncpp) (tested: 1.8.1)
|
2018-02-27 23:38:05 +01:00
|
|
|
|
|
|
|
|
|
## Get sourcecode
|
|
|
|
|
|
|
|
|
|
### Development version
|
|
|
|
|
|
|
|
|
|
git clone https://github.com/tastytea/mastobotmon.git
|
|
|
|
|
|
|
|
|
|
## Compile
|
|
|
|
|
|
|
|
|
|
mkdir build
|
|
|
|
|
cd build/
|
|
|
|
|
cmake ..
|
|
|
|
|
make
|
|
|
|
|
|
|
|
|
|
cmake options:
|
|
|
|
|
|
|
|
|
|
* `-DCMAKE_BUILD_TYPE=Debug` for a debug build
|
|
|
|
|
|
|
|
|
|
Install with `make install`.
|
|
|
|
|
|
|
|
|
|
# Usage
|
|
|
|
|
|
|
|
|
|
Run mastobotmon once. Edit config file (`~/.config/mastobotmon.json`).
|
2018-03-02 08:48:02 +01:00
|
|
|
|
Call mastobotmon from cron. If a bot is inactive for longer than the specified
|
|
|
|
|
minutes, it prints an alert to stdout.
|
|
|
|
|
|
|
|
|
|
## Commands
|
|
|
|
|
* add – Add accounts
|
2018-02-27 23:38:05 +01:00
|
|
|
|
|
2018-02-28 23:09:07 +01:00
|
|
|
|
## Error codes
|
|
|
|
|
|
|
|
|
|
Same as [mastodon-cpp](https://github.com/tastytea/mastodon-cpp/blob/master/README.md#error-codes), plus:
|
|
|
|
|
|
|
|
|
|
| Code | Explanation |
|
|
|
|
|
| --------: |:------------------------------|
|
|
|
|
|
| 1 | Couldn't read / create config |
|
2018-03-11 15:25:43 +01:00
|
|
|
|
| 2 | Reached limit of API calls |
|
2018-02-28 23:09:07 +01:00
|
|
|
|
|
|
|
|
|
If you use a debug build, you get more verbose error messages.
|
|
|
|
|
|
2018-03-07 11:41:16 +01:00
|
|
|
|
## Example config file
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
"accounts" : {
|
|
|
|
|
"account1@example.social" : {
|
|
|
|
|
"access_token" : "xxxx",
|
2018-03-07 18:33:13 +01:00
|
|
|
|
// Alert after this many minutes of inactivity
|
2018-03-07 11:41:16 +01:00
|
|
|
|
"minutes" : 720
|
|
|
|
|
},
|
|
|
|
|
"account2@example.social" : {
|
|
|
|
|
"access_token" : "yyyy",
|
|
|
|
|
"minutes" : 1450
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-03-07 18:33:13 +01:00
|
|
|
|
// In daemon mode, check every x minutes
|
|
|
|
|
"daemon_check" : 60,
|
|
|
|
|
// This is the directory where the mentions and statistics will be stored.
|
2018-03-07 11:41:16 +01:00
|
|
|
|
"data_dir" : "/home/user/mastobotmon",
|
2018-03-07 18:33:13 +01:00
|
|
|
|
// Possible values: cron (daemon mode later)
|
2018-03-07 11:41:16 +01:00
|
|
|
|
"mode" : "cron"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
## Mentions
|
|
|
|
|
|
2018-03-16 11:28:53 +01:00
|
|
|
|
Mentions are written to `data_dir/mentions_account.csv`. The format is: acct;created_at;content;url.
|
2018-03-07 11:41:16 +01:00
|
|
|
|
|
2018-03-15 14:35:58 +01:00
|
|
|
|
## Statistics
|
|
|
|
|
|
|
|
|
|
Statistics are written to `data_dir/statistics_account.csv`. The format is: time;toots;followers.
|
|
|
|
|
|
2018-02-27 23:38:05 +01:00
|
|
|
|
# TODO
|
|
|
|
|
|
|
|
|
|
* Version 0.1.0
|
2018-03-02 06:11:18 +01:00
|
|
|
|
* [x] Cron mode
|
2018-02-28 22:16:56 +01:00
|
|
|
|
* [x] Config file
|
2018-03-02 06:11:18 +01:00
|
|
|
|
* [x] Alert if account seems inactive
|
2018-02-27 23:38:05 +01:00
|
|
|
|
* Version 0.2.0
|
2018-03-02 08:48:02 +01:00
|
|
|
|
* [x] Allow to add accounts later
|
2018-03-07 11:41:16 +01:00
|
|
|
|
* [x] Write mentions to file
|
2018-02-27 23:38:05 +01:00
|
|
|
|
* Version 0.3.0
|
2018-03-11 15:25:43 +01:00
|
|
|
|
* [x] Respect X-RateLimit header
|
2018-03-15 14:35:58 +01:00
|
|
|
|
* [x] Write statistics to file
|
2018-02-27 23:38:05 +01:00
|
|
|
|
* Version 0.4.0
|
|
|
|
|
* [ ] Daemon mode
|
2018-03-15 14:40:06 +01:00
|
|
|
|
* [ ] Options to turn mention grabbing and statistics off
|
2018-02-27 23:38:05 +01:00
|
|
|
|
* Version 0.5.0
|
|
|
|
|
* [ ] Allow to run command on alert
|
|
|
|
|
|
|
|
|
|
# Copyright
|
|
|
|
|
|
|
|
|
|
Copyright © 2018 tastytea <tastytea@tastytea.de>.
|
|
|
|
|
License GPLv3: GNU GPL version 3 <https://www.gnu.org/licenses/gpl-3.0.html>.
|
|
|
|
|
This program comes with ABSOLUTELY NO WARRANTY. This is free software,
|
|
|
|
|
and you are welcome to redistribute it under certain conditions.
|