Some music for a change.

I have a music related site over at www.darraghpipes.ie so I rarely post my music related stuff here any more. But I had two professional videos recorded before the summer this year and I’m only figuring out that perhaps I should start getting them out to the public to get a bit of a return on my investment. 🙂

There’s another here.

Create a persistent alias in PowerShell

One of my pet hates about PowerShell is the /b switch isn’t available for get-childItem AKA dir or ls. I just want to read through a list of files in the directory. I don’t want all the other information. At least in the old dir command, the file and directory names were at the start of the line.

So to get around this, I simply just select the Name property from get-ChildItem. But I don’t want to type that every single time. Enter Profile.ps1 and set-Alias.

I have a simple command: List. This shows me exactly what I want to read and no more. You might have something similar for your situation.

You will notice that the alias list actually calls a function. This is because I’m piping the get-ChildItem command to the select command. This isn’t supported by set-alias. So adding this to a function get’s around that minor annoyance.

Oh, you will also notice that I’m changing the colour of the table row header to bright white using a new feature called $PSStyle. At some point, I’m going to script my screen reader to recognise these different colours and tell me what is a directory, what’s an executable, what’s a column header etc. This is the beginning of this process. Colouring the output of get-ChildItem is an experimental feature in PowerShell 7.2 through $PSStyle.FileInfo. I’m trying this out at the moment.
$PSStyle.Formatting.TableHeader = $psstyle.Foreground.BrightWhite
Function GetShortDirectory {
get-childitem | select Name
}


set-alias list GetShortDirectory

Check for high memory usage or hung status in Dell Boomi

I needed to add a check today to dell Boomi or as it’s now known as “Boomi” because it failed twice in the past few months. The problem was it failed but it didn’t actually stop the service. Because Boomi runs within a Java virtual machine, it doesn’t necessarily expose it’s problems to the host operating system. So monitoring systems such as Nagios don’t always pick up the accurate status.

The best way of determining if Boomi was not behaving as expected is to check the Boomi container logs. If there are memory errors, report an exit code of 3 to indicate to Nagios that there is a critical state or check for no logs written in the past two minutes to indicate again that there is a critical status as the Boomi Atom has hung.

Create the script on the Nagios Host and the Boomi Atom

Add this to the libexec directory. Probably /usr/local/nagios/


#check_boomi_memory.sh
#!/bin/bash
BoomiMemoryErrors="$(sed -n "/^$(date --date='10 minutes ago' '+%d %b %Y %H:%M:%S')/,\$p" /opt/Boomi_AtomSphere/Atom//logs/$(date +%Y_%m_%d).container.log | grep 'Low memory')"
if [ -z "$BoomiMemoryErrors" ]
then
echo "Boomi has no memory errors."
exit 0
else
echo "Boomi has encountered memory errors"
exit 2
fi


#check_boomi_hung.sh
#!/bin/bash
AnyBoomiLogsWritten="$(sed -n "/^$(date --date='2 minutes ago' '+%d %b %Y %H:%M:%S')/,\$p" /opt/Boomi_AtomSphere/Atom//logs/$(date +%Y_%m_%d).container.log)"
if [ -z "$AnyBoomiLogsWritten" ]
then
echo "Boomi has stopped"
exit 2
else
echo "Boomi is Running correctly"
exit 0
fi

On the Nagios server and the Boomi atom

First, find the commands.cfg file. Either use the locate command or use find -name. You need to add this to the bottom.


define command{
command_name check_boomi_memory
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_boomi_memory.sh
}


define command{
command_name check_boomi_hung
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_boomi_hung.sh
}

Add this check to the boomi Atom host file within your Nagios servers directory

I’m going to assume you know where that is. It’s usually in either /usr/local/nagios/servers or /etc/nagios/servers/


define service{
use generic-service
host_name #add your hostname
service_description check_boomi_hung
contacts #Add your contacts here.
check_command check_nrpe!check_boomi_hung
}


define service{
use generic-service
host_name #add your hostname
service_description check_boomi_memory
contacts #Add your contacts here.
check_command check_nrpe!check_boomi_memory
}

Update the NRPE config with these new commands

This file is likely in /usr/local/nagios/etc/nrpe.cfg


command[check_boomi_hung]=/usr/local/nagios/libexec/check_boomi_hung.sh
command[check_boomi_memory]=/usr/local/nagios/libexec/check_boomi_memory.sh

Verify that your new checks work

You will do this from the Nagios server. Make sure you reload the config first.

Quick tip:
Use the following command to check the validity of your config.

/usr/sbin/nagios -v /etc/nagios/nagios.cfg

