Monitoring & Graphing Eldewrito Server Statistics In LibreNMS

Introduction
LibreNMS is a fantastic open source NMS which I have been using for some time to monitor statistics on my network devices and servers.  The SNMP-based monitoring it offers is very simple to set up and provides fantastic insights into a variety of devices.

I recently spun up some Halo Online \ Eldewrito servers and wanted to keep track of the performance of the servers, so I could know the capacity of my VM hypervisor which I dedicated to the project.  My first step was configuring LibreNMS and monitoring the basic server statistics, but I really wanted to take this a step further, and correlate that data to the player count on the server.  Since Eldewrito is a community based game, a lot of tools are very limited, so tools such as GameTracker aren’t supportive of the game.

Fortunately, Eldewrito has a very simple query port usage and returns simple JSON data, so I was off to figuring out how to get this done.

The Approach
After consulting with some LibreNMS community members on their Discord, it was pointed out to me that LibreNMS supports Nagios plugins, so I got to work writing my own.

My Nagios Plugin
I have published the code for my Nagios plugin on Github.  The repository can be found here, and a direct link to the plugin file here.

If you are setting this up, download the plugin file, and proceed with this article.

LibreNMS Nagios Plugin Setup
LibreNMS provides excellent documentation on how to set up Nagios plugin support, you can find it here.  I am not going to cover this entire setup here, only the parts necessary to get this plugin working.  If you aren’t going to use other Nagios plugins, you don’t need to follow the rest of their guide’s steps either, but it’s there for your reference if the configuration steps change down the road.

The only steps which were required for the setup I wanted were:

  • Update the LibreNMS config.php, add the following lines:

  • Create the Nagios plugins directory:

  • Place my plugin file (found in the above section) in this directory.
  • Make the plugin file executable:

  • Your LibreNMS cron in /etc/cron.d/librenms needs a line which is checking the services.  Mine had this line already, so I didn’t need to change anything.  If yours doesn’t, you could try adding mine or consult the LibreNMS documentation above.

Set Up Your Monitor!
Now that you’ve done the above, LibreNMS should display a Services tab at the top.  Navigate there to add a new service monitor.

On this tab, your next step is filling in the details for the plugin to work.

You will need to know the IP address of your Eldewrito server, as well as the query port.  The default query port is 11775.

Enter the following options:

  • Device – Choose the server which you are hosting the Eldewrito server on.
  • Type  – Select check_eldewrito to use our script.  This should be the filename of the file you put in your plugins folder, if you changed it.
  • Description – Enter whatever you please here, I don’t care. 🙂
  • IP Address – Can be left blank and LibreNMS will autofill the device’s IP, or you can type the device’s IP if you enjoy verbosity like I do.
  • Parameters – Just enter the query port of the Eldewrito server here, default is 11775.

Locating The Graph & Data
Once you’ve set up your first service monitor, go grab a cup of coffee or some dinner.  Allow at least 5-10 minutes for the graphing to start.

The graph is located under the Services tab, you can either click on the device and go to its services tab, or you can go to the services tab on the top and click “All Services”.  You’ll need to toggle the tab from Basic to Detailed as well to see the graph.

Unfortunately on my version of LibreNMS there are some styling issues, the last check time overlaps the plugin check name a bit.  Maybe they will correct this in a future update, it is mostly a cosmetic issue anyway.

There you have it!  You can add this plugin on multiple server devices in LibreNMS, or use it on the same server several times across multiple ports.  The possibilities are quite endless!  It’s possible to extend the plugin to gather other statistics from the server as well, but for the moment, player count was of the most interest to me.

Please feel free to leave a comment here or open an issue on the Github if you run into any questions or problems with the plugin, and I’ll be happy to take a look.

Reinstall GRUB When Your System Isn’t Bootable

Background
From time to time, I have encountered a system where due to some conditions the GRUB installation has become corrupted.  It is a fairly simple matter to reinstall GRUB, and sometimes this can quickly salvage a broken installation.

This is not meant to be a comprehensive guide, but is a compilation of information I found online ([1], [2]) that was useful to me in repairing a few problematic GRUB loaders.  Please feel free to contribute in the comments section if you have something to add.

Setting Up The Environment
The first thing you will want to do is locate a live CD as close to the version of Linux you have installed as possible.  Boot into the Live CD.

You need to set up a functional chroot.  For the purposes of this guide, I will assume /dev/sda1 is your partition on your installation.  We will make a chroot in /mnt/chroot/.

Next, you need to bind the directories that GRUB needs to access.

Finally, chroot to your environment.

Reinstalling GRUB Automatically
You can try a simple reinstall of GRUB automatically first, see if any insightful errors are produced.

Failing that, try the following which will rescan the BIOS drives and update information in the GRUB configuration.

Reinstalling GRUB Manually
If the automatic reinstall does not work for you, try reinstalling via the GRUB shell.

