There is No Such Thing as Too Complex

This is a crazy idea, but it’s true there really is no such thing as too complex in an IT environment. If you take a moment to think about it, everything we do is incredibly complex. Really, just take a moment to think about it. There is not one thing that you do as a Systems Administrator that isn’t complex.

You still don’t believe me do you? Fine. Lets take a look at a very simple operation. We are going to monitor a single box via SNMP. We are going to assume that you already have a central monitoring box already setup.

  1. You configure your box-to-be-monitored with SNMP, configuring the proper access controls
  2. You add any extra scripts that you need to call via SNMP
  3. You open the firewall on the box to allow SNMP traffic
  4. You configure your monitoring server to query the box-to-b-monitored via SNMP
  5. You check the results

And, THAT is the simplified version of events. In reality there is a lot more that goes into just the simple process of monitoring ONE machine. That really is complex, and it’s not a bad thing.

Now having said this:

There is such a thing as BAD complexity.

Bad complexity is complexity for the sake of making something more complex, or the inverse: making something less complex for the sake of being not complex. What you want to do is create a system that is of the correct complexity. That is you want to create a system that is neither too simple, nor too complex.

The problem that you run into with either end of the complexity spectrum is this: either you have a system that is too basic and cannot be scaled properly as the need arises or you have a system that is unmaintainable, and cannot scale because there are too many pieces meshed together.

When you are designing a system, you really will never achieve the perfect amount of complexity. There will always be trade-offs you have to make, based on past design decisions, future configuration considerations, and application constraints. However what you can do is make every decision in a thoughtful way that tries to strike a balance between the two extremes of complexity. And that, is one of the true zen things when you are a sysadmin. You achieve this beautify nearly perfect level of complexity system, and you sit back and smile. Then you go run to put out the next fire.

SysAdminTools – Making Our Lives Easier

First, it is SysAdmin Day! So happy sysadmin day to all of those hardworking sysadmins out there. I’ve had a project that I wanted to get off the ground for a while now. In fact, I think of it every time I move jobs, or start working on a project and think “wow this could be really useful to the other sysadmins out there.”

So in the spirit of sysadmin day, I’m announcing a new open source project that I’ve put up on github today. I’m calling the project “SysAdminTools” my vision is that it is a place where we can put all of those tools that we create out there and help our fellow admins by stopping the constant re-inventing of the wheel at all of the different places out there.

Honestly I’ve never seen a place that is a central collection of scripts and utilities that are useful to the brotherhood of the sysadmin and that is something I have always wanted to see out there. There have been many a long night hacking together some code where I’ve spent a few hours thinking to myself: surely someone has done this before! And yet, if they have it’s locked up in the bowels of some private RVS or on some random file share somewhere.

I think today is a great day to say enough is enough, and put this out there. I’ve seeded it with some of the utilities that we have put together at Stack Exchange some of them need work most of them have TODO’s but I promise to keep working on them and I call on you the great sysadmin community to help add to, grow and improve the scripts in this repository. My dream is that this grows to be THE repository for sysadmin tools and scripts.

The repo can be found at: https://github.com/GABeech/SysAdminTools

The End of A Long Commute

I am nearing the end of my long daily commute from Philadelphia to New York City. The end result hasn’t been too bad, although over the past six months the daily hour and a half commute has worn on me at times. My journey started when I took my current position at Stack Exchange as a Systems Administrator in their New York offices.

My first inclination was to move up there ASAP which, looking back would probably have been the better idea even if I was losing sleep over the stress finding a place in NYC in about a week was causing me. The journey for me began when I accepted the position, I gave my notice at $evil_corporation excited to start in on an adventure at a hot VC funded startup. Of course I started looking for a place, hit up my sister for advice (since she has lived in NYC since she went away to college). I thought I had everything set, spent the week lining up apartments to look at during the week between knowledge dump session. I then intrepidly headed up to NYC for the weekend to look at these places. I had 13 apartments lined up to look at over the course of a weekend.

I figured I would surely find a place that would work during that time. The first rude awakening that told me the NYC real estate market was nothing like what I was used to was when I woke up Saturday morning to find that 8 of the places where no longer available. Wow.

The second realization was that Manhattan apartments where … small, very very small. Although, oddly I was OK with this. I figured if I was going to move to NYC I wanted to be in the center of it all – at least for a year or two – while I’m still young enough to appreciate it. So, feeling a little bit depressed at not having found a place, and stressed out that I only had one week between my last day at my old job, and my first day at my new job I sat down and decided that it would be best to commute for a little while. I was thinking that this would only last a few months at first but that has transformed into six months at this point!