Now to reload nagios, use the usual systemctl reload nagios.service


/usr/local/nagios/libexec/check_nrpe -H -c check_boomi_hung
/usr/local/nagios/libexec/check_nrpe -H -c check_boomi_memory

Coding on an iPad.

I really want a way of writing PowerShell and C# when on the iPad. I love this form factor and it’s versatility. But I haven’t found anything yet that does what I want. Not from a lack of trying. My search has lasted over a year now.

VSCode is my IDE of choice these days. There’s a project that will see this being ported to a web based tool. But for the moment it’s not near where I need it to be. Also, there’s that pesky need to be able to run or compile the code. It’s just not going to be possible on an iPad.

But I came across something today called CodeBlitz. It’s only really for client side development at the moment. Javascript type languages and HTML are it’s focus. But I took a look just to see how it behaved. I’m actually very impressed. If coding on an iPad is something your interested, this web based IDE is probably the approach to consider. OF course, this isn’t a new idea. The Arduino IDE transitioned away to a web based interface a few years ago. But still. It’s interesting.

Notice that on the right, the content of the quick test page that I created refreshed in real time? That’s kind of cool.

I was happy to find plenty of very responsive intelisense and movign around the UI was very efficient.

There are a few accessibility issues but they are minor. Namely unlabeled buttons on the top of the editor. Easy stuff to fix.

Frustrating encounters with external companies.

Frustrating encounters with external companies.

Support provider of a very expensive system hasn’t fixed a dodgy update that they released two weeks ago. I finally get them on the phone and 4 hours later, we have the following conversation:

External Company: There’s a socket error when we try to list the named instances on the database server.

Me: There are no named instances on that database server. It’s exclusively used for your database.

External company: But but wait. Microsoft say you need port 1434 open to list the named instances.

Me: Yeah. You’re right. Port 1434 is needed for named instance discovery. Lucky then we’re not using named instances isn’t it? Port 1434 isn’t needed.

External company: But look here. Telnet to 1434 doesn’t work! Look at this other support article from Microsoft that basically says the same thing from a few years earlier.

Me: Yeah. 1434 is UDP. Not TCP so telnet is never going to work for checking. But anyway. 1434 isn’t needed because as I said a moment ago: We! Aren’t! Using! Named! Instances!

Four hours later. We are going over the same song and dance. With every part of this. Yes. It’s a complex system. Yes. I shouldn’t get annoyed with an external company. But when systems cost tens of thousands of Euro and the support provider knows less about their own system than I do, I just get really really annoyed. Especially when it takes them two weeks to get back to me while the system is down and everyone is back to university.

The problem isn’t even with the database! It’s just one part of the entire system he needs to check while finding the actual root of the problem. Which I already know is corruption due to this badly implemented upgrade? Why and how do I know that? Because they have messed up these updates every year now for the past three years.

Unbelieveable.

PowerShell Universal. Why I strongly discourage you from purchasing it.

PowerShell Universal should be a fantastic tool. A single language used for admin tasks, the UI, scheduling etc. I was delighted to find it!

But after a year of trying and trying again with some success but many many more failures, I’m finally giving up. I was willing to pass it off as a lack of experience with PowerShell when I started first. I’m certainly no master at it now either. But when something simply works in the console but refuses to work in PowerShell Universal over and over again, even I start to wonder if it’s not just me.

I won’t bombard you with examples. But here’s one:

$ApplicationFilter = @{
LogName = 'Application'
ID = 1000, 4005, 0
StartTime = [datetime]::Today.AddDays(-1)
EndTime = [datetime]::Today
}
$SystemFilter = @{
LogName = 'System'
ID = 2004, 6008
StartTime = [datetime]::Today.AddDays(-1)
EndTime = [datetime]::Today
}

$ServerList = Get-RDSessionHost -CollectionName mecheng -ConnectionBroker ((Servername.FQDN))
ForEach ($Server in $ServerList.SessionHost) {
try {
$Result = Get-WinEvent -ComputerName $Server -FilterHashtable $ApplicationFilter -ErrorAction Ignore | Select LogName, Level, ProviderName, TimeCreated, MachineName -ExpandProperty Properties

$Result += Get-WinEvent -ComputerName $Server -FilterHashtable $SystemFilter -ErrorAction Ignore | Select LogName, Level, ProviderName, TimeCreated, MachineName -ExpandProperty Properties
}
catch [Exception] {
if ($_.Exception -match "No events were found that match the specified selection criteria") {
Write-Host "No events found";
}
}
}
Return $Result

