Monitoring SystemD Units With Nagios

Ever forgotten to add a critical service to monitoring? Want to know if a service or process fails without explicitly monitoring every service on a host? …Then why not use SystemD’s existing knowledge of all the enabled services? Thanks to ‘Kbyte’ who made a simple Nagios plugin to do just this! Requirements Python3 (For RHEL/CentOS 7 yum install python34) python-nagiosplugin My pre-built RPMs or pip3 install nagiosplugin PyNagSystemD

May 23, 2016 · 1 min · 68 words · Sam McLeod

Online Conversion from SQL_ASCII to UTF8 in PostgreSQL

Scripts and source available here: sql_ascii_to_utf8 The Goal To be able to take a Postgres Database which is in SQL_ASCII encoding, and import it into a UTF8 encoded database. Requirements: Python3 (For RHEL/CentOS 7 yum install python34) python-nagiosplugin My pre-built RPMs or pip3 install nagiosplugin PyNagSystemD The Problem PostreSQL will generate errors like this if it encounters any non-UTF8 byte-sequences during a database restore: # pg_dump -Fc test_badchar | pg_restore -d test_badchar_utf8 pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 2839; 0 26852 TABLE DATA table101 postgres pg_restore: [archiver (db)] COPY failed for table "table101": ERROR: invalid byte sequence for encoding "UTF8": 0x91 CONTEXT: COPY table101, line 1 WARNING: errors ignored on restore: 1 And the corresponding data will be omitted from the database (in this case, the whole table, even the rows which did not have a problem): ...

May 23, 2016 · 5 min · 902 words · Sam McLeod

Speeding Up rsync

The most common way to use rsync is probably as such: rsync -avr user@<source>:<source_dir> <dest_dir> Resulting in 30-35MB/s depending on file sizes This can be improved by using a more efficient, less secure encryption algorithm, disabling compression and telling the SSH client to disable some unneeded features that slow things down. With the settings below I have achieved 100MB/s (at work between VMs) and over 300MB/s at home between SSD drives. ...

May 3, 2016 · 2 min · 224 words · Sam McLeod

Mirroring a Gitlab project to Github

Let’s pretend you have a project on Gitlab called ask-izzy and you want to mirror it up to Gitlab which is located at https://github.com/ask-izzy/ask-izzy Assuming you’re running Gitlab as the default user of git and that your repositories are stored in /mnt/repositories you can following something similar to the following instructions: Grant write access to Github Get your Gitlab install’s pubkey from the git user cat /home/git/.ssh/id_rsa.pub On Github add this pubkey as deploy key on the repo, make sure you tick the option to allow write access. ...

February 4, 2016 · 1 min · 145 words · Sam McLeod

The Best Of - 2014 Edition

