Rexxer

Some tips for me and other

Zabbix + certificates monitoring

There is the fine script and template for certificates monitoring. Just create the script, import the template and link it to the host. Monitoring SSL Certificates with Zabbix #! /bin/sh SERVER=$1 TIMEOUT=25 RETVAL=0 TIMESTAMP=`echo | date` if [ -z “$2” ] then PORT=443; else PORT=$2; fi EXPIRE_DATE=`echo | openssl s_client -connect $SERVER:$PORT 2>/dev/null | openssl […]

Pfsense + Zabbix + Temperature monitoring via com-port

pw usermod zabbix -G uucp Services: Zabbix Agent 4.2: Agent: Advanced: User Parameters: UserParameter=temperature, /root/digitemp_DS9097 -c /root/.digitemprc -q -t 0 | awk ‘{if ($7 == “85.00”) print “36”; else print $7}’ | bc Add a new item to a host as Numeric (float), a graph and a trigger.

ActiveMQ + Docker + network ports conflict

We got some errors like: When ActiveMQ started from the Docker container “Error starting userland proxy: Bind for 0.0.0.0:1883: unexpected Error response from daemon: failed to create endpoint SpinWay on network nat: hnsCall failed in Win32: The process cannot access the file because it is being used by another process. (0x20). Solution: netsh int ipv4 […]

PFSense + ssh copy + keep authorized_keys after reboot

If you copy keys with: cat id_rsa.pub >> ~/.ssh/authorized_keys they will disappear after reboot. You have to add a key via Web GUI: System – Users – Edit user admin – add authorized keys from id_rsa.pub from your PC below.  

Powershell + string to array

An array is created with the -split operator. Like so, $myString=”Four score and seven years ago” $arr = $myString -split ‘ ‘ $arr # Print output Four score and seven years ago When you need a certain item, use array index to reach it. Mind that index starts from zero. Like so, $arr[2] # 3rd […]

Group policy + Account lockout audit

Found out the strange thing: my script for locked out accounts stopped working after 21 November 2018. I checked eventlog and didn’t see any 4740 events. After investigation I resolved it. It must be turned on there: Computer configuration/Policies/Windows Settings/Security settings/Advanced Audit Policy Configuration/Logon/Logoff/Audit Account Lockout Then I checked it: Auditpol /get /category:*

MDT + Script for joining to a domain

$strUser = “domain\user” $strDomain = “domain.local” $strPassword = ConvertTo-SecureString “password” -AsPlainText -Force $Credentials = New-Object System.Management.Automation.PsCredential $strUser, $strPassword $strOU = “OU=Computers,DC=domainn,DC=local” Add-computer -DomainName $strDomain -Credential $Credentials -OUPath $strOU

MDT + Script for renaming a PC according to his IP

powershell.exe -noprofile -command “Set-ExecutionPolicy Bypass LocalMachine” -force $strPrefix=”WS” # Get IP and make the name $IP=(Get-WmiObject win32_networkadapterconfiguration | Select-Object -Property @{name=’IPAddress’;Expression={($_.IPAddress[0])}} | Where IPAddress -NE $null).IPAddress $a,$b,$c,$d = $IP.split(‘.’) $strComputerName=$strPrefix+$c+”-“+$d # Rename $computer=gwmi Win32_computersystem $computer.rename($strComputerName)

Get text before dot

s=”4.56″ $ echo “${s%%.*}” 4

Exchange 2010 + Re-index DB

Issue: Users can’t find some e-mails with searching The Internet suggest several ways to resolve the issue like: Update-MailboxDatabaseCopy –Identity ‘DB2’ –CatalogOnly or 1. stop the Exchange Search Indexer and Search service 2. go to the location of the mailbox database. 3. there should be a folder called catalog{GUID}. Delete the folder 4. Restart the […]

Previous Posts