Simple enough. This fetches application and system events from RDS session hosts in a specific collection on a given RDS connection broker. It doesn’t use any kind of custom object. It just returns the output in a standard object. But still, although this works perfectly in PowerShell 5 and 7, it doesn’t work in PowerShell Universal. I get a completely strange error relating to the connection broker.

It’s not just this script. I have at least another dozen that work perfectly fine in the console but don’t work at all in PowerShell Universal.

Today I found that I couldn’t get any output at all from these scripts unless I configured them to use the default environment. Not PS5 or 7. That’s new.

Ironman software decided last year that they could no longer support me. Here’s the message from back then.

It’s becoming apparent that this solution is not working for you and I do not have the ability to continue to support your installation of it.

I realize that you have had lot’s of problems but that is what is making me realize that you should investigate another vendor. I apologize that we did not suite your needs.

I hate to be so negative about a small company. I have nothing against them personally. But I think the feedback I’m providing to them and to you is just the responsible thing to do. I see so many people with requests here and so many answers to the effect that there’s a bug, or something will work again in the next version. There’s no doubt in my mind that the product has improved in the past year. But I think it’s just too complicated in it’s design to be reliable. In my opinion, they should stop releasing new features for about 6 months and just focus on making things work and updating the documentation.

If I thought this had a chance of working , I would have put in more hours. I’ve already put in hundreds of hours trying to make this work for me. I see the potential. But without good support from Ironman software and with the inconsistency in so many parts of the tool, I need to just conclude that this is just a failed test.

Some of the features that drew me to this tool are:

  • Easily create API’s with PowerShell
  • Run PowerShell scripts on a schedule using various environments and credentials
  • Use centrally stored variables
  • Store the output of various jobs
  • Easily integrate with active directory for authentication
  • Quickly build UI’s

An example of where I was able to use this effectively last year was during several security sprints. I scheduled a script to go around all of our servers and collect the inbound firewall rules. It stored the job results so that I could then compare job 1 with job 50 for example to see what had changed. I then provided a UI with the number of inbound firewall rules for each server and gave people the ability to drill down to each server to specifically see what firewall rules were listed.

I missed the first two security sprints because I had problems where Universal wasn’t working as expected. But when it worked, it worked really well.

So I’m not saying that there isn’t a need for this product. If there wasn’t a need, I wouldn’t be so frustrated writing this post.

The fact is, it’s just not reliable. I have written a rather large module for me and others in my team to use. Each function produces an object. It works flawlessly. The way I usually plan out what would be nice to have in Universal is I’ll write my functions in this module, let the senior admins use them for a while then I’ll create scripts that call them in PowerShell Universal so that they can either be scripted or a UI can be wrapped around them for more junior people to use. A great example is the above script. I have that so that I can quickly check the status of these RDS session host servers. But my plan was to make a quick UI for it. I would run the script on a schedule then display the output from the last execution. This means the UI opens much faster resulting from the script running a few moments previously in the background. But then something senseless happens that throws a completely unexpected error in PowerShell Universal and what should take 15 to 20 minutes ends up taking me hours.

I urge caution if you are buying this. It’s not very expensive. But the hours I spent trying to make it work cost a lot more. It took me a long time to come to the decision to give up and longer then to decide to post this negative review in conclusion. It’s the first time I have ever felt so compelled to do so. This is a reflection of the frustration I have encountered with this product.

Killing connections to a MS SQL database or change it to single user mode.

You want to take a database off line, delete it or just do something else that requires that no one else is using it.

This can be accomplished by putting the database into single user mode.

However, if that doesn’t work, you will need to find the PID of the user using the database then kill that. Be careful when you are doing this. It stands to reason that if something has a lock / an open connection, it has this for a reason. You could very likely cause data corruption by following these instructions.

  1. Open SQL Server Management Studio
  2. Log in with your domain credential. Try not to use SA. Please. SA is for emergencies.
  3. Open a query window. Press control n on the keyboard, or click the new button on the top left of the screen. There are a few things you should know about the query editor window.
    Commands should usually end with a “;”. Although this isn’t strictly necessary with MS SQL. But it’s a good habit.
    You can run / execute all lines on the screen by pressing F5.
    You can run / execute one specific line or several lines by highlighting those lines then press F5.
  4. Type SP_WHO2
    This shows you all the open connections. Look down through this list to see if there are any connections open to that database. Keep a note of the PID for each connection. Hopefully there will only be one.
  5. Now you’re ready to try to set the database to single user mode:
    ALTER DATABASE <DatabaseName> SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
    Use that command. Remember, highlight the line then press F5 when you’re ready. Of course, change the database name to the database you are working on.
  6. Now, before you go any further, bring the database out of single user mode. It’s served it’s purpose.
    ALTER DATABASE <DatabaseName> SET MULTI_USER;
  7. Press F5 of course.
  8. Watch the output window on the bottom to see if it’s worked.
  9. If you get a message saying the command can’t be completed because of locking, you might need to kill that user’s connection using a more blunt tool. Enter the Kill command. The error you might get is:
    ALTER DATABASE failed because a lock could not be placed on database
  10. Remember the PID that you kept in a safe place earlier? You want to use that now: Replace XXX with the PID.
    Kill XXX;
  11. That’s all there is too it. Be careful. with this kind of work, there’s a risk of corruption. Try to take backups.

