diff --git a/README.md b/README.md index 48b8a94..ec27d83 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ The RCON Module is only enabled if `RCON_HOST` and `RCON_PASSWORD` is set docker run -e RCON_HOST=127.0.0.1 \ -e RCON_PORT=25575 \ -e RCON_PASSWORD="Password" \ + -e DYNMAP_ENABLED="True" \ -p 8000:8000 \ -v /opt/all_the_mods_3/world:/world \ joshi425/minecraft_exporter @@ -62,6 +63,14 @@ overall_ticktime player_online ``` +the following Metrics are exposed if Dynmap Support is enabled: + +``` +dynmap_tile_render_statistics +dynmap_chunk_loading_statistics_count +dynmap_chunk_loading_statistics_duration +``` + # Dashboards In the folder dashboards you'll find grafana dashboards for these metrics, they are however incomplete and can be expanded diff --git a/minecraft_exporter.py b/minecraft_exporter.py index d817c28..a8d71e2 100644 --- a/minecraft_exporter.py +++ b/minecraft_exporter.py @@ -54,6 +54,27 @@ class MinecraftCollector(object): overall_tps.add_sample('overall_tps',value=overallregex.findall(resp)[0][1],labels={}) overall_ticktime.add_sample('overall_ticktime',value=overallregex.findall(resp)[0][0],labels={}) + # dynmap + if os.environ['DYNMAP_ENABLED'] == "True": + dynmap_tile_render_statistics = Metric('dynmap_tile_render_statistics','Tile Render Statistics reported by Dynmap',"counter") + dynmap_chunk_loading_statistics_count = Metric('dynmap_chunk_loading_statistics_count','Chunk Loading Statistics reported by Dynmap',"counter") + dynmap_chunk_loading_statistics_duration = Metric('dynmap_chunk_loading_statistics_duration','Chunk Loading Statistics reported by Dynmap',"counter") + + resp = mcr.command("dynmap stats") + + dynmaptilerenderregex = re.compile(" (.*?): processed=(\d*), rendered=(\d*), updated=(\d*)") + for dim, processed, rendered, updated in dynmaptilerenderregex.findall(resp): + dynmap_tile_render_statistics.add_sample('dynmap_tile_render_statistics',value=processed,labels={'type':'processed','file':dim}) + dynmap_tile_render_statistics.add_sample('dynmap_tile_render_statistics',value=rendered,labels={'type':'rendered','file':dim}) + dynmap_tile_render_statistics.add_sample('dynmap_tile_render_statistics',value=updated,labels={'type':'updated','file':dim}) + + dynmapchunkloadingregex = re.compile("Chunks processed: (.*?): count=(\d*), (\d*.\d*)") + for state, count, duration_per_chunk in dynmapchunkloadingregex.findall(resp): + dynmap_chunk_loading_statistics_count.add_sample('dynmap_chunk_loading_statistics',value=count,labels={'type': state}) + dynmap_chunk_loading_statistics_duration.add_sample('dynmap_chunk_loading_duration',value=duration_per_chunk,labels={'type': state}) + + + # entites resp = mcr.command("forge entity list") entityregex = re.compile("(\d+): (.*?:.*?)\s") @@ -68,7 +89,7 @@ class MinecraftCollector(object): if player: player_online.add_sample('player_online',value=1,labels={'player':player.lstrip()}) - return[dim_tps,dim_ticktime,overall_tps,overall_ticktime,player_online,entities] + return[dim_tps,dim_ticktime,overall_tps,overall_ticktime,player_online,entities,dynmap_tile_render_statistics,dynmap_chunk_loading_statistics_count,dynmap_chunk_loading_statistics_duration] def get_player_quests_finished(self,uuid): with open(self.betterquesting+"/QuestProgress.json") as json_file: @@ -203,4 +224,4 @@ if __name__ == '__main__': REGISTRY.register(MinecraftCollector()) print("Exporter started on Port 8000") while True: - time.sleep(1) \ No newline at end of file + time.sleep(1)