snmpwalk or snmpget同時取得多個ip的values - Linux

By Mia
at 2015-09-05T19:55
at 2015-09-05T19:55
Table of Contents
※ 引述《a0902jack (Panda)》之銘言:
: 請教一下各位大大們~~
: 因為最近需要使用到snmpwalk/snmpget,
: google了一下網路上的資料,
: 好像沒看到可以"同時"發送一個request到多台主機上。
: 有在思考透過變數和迴圈的方式有辦法達成以上需求嗎??
: thx.
另外拉出來回應,這邊舉個例子提供參考:
#!/bin/bash
rm -f faillog.txt
reset()
{
for pid in $(jobs -p); do
kill $pid
done
}
ping_test()
{
echo "Running for $1"
timeout 10 ping -c 3 "$1" > $2 2>&1
code=$?
if [ $code -eq 0 ]; then
echo "Running for $1 Done"
else
echo "Running for $1 Timeout"
echo "$1" >> faillog.txt
fi
}
true > faillog.txt
trap reset INT TERM
for hostname in google.com udn.com tw.yahoo.com www.facebook.com 1.1.1.1
do
ping_test $hostname result-$hostname.txt &
done
wait
--
: 請教一下各位大大們~~
: 因為最近需要使用到snmpwalk/snmpget,
: google了一下網路上的資料,
: 好像沒看到可以"同時"發送一個request到多台主機上。
: 有在思考透過變數和迴圈的方式有辦法達成以上需求嗎??
: thx.
另外拉出來回應,這邊舉個例子提供參考:
#!/bin/bash
rm -f faillog.txt
reset()
{
for pid in $(jobs -p); do
kill $pid
done
}
ping_test()
{
echo "Running for $1"
timeout 10 ping -c 3 "$1" > $2 2>&1
code=$?
if [ $code -eq 0 ]; then
echo "Running for $1 Done"
else
echo "Running for $1 Timeout"
echo "$1" >> faillog.txt
fi
}
true > faillog.txt
trap reset INT TERM
for hostname in google.com udn.com tw.yahoo.com www.facebook.com 1.1.1.1
do
ping_test $hostname result-$hostname.txt &
done
wait
--
Tags:
Linux
All Comments

By Erin
at 2015-09-09T05:03
at 2015-09-09T05:03
Related Posts
snmpwalk or snmpget同時取得多個ip的values

By Harry
at 2015-09-04T17:24
at 2015-09-04T17:24
新手問題 密碼設定

By Tristan Cohan
at 2015-09-04T17:11
at 2015-09-04T17:11
debian8 apache很慢

By Quanna
at 2015-09-04T12:50
at 2015-09-04T12:50
如何自動關機:

By Delia
at 2015-09-04T11:09
at 2015-09-04T11:09
NFS Server監看有哪些client mount上來?

By Charlotte
at 2015-09-03T23:57
at 2015-09-03T23:57