At the end of every year I note down a summary of the best applications, hardware & websites I’ve enjoyed & depended on throughout the year (and often for some time before). This post has long since been superseded. You can find the latest version of this post here. Software / General Use Fastmail - https://www.fastmail.com Evernote - https://evernote.com Reeder - http://reederapp.com Keynote - https://www.apple.com/au/mac/keynote Lastpass - https://lastpass.com Plex - https://plex.tv Calibre - http://calibre-ebook.com Software / Geek Use Sublime Text - http://www.sublimetext.com/3 Homebrew - http://brew.sh DropSync - http://mudflatsoftware.com Beets - http://beets.radbox.org Textual - http://www.codeux.com/textual XLD - http://tmkk.undo.jp/xld/index_e.html Code Academy - http://www.codecademy.com Exercism.io - http://exercism.io Sickbeard + Headphones + Couchpotato + Sabnzbd - http://www.totalhtpc.com/ultimate-usenet-guide.html Software / Mobile Tweetbot - http://tapbots.com/software/tweetbot Pushover - http://pushover.net Lastpass - https://lastpass.com Keynote - https://www.apple.com/au/ios/keynote Reeder - http://reederapp.com/ios Evernote- https://evernote.com Plex - https://plex.tv Backblaze - https://www.backblaze.com WTF Podcast - http://www.wtfpod.com/app MiniHack - https://itunes.apple.com/au/app/minihack-for-hacker-news/id631108846?mt=8 Uber - https://itunes.apple.com/au/app/uber/id368677368?mt=8 Goodreads - https://itunes.apple.com/au/app/goodreads-book-recommendations/id355833469?mt=8 Notify4M - https://itunes.apple.com/au/app/notify4m/id499161979?mt=8 Bandcamp - https://itunes.apple.com/au/app/bandcamp/id706408639?mt=8 Hype Machine - https://itunes.apple.com/au/app/hype-machine/id414315986?mt=8 Nuzzel (Only got onto this today) - https://itunes.apple.com/au/app/nuzzel-news-from-your-friends/id692285770?mt=8 Alien Blue - http://www.reddit.com/r/alienblue Software / SysAdmin or DevOps Specific Gitlab - http://gitlab.org Gitlab-CI - https://about.gitlab.com/gitlab-ci Dash - http://kapeli.com/dash PostgreSQL (Makes my list every year & just keeps getting better) - http://www.postgresql.org PGBadger - http://dalibo.github.io/pgbadger Docker - https://www.docker.com Consul - https://consul.io Puppet (I couldn’t do my job as well without it) - http://puppetlabs.com iTerm - http://iterm2.com Nginx - http://nginx.org Htop - http://hisham.hm/htop Bonnie++ - http://linux.die.net/man/8/bonnie++ Openfire - https://www.igniterealtime.org/projects/openfire Hiera-Eyaml - https://github.com/TomPoulton/hiera-eyaml Rubinius - http://rubini.us Puma - http://puma.io XenServer - http://xenserver.org ElasticSearch - www.elasticsearch.org Logstash - http://logstash.net FPM - https://github.com/jordansissel/fpm PFsense - https://www.pfsense.org Debian Jessie (Not quite released but the next great version of the best linux Distro IMO) - https://www.debian.org/releases/jessie Check_MK Multisite - https://mathias-kettner.de/checkmk_multisite.html PWSafe - https://itunes.apple.com/au/app/pwsafe-password-safe-compatible/id520993579?mt=12 Supervisord - http://supervisord.org Websites Last.fm - http://www.last.fm/user/sammcj2000 Feedly - https://feedly.com HackerNews - https://news.ycombinator.com/news Lucidchart - http://lucidchart.com/ MondoTunes (Might be a little biased here!) - http://mondotunes.org Hardware Das Ultimate 4- http://www.daskeyboard.com Logitech Performance MX - http://www.logitech.com/en-au/product/performance-mouse-mx 15’’ Macbook Pro Retina - http://www.apple.com/au/macbook-pro iPhone 6+ (because its bigger than bigger, or something) - https://www.apple.com/iphone-6 CuBox - http://www.solid-run.com/product/cubox-i4pro Parani SD1000 Bluetooth Serial Adapter - http://www.senaindustrial.com/products/industrial_bluetooth/sd1000.php SanDisk Extreme Pro 480GB SSD - http://www.newegg.com/Product/Product.aspx?Item=N82E16820171999 Other / Non-tech All Day Socks - http://alldaysocks.com Sennheiser Amperior On-Ear Headphones - http://www.head-fi.org/products/sennheiser-amperior-on-ear-headphones O2 + ODAC - http://www.jdslabs.com/products/48/o2-odac-combo Benchmark DAC1 HDR - http://benchmarkmedia.com/products/benchmark-dac1-hdr-digital-to-analog-converter Bellroy Wallets - http://bellroy.com Ink Shoes - http://www.inkshoes.it Kindle Paperwhite - http://www.amazon.com.au/gp/feature.html?docId=3077740006 Nerf Jolt - http://nerf.wikia.com/wiki/Jolt_EX-1 Books The Phoenix Project (Reread this year for the 3rd time) - http://itrevolution.com/books/phoenix-project-DevOps-book Surely You’re Joking Mr Feynman! - https://www.goodreads.com/book/show/5544.Surely_You_re_Joking_Mr_Feynman_ The Dark Tower Series - https://www.goodreads.com/book/show/43615.The_Gunslinger Snow Crash - https://www.goodreads.com/book/show/830.Snow_Crash

February 15, 2015 · 2 min · 426 words · Sam McLeod