I have a lot of updates to write here. It has been a crazy and wonderful few months. But this quick technical guide will get me back into the blogging frame of mind.

The new normal! Blended working! Hybrid working! Remote working! Nonsense? We’ll see.

I’m alternating between states of alarm, annoyance, frustration, amusement and disbelief at the various recommendations, roadmaps, guidelines, laws, media reports and expert opinions that I have read in the past few weeks.   It’s quite a simple question when considered by some people: That question is:  When do we resume working in offices?

There are a few reasons why this question is very important to me.

  1.  I hate commuting
  2. I have a lovely office at home
  3. I have used those extra hours in the morning and evening to achieve things I never would have achieved otherwise.
  4. I love being able to walk my children to school in the morning.  Currently my son comes back from school at 1:40pm so I even get to walk him back. I have relished this opportunity most of all.
  5. There’s no noise in my home office. I am consistently a lot more productive here than I am in an open plan office.

Of course, although in theory, I would love to work from home every day, I acknowledge that it’s important to go talk to colleagues in person.  It’s good to have a coffee with them in the mid-morning and to be able to speak to them about something other than work. So, for that practical reason, I’m okay with a blended or hybrid work balance where I work from home and work in Dublin.  Fortunately, it looks like this will be possible.  The reason I got thinking about this was an article I read that discusses the potential alternative work practises on TheRegister.com.

But let’s get back to the question and take a closer look at it:  When do we resume working in offices?  There are a few considerations that need to be addressed first:

  1.  For people who have settled into remote working, is there a policy to enable them to keep doing this?  In an unmentioned twist, the Irish government and almost all companies are talking about a policy as if it’s written into law. But that’s not the case.  They talk about the new normal, but they haven’t decided how that will look yet.  Instead, they want the work force to return to offices and then after some time, public and private employees will legislate and create policies that may or may not enable / permit officially have sanctioned remote working.  There’s a very clear example of this misinformation from recent news reports in January.  This article from the Journal  and this article from the Irish times talk about law as if it was already in legislation that would enforce the right to switch off.  But it also spoke about the right to ask to work remotely.  An Irish Blogger called HeadRambles wrote about the right to ask for this a few days ago. He makes a good point.  We have always had the right to ask.  Just as the employer always and continues to have the right to say no.  But my understanding of this is that the right to ask still isn’t actually law.
  2. From what I gather, because it’s not very clearly written anywhere, the Irish government have issued two statements concurrently that both appear valid.  They want us all to work from home where possible but also prepare for a return to offices in July.  But how can people who are very likely not vaccinated return to offices in July? Also, on the Citizens Information site, it’s said that RAD (Rapid Antigen Testing) policies along with an opt out policy is required first.  Do you know of any employer that has such a policy?  I certainly don’t and I don’t hear any talk of it either.
  3. There’s also the problem of social distancing.   Some employers were hoping that some magic would happen that would reduce the requirement for social distancing from 2 metres to 1 metre.  This hasn’t changed in 15 months so why they anticipate it was going to change now, I have no idea.  Let me assure you, on ever site I checked Here, here, here and here the requirement for 2 metres social distancing is crystal clear.  So, given that desks are usually spaced so that there is not 2 metres distance between people, this is undoubtedly going to result in a reduction of usable desks. 
  4. There’s a lot of work required to implement proper social distancing guidelines in offices.  So much needs to be considered!  This article is very comprehensive but I’ll provide a quick summary:
    1.  Flow of foot traffic, 2. Touch surfaces such as door handles, 3.  Potentially high use areas that could become congested such as printers, 4.  Routes between desks that could lead to dead ends, 5.  One-way systems to discourage passing in confined spaces and finally 6.  2 metres or 6 feet distance between each desk

