Show the stats of your mastodon instance directly on Cachet
- NodeJS
- Cron (Linux/Unix) or Task scheduler (Windows)
First, clone with repository
git clone https://github.com/themimitoof/cachet-mastodon-stats.git
Download all dependencies with:
npm i
Rename the config.js.sample
in config.js
file and edit informations:
var config = {
general: {
cachet_uri: "https://status.themimitoof.fr/", // Here is the URI to your Cachet instance
api_token: "", // Here is the API token (available in your Cachet profile)
instance_about_uri: "https://masto.themimitoof.fr/about/more" // Here is the URI to the about/more page of your Mastodon instance
},
users: {
enabled: true,
metric_id: 1 // Here is the ID of the metric graph
},
posts: {
enabled: true,
metric_id: 2 // Here is the ID of the metric graph
},
instances: {
enabled: true,
metric_id: 3 // Here is the ID of the metric graph
}
}
To try if your settings is OK, launch the code with:
node index.js
Finally, create cron task (or scheduled task (on Windows)). Cron examples:
# Run task every 30 minutes
0/30 * * * * node /opt/cachet-mastodon-stats/index.js
# Or
# Run task every hour
0 * * * * node /opt/cachet-mastodon-stats/index.js
Note : Before adding metric, please ensure the timezone in your php.ini
and on Cachet settings is right.
Here is my recommended configuration for metrics charts:
- Calculation of metrics: Average
- Default view:
Last 12 Hours or(I have some problems with this view) Week - Default value: 0
- Decimal places: 0
- How many minutes of threshold between metric points?: 0