Giter VIP home page Giter VIP logo

minecraftnoc's Introduction

MinecraftNOC

DevJam 2020 project: In-game NOC boards

Overview

MinecraftNOC is a Spigot plugin that retrieves arbitrary values from the OpenNMS REST API and panel images from Grafana dashboards. Multiple dashboards are supported. These are displayed in game on signs and framed maps respectively, allowing the player to build a fully immersive collaborative virtual environment that displays real-world data. Signs and maps can be placed in any valid game location to allow for free design of the display. Images can span multiple framed maps to allow for larger sizes and rectangluar shapes.

Metrics are added to the display by clicking a sign with the selection wand (a stick) then executing a command to pass in the partial REST URL. The title takes the first line and the result will consume the remaining 3 lines of the sign (15 chars per line). Any remaining result is truncated.

Color codes are now supported in metrics! Prefix the title string with &x where x is a hex digit 0-f (i.e. standard Minecraft server color codes) to set the title color. Append another code to set the color of the result! A title that is only a single color code (e.g. &c) will omit the title and use all four lines for the result, in the specified color.

Images are added by placing framed maps in the desired shape, left-clicking the top left framed map and then right-clicking the bottom right framed map. All maps in the selected rectangle will be added to the tile set. Once selected, a command is executed to fetch and assign the image to the set of maps.

Left-clicking the air will clear the currently-selected object.

All configuration is saved in real time and loaded when the server starts. A worker thread updates the data at a user-defined interval.

Image of a MinecraftNOC display

Requirements and Compatibility

  • Java 11
  • Spigot 1.15.2
  • OpenNMS Meridian 2019 or higher (Horizon 26+ also works)
  • Grafana with PhantomJS for panel rendering

Commands

  • /getpng panelID -- load the panel with the given ID from the current dashboard
  • /getmetric Title partialURL JsonPointer -- fetch a JSON result from the REST API defined by the base URL in config.yml plus partialURL, extracting the property defined by JsonPointer.
    • /getmetric nodesnmp Title nodeID property -- helper for getting node SNMP properties such as loadavg5
    • /getmetric ifsnmp Title nodeID interfaceID property -- helper for getting interface statistic such as ifHCInOctets
  • /dashboard Operation [Tag] [URL] -- manage Grafana dashboards from which we pull images
    • /dashboard list -- show the configured dashboard tags and URL paths
    • /dashboard select Tag -- set Tag as the current dashboard for /getpng
    • /dashboard remove Tag -- remove the specified dashboard from config
    • /dashboard add Tag URL -- add the specified dashboard to config

Known Issues

So many! A few are:

  • Image rendering can lag the server even though it is in a thread
  • Very little error checking
  • Removing a sign at the wrong time can cause plugin exception

Future Work

  • Robustify and optimize
  • Multiple OpenNMS and Grafana instances
  • Span larger text results across multiple signs
  • Permissions
  • Custom selection wand item and command to get it
  • Additional image sources (e.g. Azure dashboards)
  • Support REST requests with POST and JEXL expressions

Special Thanks

Chris Manigan for the original idea to do a virtual NOC in Minecraft, wrangling OpenNMS and Grafana, and building the NOC room. Alexis Knox for helping with the plugin code.

minecraftnoc's People

Contributors

mszoek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.