$wc = New-Object System.Net.WebClient
#$wc.Credentials = New-Object System.Net.NetworkCredential 'Nagios\nagiosadmin','1dsb3wmrDJ'

#Convert.ToBase64String(
#    Encoding.ASCII.GetBytes(userName + ":" + password));
#client.Headers[HttpRequestHeader.Authorization] = string.Format(
#    "Basic {0}", credentials);

$credentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes('nagiosadmin:1dsb3wmrDJ'))

$wc.Headers['Authorization'] = ("Basic {0}" -f $credentials)


$data = $wc.DownloadString('http://sysops-prod.east-west.dk/nagios/cgi-bin/status.cgi?host=Equipment')


$lines = $data.Split("`r`n")

$select = $lines | Select-String -Pattern 'OK - (.*?) \(([0-9]+)\) - ([0-9]+) minutes since last transaction'

$result = $select | Select-Object @{ n='RVM'; e={ $_.Matches[0].Groups[1].Value }}, @{ n='ID'; e={ $_.Matches[0].Groups[2].Value }}, @{ n='TimeSinceLast'; e={ [int]$_.Matches[0].Groups[3].Value }}

$exempt = @"
ARR_Ak_RVM_101
ARR_Bg_RVM_101
ARR_Brr_RVM_101
ARR_Bs_RVM_101
ARR_Bu_RVM_101
ARR_Ev_RVM_101
ARR_Gu_RVM_101
ARR_GÃ¥_RVM_101
ARR_He_RVM_101
ARR_Hm_RVM_101
ARR_Hrm_RVM_101
ARR_HÃ¦_RVM_101
ARR_Is_RVM_101
ARR_La_RVM_101
ARR_Ln_RVM_101
ARR_No_RVM_101
ARR_Sej_RVM_101 
ARR_Stu_RVM_101
ARR_Tm_RVM_101
ARR_Ul_RVM_101
ARR_Um_RVM_101
ARR_Up_RVM_101 
ARR_Vem_RVM_101 
ARR_Vis_RVM_101 
ARR_Yd_RVM_101
DSB_Bd_RVM_101
DSB_Frs_RVM_101
DSB_Gd_RVM_101
DSB_Hp_RVM_101
DSB_HÃ¸s_RVM_101
DSB_Ka_RVM_101
DSB_Kv_RVM_101
DSB_Kvs_RVM_101
DSB_Kw_RVM_101
DSB_Lpt_RVM_101
DSB_Lt_RVM_101
DSB_Lv_RVM_101
DSB_Pds_RVM_101
DSB_Rus_RVM_101
DSB_Sc_RVM_101
DSB_Sis_RVM_101
DSB_Sts_RVM_101
DSB_To_RVM_101
DSB_Tu_RVM_101
RVM_Test1
"@.Split("`r`n")

$output = $result | where { ($_.TimeSinceLast -gt 1440 -and $exempt -notcontains $_.RVM) -or ($_.TimeSinceLast -gt 20140 -and $exempt -contains $_.RVM) }

$output | Out-GridView