Category Tricks, Tips, or Hacks

I love data – and the importance of monitoring

I find failure causes interesting.  I enjoy fixing things, but more so I like learning why something is broke.  A large part of fixing any problem is finding the root cause.  One of the things that can aid in finding a root cause is data.  The more data you have on something, the easier it is for you to spot an anomaly and track down the root cause.

Let’s take a real world example.  We implement a monitoring tool call Nagios XI where I work and it does all sort of nifty monitoring and alerting for us.  I recently got a notification that disk space was running low for a particular mounted disk that is used to store various files.  This alert was unusual as the files on this disk are only kept for a specific time period (45 days in this case) and then they are purged.  So seeing this alert raised an eye brow.  First thing I did?  Check our monitoring system.  Let’s see what recent disk usage activity looks like for the last few months:

Look at that data! Isn’t it wonderful?  No?  Sure it is!  Let me explain… you can see things humming along nicely.  Files are getting deleted regularly keeping space usage in check… until mid-February.  Well that’s weird… what changed?  Remember what I said about the 45 day retention period?  Think what happened about 45 days before mid-February… That’s right, the New Year!  Our year changed from 2016 to 2017.  At this point, things start clicking.  Hop in to the server, and my suspicions are confirmed.  The retention job points to a year specific main folder.  It was pointed to the 2016 folder.  Simply updating the job to point to the 2017 folder and re-running the job fixed the issue.  Problem solved! At least for a year ūüôā

And thus the importance of monitoring your stuff.  Had we not been monitoring this server, we wouldn’t have known this cron job broke and that the disk was approaching full. What happens when a disk maxes out?  Well, new data can’t be written, and would have been lost. Proactive monitoring once again saves the day, allowing us to to fix a problem before it actually becomes a real problem!  Pretty neat, you know, if you’re in to that kind of stuff.

Fix SickBeard “Pushbullet Notification Failed” Error

pushbeardGetting the “Pushbullet Notification Failed” error from your SickBeard notifications? ¬†Well, the fix is simple, and here is what you have to do:

1) Find pushbullet.py in your SickBeard install directory.  For me, this file was located in:

/volume1/@appstore/sickbeard-custom/var/SickBeard/sickbeard/notifiers

2) Open that file in your editor of choice, for me that is vi, and make the following change:

Find:

if method == ‘POST’:
uri = ‘/api/pushes’
else:
uri = ‘/api/devices’

And change to:

if method == ‘POST’:
uri = ‘/v2/pushes’
else:
uri = ‘/api/devices’

Note that the devices uri doesn’t change, you just need to update the pushes uri. ¬†I could dig in to the in’s and out’s of the Pushbullet API if I really felt like figuring out why this changed, but I don’t really care that much. ¬†I just wanted to get my notifications working again.

3) Write and Quit the changes and then restart SickBeard.  This will recompile your changes in the python code and then hop in to your notifications and send a test message to make sure that worked.

That fixed it for me! Happy Pushbulleting ūüôā

UPDATE 9/14/2014: Well, Something broke again. ¬†I couldn’t figure out what (I think it has to do with the JSON body but I didn’t feel like rewriting something that’s been fixed elsewhere), so I snagged the latest pushbullet.py from the troubled SickRage project and used that instead. ¬†Note, I had to switch the devices uri back to the /api/devices value because the /v2/devices value doesn’t work for me for some reason. ¬†Hopefully this doesn’t break again :-\

Fix Synology Sickbeard Shortcut When Using https

sickbeardI have been working on getting SickBeard setup on my Synology DS1512+ NAS, and I’ve got pretty much everything worked out. ¬†One of the final things I wanted to get working properly was https support with my self signed certificate I setup for my Synology. ¬†I know, not really very important since I’ll only ever access it over my lan or via a VPN, but still… I went through the trouble of getting the self signed certificate working on my Synology, I wanted it to work here too. ¬†It was a little tricky in a couple of regards.

First, I had to get it to use my certificate and key. I tried linking straight to the existing ones the Synology uses in¬†/usr/syno/etc/ssl sub-directories but SickBeard just refused. I figured it was a permission issue since those certs were owned by root only. I decided the easiest way was to just copy over the 2 files I needed in to SickBeard’s directory and switch their owner:

Andromeda> cd /usr/syno/etc/ssl
Andromeda> cp ssl.crt/server.crt /usr/local/sickbeard-custom/var/server.crt
Andromeda> cp ssl.key/server.key /usr/local/sickbeard-custom/var/server.key
Andromeda> cd /usr/local/sickbeard-custom/var
Andromeda> chown sickbeard-custom server.crt
Andromeda> chown sickbeard-custom server.key

Then alas I was able to put in server.crt and server.key in SickBeard, restart it and it used my certs!  Woot!

I was pretty happy with myself until I clicked the SickBeard shortcut in the Synology menu and was greeted with my second issue:

The client sent a plain HTTP request, but this server only speaks HTTPS on this port.

Oh you son of a…

I’m way too anal about my things all working properly to live with that atrocity, so after a minute of poking around I quickly found the config for it the following file:¬†/usr/local/sickbeard-custom/app/config

Pop that file open in vi and change the protocol line from http to https.  Save and quit, then simply reload your Synology web interface, and bam! Your shortcut will work once again, launching Sickbeard via https! Yay!

sbshortcut

Defeat the SJ-R’s Paywall with Chrome in 4 seconds

Print is dead.  You hear me SJ-R?

Central Illinois’ newspaper – The State Journal Register – was bought up by media¬†conglomerate¬†GateHouse Media back in 2006. ¬†Since then the paper has been on a wildly out of control downward spiral.

GateHouse media’s latest “innovation” in the digital age is… wait for it…

A PAYWALL!

Jesus GateHouse… seriously? ¬†It is the year 2013, and you think a Paywall is the way to move your business FORWARD? ¬†Have you learned nothing from your bigger brothers like The Times which lost over 4 million readers back in 2010 thanks to their paywall? ¬†Just as with TV Shows or Movies, if someone doesn’t want to pay for your media, they will simply not pay. ¬†Trying to trick the user in to consuming the media how you think it should be consumed will never bring in money. ¬†You will simply drive previous viewers away from you and to other services that remain free.

Your draconian thinking of what media is and how it should be consumed will be the end of you.

I was quite miffed today when I tried to read an article a friend had linked on Facebook and I was presented with this Paywall pop-up.  Clicking the X redirects you to the main page.  This really got on my nerves as all of the content was right there, sitting behind a cheezy looking pop up box.  How stupid.  So, I spent exactly 4 seconds, reloaded the web page, and read the content as it should be consumed.  For free.

I thought I should share my tip with others who may not be aware of this pretty nifty feature in Chrome. ¬†You can¬†selectively¬†disable javascript on any website you visit. ¬†Most sites use javascript for good… but some sites, like the SJ-R site, uses javascript for evil.

Read More

Forcing sendmail to use a different port for outgoing mail

In the world of Linux (specifically CentOS 5 in this case) sendmail is a very useful utility. ¬†It is what allows linux to send email to regular ole mail servers. ¬†But, if you’re reading this, you likely know that.

Typically sendmail uses standard SMTP port 25 to do its business. ¬†In most cases, this works fine as is, but more and more now I am seeing ISP’s block port 25 and leave the customer with no recourse (coughAT&Tcough). ¬†This makes it particularly difficult for sendmail to do its thing since it is supposed to work on port 25.

The simplest solution is to reconfigure sendmail to send out on a port other than 25. ¬†The only catch-22 here is that the mail server must accept mail on that port as well. ¬†Now, I’ve already set that up using iptables with a simple REDIRECT function and tested to make sure my CentOS box can communicate to it on that port using telnet, so I’m not going to get in to that, as anyone can forward a port).

Read More

Tricky php.ini settings

There are several ways PHP settings can be adjusted.  The 2 most common are in the Apache config file, or usually, the php.ini file.

Typically you can use phpinfo(); to get the php settings.  This is extremely useful as it also shows EXACTLY which php.ini file is being used to pull its configuration from.

I recently ran in to a particularly frustrating situation trying to adjust the settings. ¬†I had already grep’ed throughall the Apache config files and knew there were no php configuration settings hidden in there. ¬†So, I knew it was pulling its config from the php file. ¬†In the past it has been a simple matter to adjust the value in the ini file and then reload Apache (this causes php to reload). ¬†Well, this time it wasn’t working. ¬†No matter how many times I killed Apache’s processes and restarted it, it was STILL pulling the old values.

