Nagios plugin to monitor bandwidth statistics

Below is a little plugin I wrote today for Nagios to monitor bandwidth usage on an interface.  It’s pretty basic and there are probably much better ways to do this, but this doesn’t require installing any extra packages on most systems.

while getopts ":i:s:" opt; do
 case $opt in
 if [ ! -f /sys/class/net/$IFACE/statistics/rx_bytes ]; then
 echo "Interface $IFACE does not exist!"
 exit 1
 echo "Invalid option: -$OPTARG"
 echo "Valid Options are -i to choose an interface and -s to specify number of seconds to average bandwidth over."
 echo "Interface will default to eth0 if not specified and seconds will default to 5 if not specified" >&2
 exit 1
 echo "Option -$OPTARG requires an argument." >&2
 exit 1
RXBytes1=`cat /sys/class/net/$IFACE/statistics/rx_bytes`
TXBytes1=`cat /sys/class/net/$IFACE/statistics/tx_bytes`
sleep $SEC
RXBytes2=`cat /sys/class/net/$IFACE/statistics/rx_bytes`
TXBytes2=`cat /sys/class/net/$IFACE/statistics/tx_bytes`
echo 'OK - Bandwidth Statistics only|RX='$RXBytes3'Bytes;;;;|TX='$TXBytes3'Bytes;;;;'
Posted in Uncategorized | Leave a comment

Don’t Starve Together Dedicated Server on Linux stuff

Recently, I have been playing a game called Don’t Starve Together with my wife.  I wanted to play with setting up a dedicated server and followed the very well made guide at Don’t Starve Together Game Wikia Dedicated Server Setup

But at the end of setting things up, I didn’t like that it was being run using screen instead of a proper managed process that would start on a reboot.  Since I run Cent7 on my server, it was actually super easy to get this going with systemd.  I have messed with setting up init scripts before, but systemd made things way easier to get going.  Below is a paste of the systemd unit file I came up with.

Description=Don't Starve Together Server

Most of the file is pretty self explanatory, but the main things I had to change was the Type from fork to simple, and I had to set the WorkingDirectory to where the binary was installed.  For some reason, it fails to start if you don’t set that.  The last thing I had to do was like a “systemctl enable dontstarve“.  You may or may not have to also do a “systemctl daemon-reload“.  I know I had to several times when I was making edits to the file to get it just right.

Lastly, I made a script to update it nightly and added it into cron.  Below is that script:

systemctl stop dontstarve
su - steam -c "/home/steam/"
systemctl start dontstarve

And then I made one more script to send an email everyday with a list of the users that connected to the service that day.  Again, this was made super simple due to journalctl.  I know a lot of people are down on that part of systemctl, but I found it a bit easier to get what I wanted vs having to pull it from a normal syslog file.

/bin/journalctl --since today | grep joined | mailx -s "Today's Don't Starve Together players" root@localhost
Posted in Uncategorized | Tagged | Leave a comment

CGMiner for ButterflyLabs or ASIC USB Erupter RPMs for RHEL6(and clones)

I created some RPMs for CGMiner on RHEL6(CentOS and Scientific also) for CGMiner that one is compiled for the ButterflyLabs ASIC and one for the USB ASIC Erupter(Icarus).  I have tested both of these as working.  You can grab the RPMS at the below URL.  I can build Fedora RPMS if people are interested.

Posted in Uncategorized | Leave a comment

Compiling CGMiner on Fedora 19 with AMD Catalyst Drivers

Below is a guide to get cgminer compiled and working on Fedora 19 with scrypt using the AMD Catalyst and OpenCL drivers.

First, you will need to enable the RPMFusion Repo for the AMD Catalyst drivers.

sudo rpm -Uvh
sudo rpm -Uvh

Then, you will need to yum install the AMD Catalyst driver and some other needed libraries.

sudo yum -y install curl-devel automake gcc ncurses-devel kmod-catalyst

You should reboot after installing the AMD binary drivers and then run the following command if you have multiple amd cards to get them into the Xorg config.

sudo DISPLAY=:0 aticonfig -f --initial --adapter=all

