mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-11-22 02:13:44 +01:00
misc plugins dir added
This commit is contained in:
parent
17c8163238
commit
ad8d8ecb7c
28
misc/check_ports
Executable file
28
misc/check_ports
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
IPS=`fping -a -g $1 2>/dev/nul`
|
||||
if [ $? -gt 2 ]; then
|
||||
echo failed to run fping
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
#addgroup --group misc --alias "Misc hosts"
|
||||
|
||||
for ip in $IPS; do
|
||||
# Check if this host already exists
|
||||
grep -qw $ip /var/log/nagios/objects.cache
|
||||
if [ $? -eq 0 ]; then
|
||||
continue
|
||||
fi
|
||||
RES=`host $ip`
|
||||
if [ $? -gt 0 ]; then
|
||||
HOSTN=$ip
|
||||
else
|
||||
HOSTN=`echo $RES | head -n 1 | sed 's/.*name pointer //'`
|
||||
fi
|
||||
echo $ip = $HOSTN
|
||||
addhost --host $HOSTN --ip $ip --group misc
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user