I have survived the commute now with the help of a few gadgets – and being a geek would you expect anything less?

  • Laptop with cellular modem
  • iPod
  • Noise Supressing headphones
  • Kindle

Being able to listen to music, read, serf the internet – and occationall do some work on the train was a great help in me keeping my sanity during these long commutes to and from New York.

Now that I have gotten a place in NYC, and will be moving up in the next few weeks I’ll miss my life in Philly but i’m looking forward to starting anew in NYC.

Full Featured Email using powershell

Note: This is copied (thank you wayback machine) from a previous incarnation of my blog. I was very sad when I realized this post was gone, then very happy when wayback machine had it

A little while ago i spent a lot of time trying to figure out how to send an email that fulfilled the following requirements: Multiple Recipients Attached File Meaningful Subject Sent without an external executable Thanks to powershell’s ability to access .Net libraries, this is a fairly simple, however not quite so well explained – at least that i could find – process. Let us start simply, with the basic SMTPClient Object, and setting the Server Variables, settings, etc. The most basic way to configure your server is to simple create a.Net System.Net.Mail.smtpClient object, and set the email server hostname, taking the defaults.

$SMTPClient = new-object System.Net.Mail.smtpClient
$SMTPClient.host = ""

Simple, right? Then lets get a little bit more complicated. Lets send an email to a host that requires authentication. To do this, we are going to need another .Net object: The NetworkCredential Object from there we can set the domain, user, and password, set these values on our SMTPClient.

$Credentials = new-object System.Net.networkCredential
$Credentials.domain = ""
$Credentials.UserName = ""
$Credentials.Password = ""
$SMTPClient.Credentials = $Credentials

The above code is fairly self explainitory, if you were to display $SMTPClient (Just type $SMTPClient on the console) before and after when you set the Credentials property you can see that is has been set. There are a few other options that you can set on the SMTPClient object, including Port, and SSL to see all that you can do issue

$SMTPClient | gm

Now, we have the Client setup, we want to configure message that we want to send. This will include setting up the Subject, To, From, and Body. What I do to send mail is use an overload of the SMTPClient object that lets us use System.Net.Mail.MailMessage to send the mail, it gives you ALOT more control over your message. First lets get ourselves another .Net Object, the MailMessage Object.

$MailMessage = new-object System.Net.Mail.MailMessage

The next thing I want to do is Setup my addresses The To: and From: addresses are yet another .Net object System.Net.Mail.MailAddress. Here is how you set those up, it is very simple and all you really need is the constructor which is overloaded. You can setup your address in the following two ways.

$Address = new-object System.Net.Mail.MailAddress("user@domain.com")
$Address = new-object System.Net.Mail.MailAddress("user@domain.com", "Display Name")

Either was you want, you need to create at least two one for your sender, one for your recipient. After we get those options out of the way, we just need to do the final setup on our message. That will include setting up the Subject, Body, and feeding it the To: and From: Addresses we already created.

$MailMessage.Subject = "Hello World!"
$MailMessage.Body = "String Body"
$MailMessage.Sender = $Sender
$MailMessage.From = $Sender
$MailMessage.To.add($Recipient)

Why, you ask, am I setting the $Senter twice, the Sender property is the Displayed From Address, while the From property is the repy-to address. You can send an email with an html body just put the code in your Body string, all you have to do is specify the boolean IsHtmlBody property.

$MailMessage.IsHtmlBody = $true

Now, how about adding an attachment. This is done very simply with another MailMessage property set to the .Net Attachements object

$Attachment = new-object System.Net.Mail.Attachment("")
$MailMessage.Attachements.Add($Attachment)

That is all there is to that. There is one last thing we have to do to get this mail off and on it’s way. Simply. Send It!

$SMTPClient.Send($MailMessage)

And we are back

After about a year off from writing on a personal blog, i’ve decided that I should really do this things again – for reals this time.  Being inspired by the writing I’m doing for my job, and the fact I’m actually missing doing this – along with about 30,000 things i’ve been thinking about and keep saying “I need to write this down somewhere.” I’ve finally decided to jump back into the fray.

This is probably my third or fourth time i’ve gone around this loop, writing, not writing. And amazingly through everything my domain has always been available to me.

I’ll be taking the next few days/weeks to get the blog to a state that makes me happy, as well as to start to just write.

 

And really this is placeholder text so there isn’t a 404 on the front page.