wiki.getshifting.com

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


start

SHIFT-WIKI - Sjoerd Hooft's InFormation Technology

This WIKI is my personal documentation blog. Please enjoy it and feel free to reach out through blue sky if you have a question, remark, improvement or observation. See below for the latest additions, or use the search or tags to browse for content.


Script: Find Ports in Use on Solaris

Summary: How to find the process which listens on a port.
Date: 2004
Refactor: 6 April 2025: Checked links and formatting.

Run the script below to find the process which listens on a port.

→ Read more...

2025/06/01 11:59

PowerShell: Create an Excel report with Server Status and Compliancy

Summary: This script is what I use to make one large inventory of all or VMs and physical objects in Active Directory. It creates a nice view in Excel on topics that are important. It allows for vCenter and Active Directory to document itself using the notes and description fields. Please notice so that if an object lives in both vCenter and Active Directory the virtual objects takes precedence.
Date: Around 2014
Refactor: 6 April 2025: Checked links and formatting.

Note> To make an extra report on a new property follow these steps:

  • Add the property and configure it correctly to the VMstatus and PSstatus functions
  • In the function ExcelAddRawData add the new property twice
  • In the function excelfile add the report number and name three times

→ Read more...

2025/06/01 11:59

Bash: Run a Report on Syslog Messages

Summary: How to receive all messages from a syslog server from the last week using a script.
Date: Around 2022
Refactor: 6 April 2025: Checked links and formatting.

I've setup my management server as my syslog server as well. All servers sent their warning messages or higher to this server and I've created this script so I receive all unique messages from the last week, on Monday morning in my email to be included in my weekly check.

#!/bin/bash
# This report show all entries in /var/log/messages for the last week,
#    makes them unique and counts the number of messages.
# Then it will mail the report to whoever needs it.
 
# Script Variables
HOSTNAME_SHORT=`hostname -s`
BASEDIR=`dirname $0`
WHATAMI=`basename $0`
DATE=`date +%Y%m%d`
LASTWEEK=`date --d='last Week' +%V`
TOMAIL=sjoerd @ getshifting.com,it department @ getshifting.com
REPORT=/tmp/$WHATAMI.txt
 
# /var/log/messages logfile due to rotation
LASTSUNDAY=`date --d='last Sunday' +%Y%m%d`
LOGFILE=/var/log/messages-$LASTSUNDAY
 
# Start of Script
 
# Clear logfile and make things look nice
echo "This is the messages report log" > $REPORT
echo "Server: $HOSTNAME_SHORT" >> $REPORT
echo "Week number: $LASTWEEK" >> $REPORT
echo " " >> $REPORT
echo "Report messages": >> $REPORT
 
# Get all messages from logfile, sqeeze spaces,
#    remove the date columns and sort and count the logentries
cat $LOGFILE | tr -s ' ' | cut -d' ' --complement -f1-3 | sort | uniq -c >> $REPORT
 
# Mail report
echo "See attachment" | mailx -s "Weekly syslog messages Red Hat Environment" -a $REPORT $TOMAIL
 
# End of Script
exit 0

Then schedule it in cron like this:

# Run messages report every monday at 06:00
0 6 * * 1 root /adminscripts/logmessagesreport
2025/06/01 11:59

HTML: Redirect

Summary: Create a redirect with HTML
Date: Around 2010
Refactor: 4 January 2025: Checked links and formatting.

→ Read more...

2025/06/01 11:59

<< Newer entries | Older entries >>

This wiki has been made possible by:

start.txt · Last modified: by sjoerd