So, if you were to believe everything that you’re told, here’s the summary:

  •  Prepare to go back to the office in July
  • If you’re not vaccinated, it’s likely you won’t be going back
  • There’s an international climate crisis but it’s risky to use public transport.  Still, drive if you can and keep the windows open if you’re with someone else.   Imagine that going down the M1? 
  • There’s going to be a new normal with hybrid / blended working, new rights to ask questions that you could ask already and a safer more equitable society overall. But that hasn’t bee legislated for yet.  But just go back to work anyway.  They will get around to that eventually.  No seriously! They promised! 
  • Stay home, stay safe, don’t socialize, don’t travel, be responsible.  Until 80% of the entire population is fully vaccinated (remember this includes young children) we are all still at risk and a fourth wave is very possible.  But hey, come back to work. Sitting in an office with air conditioning all day is going to be absolutely fine.

I have one little foot note to add to this rant. No. I actually have two.

Firstly, I have been very conscious of something amazing that has happened in Ireland.  Drogheda, my hometown is heaving! People are out enjoying coffee shops, restaurants and pubs as if it was the boom all over again. People are stopping to talk on the streets and there’s a general giddiness on the streets.  Drogheda is a commuter town. But these commuters have more time than ever before to live, work and play in Drogheda. That first word live?  That’s an important one.  They aren’t just passing through each day to sleep while they spend most of their productive hours in Dublin. There’s a buzz and an energy in my town that I have never encountered before.  In stark contrast, I have recently travelled to a few other towns that would have relied much more heavily on tourism and commuters.  These are dead.  Soleless husks with depressed locals and decimated businesses.  I’m delighted for Drogheda, but I fear for the financial stability and the mental wellbeing of those areas.  They will bounce back.  Because they are jewels in Ireland’s crown. But if the right policies and laws aren’t implemented before this new normal appears, that new normal, I fear will favour the people at the top with money. Drogheda and commuter towns like it will ease back into being an empty town with empty streets and tired residents burned out by constant commuting.

My other footnote is an opinion that’s less commonly held. I need to bullet point this though for clarity:

  •  I will get vaccinated.  But only now that I know that the vaccinations seem to be effective against variants.
  • I wear a mask.  Not for myself.  But for others. 
  • I never believe the media and only sometimes believe the government.  The medical professionals are the source of information that I prefer.
  • I do not believe everything I read from anyone in relation to Covid-19. I have a healthy mistrust of the entire situation.  Do I believe it’s dangerous?  Yes.  Do I believe it has killed people? Yes.  But I also believe that there’s a massive amount of money changing hands. And where there’s money, there’s greed.   And where there’s greed, there’s corruption. There’s now talks about winter vaccination boosters. This is concerning me.  Not enough yet to make a decision. But it concerns me enough to want to do more research. Because at the end of the day, it’s private companies who are getting this money from states all over the world.  That just seems dodgy to me.
  • Do I believe the so called anti-vaccers? No.  I’m not about to go out and buy a tin foil hat.  But I appreciate the decentres.  The people who ask questions and who dig for the truth are the people I want to hear from.  I don’t believe that the media have done this enough.
  • But the most important thing I need to say is it doesn’t matter what I believe.  It only matters that I take a risk-based approach to this.  I don’t know exactly what is real and what isn’t. So, I take the approach that what the government say is true and as a result, I want to protect those in my circle of family and friends that may be vulnerable.  So, I wear the mask. I wash my hands very regularly. I don’t visit people that are particularly vulnerable unless I have been away from potential risks of infection for at least two weeks.  In my view, this is the most responsible action to take.

Comparason between Shure MV88+, MAudio Uber mic and Neumann TLM 102 microphones

I haven’t edited these sound samples at all. I have also left each microphone flat. Without any EQ or editing. You can hear two computers in the background sometimes. I also haven’t done anything with the volumes. I could probably have nudged the desk a little higher. But to be honest, I just couldn’t be bothered re-recording that sample again.
Each sample has a test phrase spoken by me, then a quick line of a song sung by my daughter MĂ©abh. I included her as it is a contrasting voice and it shows the clarity and brightness of some of the microphones.
I won’t say what microphone I think is better here. That’s open to your own determination.
What I can say is I was less than happy with the extra background noise in the Shure MV88+ but I love it’s well rounded sound. The Neuman TLM 102 is crystal clear. The MAudioUber mic blew me away though. Very little background noise, maybe it’s not as well rounded as the other two but very very crisp.

I don’t know if it needs to be said, but of course, all three microphones have their place. The Shure MV88+ is portable and is perfect for video recording or recording live music when out and about. The Neuman TLM 102 is a studio microphone that requires a cannon connection to a mixing desk. The MAudio Uber mic is a studio microphone perfect for podcasting. It has an advantage in that it doesn’t require a mixer. Still, the comparison was fun.