Kleines Expect-Script für alte Cisco Switches un err-disabled
Expect-Script
#!/usr/bin/expect
set host [lindex $argv 0]
spawn telnet $host
expect „Password:“
send „YourPassword\n“
log_file ./err-status-$host.log
send „term len 0\n“
send „show int status err-disabled\n“
expect „end\r“
send „\n“
send „exit\n“
log_file
Bash-Wrapper
cat check-state.sh
/usr/bin/expect ./check-state.expect 1.2.3.4
sleep 2
/usr/bin/expect ./check-state.expect 1.2.3.5
sleep 2
check_mk Powershell KV-Safenet Status eines Routers abfragen – KAMP-Safebox
#0=ok; 1=warn; 2=crit
$OK = 0
$Warning = 1
$Critical = 2
c:\skript\curl.exe -s -k https://your-safebox.address:8443/netaccess/connstatus.html > C:\Skript\kv-safenet-state.log
if (Select-String -Quiet -Path c:\skript\kv-safenet-state.log -Pattern „You are logged in.“) {
$status = $OK
$statustext = „OK“
$detail = „KV-Safenet Verbindnung OK“
}
else {
$status = $CRITICAL
$statustext = „CRITICAL“
$detail = „KV-Safenet Verbindnung CRITICAL“
}
Write-Host „$status KV-Safenet – $($statustext) – $detail“
check_mk local Bash Script Auswertung SQLPlus DB-FULL Logfiles
#!/bin/bash
#
# Skript Logfiles auszuwerten
# speziell RMAN DB FULL Status
#
# Bsp. Format zur Analyse generiert mit SQLPlus
# ===== 09.06.2017 11:23:56 =====
#
# START_TIME END_TIME STATUS INPUT_TYPE INPUT_BYTE OUTPUT_BYT RANG
# ——————– ——————– ——————– ———- ———- ———- ———-
# 08.06.2017 23:00:04 08.06.2017 23:39:09 COMPLETED DB FULL 75.75G 12.36G 1
# 07.06.2017 23:00:04 07.06.2017 23:45:23 COMPLETED DB FULL 75.12G 12.10G 2
# 06.06.2017 23:00:03 06.06.2017 23:46:06 COMPLETED DB FULL 74.57G 11.88G 3
#
# ===== 16.06.2017 10:16:38 =====
#
# START_TIME END_TIME STATUS INPUT_TYPE INPUT_BYTE OUTPUT_BYT RANG
# ——————– ——————– ——————– ———- ———- ———- ———-
# 15.06.2017 23:00:06 15.06.2017 23:42:01 COMPLETED DB FULL 76.19G 12.46G 1
# 14.06.2017 23:00:06 14.06.2017 23:40:42 COMPLETED DB FULL 75.83G 12.38G 2
# 13.06.2017 23:00:04 13.06.2017 23:42:13 COMPLETED DB FULL 75.15G 12.14G 3
#
# End Comments
#
files=./datastore/rman/check_rman*.log
for file in $files
do
service=`echo „$file“ | cut -d / -f4`
linecount=`cat $file | awk ‚/\=\=\=\=\=/ {if (count) print count; print; count=0; next} {count++} END {print count}‘ | tail -n1`
linecount_noheadline=$((linecount – 3))
lastoutput=`tail -n $linecount_noheadline $file | sed ‚1!G;h;$!d‘ | tail -n1`
enddate=`echo „$lastoutput“ | cut -d \ -f4`
state_raw=`echo „$lastoutput“ | cut -d \ -f7`
day=`echo „$enddate“ | cut -d \. -f1`
month=`echo „$enddate“ | cut -d \. -f2`
year=`echo „$enddate“ | cut -d \. -f3`
date_normalized=`date -d $year-$month-$day +’%Y%m%d’`
today=`date +’%Y%m%d’`
if [ $today = $date_normalized ]
then
if [ $state_raw = „COMPLETED“ ]
then
echo „0 DB-FULL-$service – OK DB-FULL hat den Status COMPLETED! OK“
elif [ $state_raw = „RUNNING“ ]
then
echo „1 DB-FULL-$service – WARN DB-FULL hat den Status RUNNING! WARN“
elif [ $state_raw = „FAILED“ ]
then
echo „2 DB-FULL-$service – CRIT DB-FULL hat den Status FAILED! CRIT“
fi
else
echo „2 DB-FULL-$service – CRIT DB-FULL Letzer Logeintrag zu alt! Logalter: $date_normalized State: $state_raw“
fi
done
Comet P8541 Temperatur Sensor check_mk Skript
def inventory_temp1(info):
inventory = []
for descr in info:
inventory.append ( ( None, None ) )
return inventory
def check_temp1(item, params, info):
temp1 = int(float(info[0][0]))
perfdata = [ ( „temp“, info[0][0], 24, 25 ) ]
if temp1 <= 25:
return (0, „OK Temperature is below 25 – Actual %d“ % temp1, perfdata)
else:
return (2, „CRITICAL Temperature is above 25 – Actual %d“ % temp1, perfdata)
check_info[„temp1“] = {
‚check_function‘ : check_temp1,
‚inventory_function‘ : inventory_temp1,
’service_description‘ : ‚Temperatur 1‘,
‚has_perfdata‘ : True,
„snmp_info“ : ( „.1.3.6.1.4.1.22626.1.5.2.1.2“, [„0“]),
}
Exchange verknüpfte Postfächer per Powershell anlegen
Allgemein
Ggf. ist der direkte Set-ADUser-Befehl problematisch, da der AD-Synch nicht so schnell ist. Diesen muss man ggf. wiederholfen.
Beispielliste liste01.csv
Vorname;Nachname;Login Max;Mustermann;mustermann Testvorname;Testnachname;test ... |
Skript
$vorname=Import-Csv -Delimiter ";" .\liste01.csv | select -ExpandProperty Vorname $nachname=Import-Csv -Delimiter ";" .\liste01.csv | select -ExpandProperty Nachname $login=Import-Csv -Delimiter ";" .\liste01.csv | select -ExpandProperty Login $cred=Get-Credential "FOREIGNDOMAIN\Administrator" Import-Module ActiveDirectory for ($i=0; $i -lt $vorname.length; $i++) { New-Mailbox -Database "Mailboxdatabase" -Name "PREFIX_$($nachname[$i]).$($vorname[$i])" -LinkedDomainController "FOREIGNDC" -LinkedMasterAccount DOMAIN\$($login[$i]) ` -OrganizationalUnit Benutzer_neu -UserPrincipalName PREFIX_$($nachname[$i]).$($vorname[$i])@domain.local -DisplayName "$($nachname[$i]), $($vorname[$i])" ` -LinkedCredential $cred Set-ADUser -Identity "EKG_$($nachname[$i]).$($vorname[$i])" -Company "FIRMA" -Surname $($nachname[$i]) -GivenName $($vorname[$i]) }
|
Skype for Business 2015 bzw. Lync 2013 Sekundärer Rufton funktioniert nicht
Abweichend von z.B.
http://communicationsknowledge.blogspot.de/2015/10/how-to-set-secondary-ringer-in-skype.html
klingelte mein sekundärer Rufton nicht.
Einstellungen in den Windows Sound (siehe Link oben) und Skype for Business waren korrekt.
Zum Testen habe ich dann mal das Headset einfach vom PC abgezogen, sodass nur noch der Hauptlautsprecher, der auch für den sekundären Klingelton zuständig sein soll, verfügbar war.
Trotzdem klingelte es nicht.
„Skype for Business 2015 bzw. Lync 2013 Sekundärer Rufton funktioniert nicht“ weiterlesen
Simple Powershell MegaRAID Logical Drive State Skript for cmk
Ein ganz einfaches Skript, um den State des Logical Drives mit MegaCLI und als local Check von CMK zu monitoren:
Simple Bash MegaRAID Logical Drive State Skript for cmk
Ein ganz einfaches Skript, um den State des Logical Drives mit MegaCLI und als local Check von CMK zu monitoren:
state=`/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -lALL -aALL | grep State | cut -d \ -f17` if [ $state = "Optimal" ] then echo "0 LDState - OK LogicalDrive Status OK" else echo "2 LDState - CRITICAL LogicalDrive Status CRIT" fi
Monitoring EMC Netwoker recycle Tapes
Dieses Skript ist für Windows Powershell.
Es ermittelt mit mminfo in Verbindung mit Location die recyclebaren Tapes.
Es sollte relativ leicht auf Unix portierbar sein.
$OK = 0 #$Warning = 1 $Critical = 2 $day = $(get-date -format dddd) if ($day -eq "Freitag") { $threshold = 20 } else { $threshold = 5 } $RecycleTapeCount = $(mminfo -q volrecycle -r volume -r location | findstr "ADIC" | Measure-Object | Select-Object -expand Count) if ($RecycleTapeCount -lt $threshold) { $status = $Critical $statustext = "CRITICAL" $detail = "Die Anzahl $RecycleTapeCount der recyclebaren Tapes im Wechsler ist zu niedrig" } else { $status = $OK $statustext = "OK" $detail = "Die Anzahl $RecycleTapeCount der recyclebaren Tapes im Wechsler ist in Ordnung" } Write-Host "$status RecycleTapeCount Tapes=$($RecycleTapeCount);5;4;0 $($statustext) - $detail"