#!/bin/sh
##################################################################
#		M A C H _ C H E C K
#		-------------------
# Description:
#	Check for duplicate machines in the database. Duplicates
#	can accidently be created when for instance a machine
#	is renamed. Since the host name is the key, there can
#	be two host names for the same machine. This script uses
#	hostid instead of hostname to identify a machine.
#
# Created By:
#	Lars Olsson
#
##################################################################

doubles=`machines -show host_id | awk '{ print $2 }' | grep "^[0-9]" | sort | uniq -d`
 
for i in $doubles ; do
        echo "##### dubletter (samma hostid) #####"
        machines -host_id $i -show ping_day
done

doubles=`machines -show ether | awk '{ print $2 }' | grep "^[0-9]" | sort | uniq -d`
 
for i in $doubles ; do
        echo "##### dubletter (samma ether) #####"
        machines -ether $i -show ping_day
done

doubles=`machines -show ip | awk '{ print $2 }' | grep "^[0-9]" | sort | uniq -d`
 
for i in $doubles ; do
        echo "##### dubletter (samma ip) #####"
        machines -ip $i -show ping_day
done
exit 0

#
# History of changes:
# mach_check,v
# Revision 1.1  1997/01/09 20:26:47  lasse
# Created by Lars Olsson, i just added header and footer.
#
#