You will want to reload X or reboot after running that command to load the changes.

Grab the AMD-APP-SDK from here:

Then use the below commands to install it.

tar -xvzf AMD-APP-SDK-v2.9-lnx64.tgz
sudo ./

The installer now creates files in /etc/ to load the libraries.  I think you may be able to trigger this with the ldconfig command, but a reboot definitely reloads it.

Grab the latest AMD-ADL-SDK from here:

Then in the same directory where you downloaded the ADL_SDK zip file, run the below commands:

tar -xvjf cgminer-3.7.2.tar.bz2
unzip -j ADL_SDK_*.zip include/*.h -d cgminer-3.7.2/ADL_SDK/
cd cgminer-3.7.2
./configure --enable-scrypt --enable-opencl
sudo make install

Now, you should have cgminer installed and ready to run using your AMD videocard.  Run the below command to test that it sees your videocard and everything.

sudo /usr/local/bin/cgminer -n

If you are running this over SSH, you may need to export the display as part of the command.

DISPLAY=:0 sudo /usr/local/bin/cgminer -n
Posted in Uncategorized | Tagged , , , , , | 55 Comments

HDHomerun on Fedora 19

Yay, the good folks making Fedora have finally included the DVB modules in the kernel-devel package.  This makes things a lot easier for crafting RPMs since I no longer have to download the full kernel source and compile against it.

Anyways, I have created a yum repo for both the binary and source RPMS for these.  I would love for somebody to test these out and let me know if things work or not for them.  I created newer hdhomerun and hdhomerun-devel packages than what is already in the Fedora repos.  They are created from today’s CVS.

name=HDHomeRun - $basearch

And the SRPMS are here:

name=HDHomeRun Source RPMS - $basearch
Posted in Uncategorized | 1 Comment

Building a repository for CryptoCoin Mining

My hosting company got pwned and lost my entire VM about a week after I just happened to reinstall the desktop that I built all the RPMs on, so I lost my RPMS, Spec files, and SRPMS.  I might try to rebuild everything in a couple of weeks after Fedora 19 comes out…

I’m working on building a repository so that people can get wallets and mining going easily on Fedora 18 and eventually RHEL/Cent/SL.  Right now, I am mostly working on building the wallets for all the coins(both the daemon and the qt clients).  Here is a link to the site that has a list of what I was working from.  I am building all of them from the git repos with the date of the clone as the version number in the RPM.  Below is a list of the ones I have completed.  Please post any additional coins that you would like to see RPMS built for.

  • bbqcoin
  • bitbar
  • bitcoin
  • elacoin
  • FeatherCoin
  • franko
  • gldcoin
  • litecoin
  • nibble
  • Powercoin
  • ppcoin
  • terracoin
  • Worldcoin

Anyways, here is what you need to dump into /etc/yum.repos.d/coins.repo to install any of these wallets.  If anybody wants, I can put the scripts and spec files out in the repo to look at as well.


name=Crypto Coins - $basearch


name=Crypto Coins - $basearch


name=Crypto Coins - $basearch


name=Crypto Coins - $basearch
Posted in Uncategorized | Leave a comment

CGMiner on Fedora 18 with Nvidia GPU

First, you need to install the Nvidia binary drivers from RPMFusion.  The below commands should handle that:

sudo rpm -Uvh
sudo rpm -Uvh
sudo yum -y install kmod-nvidia xorg-x11-drv-nvidia-devel

Then, you need to download and install the CUDA software from

Install with the following command:

chmod ugo+x
sudo ./ -override compiler

Accept the license, answer n to installing the driver, y to the Toolkit, and y to Samples, I left installation paths at default.

Create a file /etc/ that contains the below two lines:


Download the latest source for cgminer and compile with the following command below:

CFLAGS=-I/usr/local/cuda/include LDFLAGS=-L/usr/lib64/nvidia ./configure --enable-cpumining && make && sudo make install

That should get you to the point of having cgminer compiled for Nvidia on Fedora 18.  Feel free to post comments/corrections.

Posted in Uncategorized | 1 Comment