How To Easily Create A DVD From Just About Any Video Format (Linux CLI)

Background
Encoding DVDs seems to be a task which is often overcomplicated.  If you have a video file you would like to convert into a DVD, it turns out it is very easy to do it from the Linux command line.

I was looking for a quick way to encode video to DVD, and I found this fantastic post by vmiimu on the ffmpeg forum. His post was fantastic and gave me the basis to create this guide, so props to vmiimu!  I thought the post was a bit crowded and might be difficult for some people to follow, so I have distilled its essence into this post.

This guide will allow you to convert a wide variety of common video formats into a video DVD.  The scope of this guide is to encode 1 video to 1 DVD with no menu.   The source file can be much larger than a DVD, it will be reduced in size automatically.

Prerequisites
For this guide, you will need the following programs \ commands available.  You may need to install the package from your distribution’s package library.

  • ffmpeg (usually available as a package called ‘ffmpeg‘).
  • dvdauthor (usually available as the package ‘dvdauthor‘)
  • genisoimage (usually available as the package ‘genisoimage‘)
  • growisofs (usually available in the package ‘dvd+rw-tools‘)

Installing these programs is beyond the scope of this guide.  You are assumed to already have them installed.

Hint: If you are using a Red Hat based distro, you may need EPEL and NUX Desktop.

Filenames & Paths Used In This Guide
For ease of understanding, I will be using the following filenames in this guide.  Please substitute your own filenames as you choose.
source.mkv – The original source video file you want to burn to DVD.  This is the only file you must supply, the rest will be created.
temp.mpg – The mpeg encoded video file which will be actually burned to DVD.
dvdmovie – The directory which will store your DVD files during encoding (AUDIO_TS, VIDEO_TS)
dvd.iso – The final .ISO image which you will burn to your DVD.
/dev/dvd – The device path for your DVD burner.


The Process:
Convert the source video to an MPEG video file <4.7GB.
(This may take a long time, and is the most CPU intensive part of the process.)

For videos with 4:3 aspect ratio, use this command:

For videos with 16:9 (widescreen) aspect ratio, use this command:

Assemble a DVD file structure.

Generate an ISO image file.

Burn the ISO to a DVD disk.
Now would be a good time to insert your blank DVD.

That’s It!
Hopefully that went smoothly for you.  Please feel free to post in the comments section if you have any questions or suggestions for improvement of this guide.

Comcast’s Awesomely Accurate Progress Bar

One of my favorite parts of being a Comcast customer is getting to login to my client portal and see my data usage.  (Of course I will enjoy this much less if they eventually decide to enforce their 250GB cap in my area, that will require me to find another ISP or pay their unlimited usage charge or a business class tier).

What I do get a good laugh out of is their ridiculously arbitrary progress bar.

Here is my data usage for January 2016:
comcast-meter-january

As you can see, I used 560GB of data… which although their (non-enforced) cap is 250GB, this appears to be roughly 60% of some arbitrary maximum?

 

I was quite surprised to login today on February 2nd and see this fantastic usage meter appear:
comcast-meter-4gb-off

It would seem that 4GB is almost as much usage as 560GB, who’d have thought?!

I checked on the other page as well and found the same ridiculousness:
comcast-meter-february

I would love to know what’s going on in Comcast’s heads sometimes!

Installing Munin Node on XenServer 6.5

I recently was working with XenServer 6.5 and I wanted to install a Munin Node for graphing system vitals.

Getting Yum working properly to do the install required a bit of Googling, so I wanted to document these commands in case this is helpful to anyone else.

First, you’ll need to install the EPEL repository:

Then, you’ll need to install munin-node using both base and epel repositories.

If you are monitoring with a remote Munin server, don’t forget to add an allow rule in /etc/munin/munin-node.conf, using your favorite text editor.

You can put it somewhere by this line:

Do not fear the regex, that rule allows connections from “127.0.0.1”.  Just replace the digits and leave the other characters alone, and you can use this regex to allow any IPv4 address easily.

Now, we want to go ahead and add the Munin Node to the system startup, and start the process.

Don’t forget to allow incoming port 4949 TCP in your firewall if you are using a remote server to monitor the connections.  Munin shouldn’t talk to unauthorized IPs, but it wouldn’t hurt to only allow connections from the Munin server on that port.  That will not be covered in the scope of this guide, as I don’t know what firewall solution you are using.

Of course, the last step is to add the node in your /etc/munin/munin.conf on your monitoring server.  That config would look something like this, where 123.45.67.89 is your Xen server.

From here, I assume you know the drill with Munin, the server should appear on your HTML pages in 5-10 minutes.  If you’re impatient, you can nudge the cron job that does this by running this:

Have fun!  As always, please feel free to post any questions you have in the comments section, and I will do my best to assist.