I was really about to lose my mind when I ran the phpinfo via the php cli, and it showed my new correct values!  Arggg!!!

After a shamefully long amount of time trying to figure this out, I FINALLY found the solution. ¬†Well, unbeknownst to me, this server was using something call php-fpm. ¬†Php-fpm is a FastCGI Process Manager, which is an alternative to PHP FastCGI (which if was being used would have also hung me up). ¬†This basically spawns php in a separate service to allow it to work faster. ¬†Well, since php is basically its own process, you have to restart the php-fpm service to get Apache’s PHP to reload the config file!

[root@myserver php53]# /etc/init.d/php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done

And bam, I finally got the new settings to load! ¬†Note, if you’re using the standard FastCGI module you’d use php-fastcgi restart instead.

I feel silly for not knowing about this php-fpm process before… but I’m used to Apache just calling php directly itself. ¬†This was a set up I had not dealt with before, so it was time for me to learn something new.

Happy PHP’ing folks!

Fix 7’s Taskbar Right Clicking

Something that has bugged me for a long time in Windows 7 is how the taskbar right-click functionality was changed. ¬†Since Windows 95, when you right clicked on an item in the taskbar, you were presented with a menu to Restore, Minimize, Maximize, Close, and with some programs, some nifty custom options (like PuTTY’s custom menu, which since I use it ¬†a lot, is the main source of my gripes here).

But, for some reason in Windows 7, Microsoft decided to do away with all of that and change what the right click does. ¬†Right clicking now brings up Windows 7’s jump lists. ¬†A feature that is absolutely worthless to a good 95% of the programs that run on Windows. ¬†It was so incredibly frustrating to me to right click on running program and not be presenting with a useful menu, and right clicking on the program name in the jump list presenting you with an equally worthless menu. ¬†Even more frustrating was there is an alternate way to access jumplists, by clicking and dragging up, they didn’t have to change the right click functionality! ¬†The final straw was when they (as usual) gave you no setting to change this option back to the classic right click menu. ¬†Now, I realize you can hold the Shift key and right click on a taskbar item to get the classic menu, but I want that to be the default function, not something that his hidden behind the shift key.

Well, as you may have guessed, I have a fix for this. ¬†A little free program called 7 Taskbar Tweaker. ¬†This program will let you change the right click function back to the classic menu (and a slew of other tweaks)! ¬†And even more so, if you do use jump lists for something, you can still access them by the other method of clicking and dragging up like I mentioned above. ¬†The only slight downside is that the program must run in the system tray for the changes to remain in effect as it actually has to inject a dll and hook in to the explorer process since there are no registry options for the tweaks it applies. ¬†Fortunately, the memory footprint is fairly small, clocking in at only around 2mb of ram used, so it’s not going to have an adverse effect on systems, even those with only a couple gigs of ram.

So, you can change this:

 

Back in to something useful:

Windows 7 SP1 is out, time to get back some HD space

Well, it’s that time of the season again where Microsoft pushes out a new service pack. ¬†This time it is Service Pack 1 for Windows 7. ¬†I have actually been running SP1 for a few weeks now (yay for developer’s releases) on 3 different machines, all with zero problems. ¬†The install is smooth and the service pack didn’t cause any issues.

As with the service packs for Windows Vista, there is a command you can run for your command line that basically¬†permanently¬†installs the service pack files on your machine (by removing all of the backup files it makes during install). ¬† I previously showed you how to do this for Vista SP1 and Vista SP2, so now it is 7 SP1’s turn.

Also, as with previous SP release, Microsoft has once again changed the command to make this happen. ¬†I’m not sure why they always want to make you play guess-the-command, but I did the research for you, and here it is. ¬†Run this at an Administrator command prompt:

dism /online /cleanup-image /spsuperseded

It will take a few minutes to run and do its thing, but once it is finished you will get back around 1.3gb to 1.5gb of space.  Not bad for running 1 command at the command line!  Just remember, this command does make the service pack install permanent, so there is no reverting after this, but honestly, once you have booted a few times and everything works fine, there is really no reason to ever want to revert.

So go claim back your space!