Is the Nanny state crying wolf?

Please excuse the mixed metaphors in the title of this post. I’ve found my self thinking about this regularly in recent weeks, prompted by two observations.

<rant>

    • I’m constantly required to slow down on motorways for apparently non-existent hazards. I don’t mind slowing down when it is obvious that traffic is building up or when there is likely to be congestion, but I’m increasingly finding that Matrix signs display a temporary speed limit for no apparent reason.

Signs in operation for the M62 motorway 4th lane between junctions 27 and 28

I slow down, everybody else slows down. We drive for a few miles and then all speed up again. As well as increasing wear and tear on cars, increasing pollution and frustrating drivers, this has implications for safety. The more often this happens, the less notice drivers tend to take of the warnings, increasing the chance that when something actually happens and the signs are needed, people will ignore the warnings.

  • The Met Office continually announces “yellow weather warnings” which fail to materialise. Over the last 2 weeks, the North of England must have had at least 3 or 4 warnings of hazardous conditions. These continually fail to materialise.
    This is the dire warning on my phone one days last week, next to the distinctly “frost free” view from my bedroom window.

    The weather reality consistently fails to be as bad as the forecast. Although this is more of a frustration, than a hazard, unlike my first observation. It still annoys me.

    </rant>

Lost Jenkins admin password !!! – work around / fix

Yesterday I created an instance of Jenkins on Docker so that I could package up all the pre-requisites for the HPE Automation Tools plugin. I need to do this periodically due to the fact that my Jenkins instance at work isn’t connected to the internet and I occasionally need to download new and updated plugins.

I built Jenkins yesterday and presumably used one of my “disposable” passwords for the admin account in this Jenkins instance. I tried “password”, “admin”, “password1” and a few others but I couldn’t remember the password that I set only yesterday !

I decided that I needed to “hack” Jenkins. This was easier said than done because although I found the location for the password in the config files, the password is hashed out (unsurprisingly).

\jenkins\var\jenkins_home\users\admin\config.xml


Rather than remove the password entirely and risk breaking Jenkins, I had a mooch about in some other config files.

\jenkins\var\jenkins_home\config.xml

By changing the <useSecurity> flag to false and restarting Jenkins,I can avoid the password prompt altogether.  

Killing a stalled process and leaving others running using PowerShell

Since I wrote my post “Using Loadrunner / Performance Center to kill a rogue process“, some colleagues have asked if I could kill a stalled process and leave others up and running. After some “Googling”, I have found that this is possible.

I modified some PowerShell scripts that I found online so that they do what we want. If you paste the code below into a PowerShell script called for example “KillStalledProcesses.ps1”, it will scan through all the processes on a machine and “kill” any that are not responding.

I’ve tested it using SysInternals “Process Explorer” which allows you to “suspend” a running process like in the image below. I suspended the “notepad.exe” process and tested the PowerShell code.

The code correctly identified the suspended process and “killed” it.

(When I tested this with two other running “notepad” processes, it left the two other processes running.)

My thoughts are that we could add the PowerShell script into the “Extra Files” portion of a LoadRunner or Performance Center script and call it on error using the system (command); function described in the initial blog post. This would kill for example a rogue Citrix or SAPGUI client and leave others running during a performance test.

 


[CmdletBinding()]     

( [string[]]$ComputerName = $env:ComputerName)           

($Computer in $ComputerName)

if(!(Test-Connection -ComputerName $Computer -Count 1 -quiet))

Write-Host "$Computer : OFFLINE"           

Continue           

try {

$Processes = Get-Process -ComputerName $Computer -EA Stop

$nProcesses = @($Processes | ? { $_.Responding -eq $false })

catch {

Write-Error "Failed to query processes. $_"

if($nProcesses)

foreach($nProcess in $nProcesses)

$nProcess | select Name, id, MainWindowTitle, Responding

Write-host "Attempting to kill stalled process"

if ($nProcess.Id -ne $PID)

Stop-Process $nProcess.Id}

else

Write-host "No non-responding processes found"