🔌 [Monitoring] Heartbeat v1.0.1

Sorry for my terrible English.:anguished:

Heartbeat plugin can help you make monitoring panel on web site more informative.
You don’t need to constantly poll the status of the server.
Now server sends information about themselves on web site.

Download : Heartbeat v1.0.1
Sources : GitHub


Features

  • Sending information about basic parameters such as motd, version, gamemode, whitelist (on/off), online_mode (on/off);
  • Sending list of players on the server;
  • Sending list of plugins on the server;
  • Http POST-request with JSON content.

Configuration file

// URL to server status handler script url: "http://127.0.0.1/status/status.php"

// User-Agent for server status message
user-agent: “SpongePlugin/1.0”

// Status message interval (in seconds)
interval: 60

Server status message format

{   "server": {     "ip": "localhost",     "port": 25565,     "version": "1.8",     "motd": "A Minecraft Test Server",     "max_players": 50,     "current_players": 2,     "gamemode": "survival",     "whitelist": false,     "online_mode": true   },   "plugins": ["Forge","sponge","heartbeat"],   "players": ["TaoGunner","TestUser"] }
----------

Simple PHP-script example

<?php if (($_SERVER['REQUEST_METHOD'] == 'POST') && (stripos($_SERVER["CONTENT_TYPE"], "application/json") === 0) && $_SERVER['HTTP_USER_AGENT'] == 'SpongePlugin/1.0') {   $data = json_decode(file_get_contents('php://input'), TRUE);   // Now you can save server data in database.   echo 'Server port : '.$data['server']['port'];   echo 'MOTD : '.$data['server']['motd'];   echo 'Players online : '.$data['server']['current_players']; } ?>
---------- **How can i use it?**
  • Save server status with timestamp in database (MySQL etc.) and show monitoring panel on your website;
  • Messages from server didn’t come for 2 minutes? Show offline status on monitoring panel.
2 Likes

Pretty cool plugin ! I was wondering how to handle online/offline on my website, using rcon or not.

:thumbsup:

Not in the config folder? Why not?

I have decided that it is more convenient and easier. :neutral_face:
It is better to make an external configuration file?

Very much better to have it the same as other Sponge plugins. You can copy it out of the jar with ease, by using the Asset API.

Thanks, i’ll try it. :relaxed:

Part of why it should always be external is because the JAR is usually something you don’t monkey with, ever, if you’re the end user.

To do what @ryantheleach is saying, it would instead go in assets/heartbeat.

By the way, I looked at the GitHub repo. Non-java files go in src/main/resources, that’s the point of the directory. They all get added to the JAR anyway. So with the old system, config.conf goes in src/main/resources/today/fallout/heartbeat/config.conf, and with the new system it would go in src/main/resources/assets/heartbeat/config.conf.

1 Like

Update 1.0.1
Add external configuration file ( server_folder/config/heartbeat.conf )

Thx, @pie_flavor, @ryantheleach .