DEVD
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
CONTENTS
#contents
----
Lastmodified &lastmod;
----
*pingが通らなくなると、自動的に再起動するスクリプト [#vcc...
#!/bin/sh
TARGET_IP="219.117.246.193"
STR_LOST="100.0% packet loss"
while [ 1 ]
do
PING_RESULT=`/sbin/ping -c 3 $TARGET_IP|grep "packet los...
if [ "$PING_RESULT" = "$STR_LOST" ]; then
echo "*** em0 connect lost ***"
date >>/var/log/ping_reboot.log
date|mail -s ping_reboot root
/sbin/reboot
else
echo "*** em connect ok ***"
fi
sleep 30
done
exit 0
【参考URL】http://www2k.biglobe.ne.jp/~motoi/ocn/ocn.cgi
/root/bin/ping_reboot.sh
#!/bin/sh
TARGET_IP="219.117.246.193"
#TARGET_IP="219.117.246.204"
STR_LOST="100.0% packet loss"
while [ 1 ]
do
if [ -e /var/run/watchdogd.pid ]; then
PING_RESULT=`/bin/ping -c 3 $TARGET_IP|grep "packet l...
else
PING_RESULT=$STR_LOST
fi
if [ "$PING_RESULT" = "$STR_LOST" ]; then
echo "*** em0 connect lost ***"
if [ -e /var/run/watchdogd.pid ]; then
kill -KILL `cat /var/run/watchdogd.pid`
rm -f /var/run/watchdogd.pid
sleep 2
fi
date >>/var/log/ping_reboot.log
date|mail -s ping_reboot root
/sbin/reboot
fi
sleep 30
echo "*** em connect ok ***"
done
exit 0
/etc/crontab
@reboot root /root/bin/check.sh && /root/bin/ping_reboot...
----
https://wiki.rookie-inc.com/os/freebsd/tips
*NICの watchdog timeout [#i6c0973e]
大量のトラフィックを流すとこんな感じでネットワークが死ぬ...
msk0: watchdog timeout
msk0: link state changed to DOWN
msk0: link state changed to UP
msk0: watchdog timeout (missed Tx interrupts) -- recover...
この例ではMarvellですがre0(realtek:蟹)とかIntelでも発生し...
googleでお伺いを立ててみましたが、どうもずいぶん前から有...
で、どうも根深すぎてFixもお手上げのような雰囲気なのが…orz
で、対症療法ですが、以下の設定でとりあえずは抑えられます。
# cat /boot/loader.conf
hw.msk.msi_disable="1"
FreeBSD10でもHP G6 の内蔵 NIC等、同様のケースがあるようです
bge0: watchdog timeout -- resetting
bge0: link state changed to DOWN
bge0: link state changed to UP
# cat /boot/loader.conf
hw.bge.allow_asf="0"
----
https://forums.freebsd.org/threads/looking-for-a-network-...
シェルスクリプト /root/bin/pingorrestart.sh:
Bash:
#!/bin/sh
RIP=`tail -15 /var/db/dhclient.leases.em0 | sed -n '/ o...
ping -c1 -t1 $RIP > /dev/null 2>&1
if [ "$?" != "0" ] ; then
/etc/rc.d/netif restart em0 > /dev/null 2>&1
fi
cronジョブディレクティブ:
コード:
#
# ping the router every 5 minutes and restart the networ...
*/5 * * * * root /root/bi...
*em0 down [#o4b874f4]
SUN1
https://forum.opnsense.org/index.php?PHPSESSID=o4l684klod...
https://forum.opnsense.org/index.php?topic=7601.0
EMシリーズNICのパフォーマンスと安定性を向上させるために、...
/boot/loader.conf.local内(まだ存在しない場合は、このファ...
hw.em.num_queues=0
hw.em.txd="2048"
hw.em.rxd="2048"
net.link.ifqmaxlen="4096"
hw.em.enable_msix=1
hw.pci.enable_msix=1
dev.em.0.fc=0
dev.em.1.fc=0
hw.em.rx_process_limit="-1"
hw.em.tx_process_limit="-1"
----
https://www.google.co.jp/#lr=lang_ja&tbs=lr:lang_1ja&q=Fr...
http://matsup.blogspot.jp/2012/12/freebsd-90-ipfw-natd-em...
http://www.bsddiary.net/d/20100324.html
*DEVD [#j15b0458]
NEC Express5800/GT110b
**オンボードNIC em0 が高負荷で落ちるので、これを監視して...
FreeBSD 10.2-Rから 11.0-CURRENTへ変更したけど、やっぱり落...
http://www.yosbits.com/opensonar/rest/man/freebsd/man/ja/...
http://www.on-sky.net/~hs/misc/?Raspberry+Pi+HA+Server+wi...
http://www.yosbits.com/opensonar/rest/man/freebsd/man/ja/...
devdはシステムに初めから入っているので、
/etc/rc.conf
devd_enable="YES"
として起動するように設定。
**監視対象とアクションを設定。 [#w2f0b681]
/etc/devd/em0.conf
#system=IFNET, subsystem=fxp0, type=LINK_UP
notify 0 {
match "system" "IFNET";
match "subsystem" "em0";
match "type" "LINK_DOWN";
action "/root/bin/reboot.sh";
};
/root/bin/reboot.sh
#!/bin/sh
tail -100 /var/log/all.log | mail -s "System was Reboote...
&& /sbin/reboot
リブート用のスクリプトを書いておく。改行コードがLFでない...
読み込むかどうかテスト
root@blackhole:~ # devd -d
Parsing /etc/devd.conf
setting scsi-controller-regex=(aac|adv|adw|aha|ahb|ahc|a...
setting wifi-driver-regex=(ath|bwi|bwn|ipw|iwi|iwm|iwn|m...
Parsing files in /etc/devd
Parsing /etc/devd/em0.conf
Parsing files in /usr/local/etc/devd
devd: Can't open devctl device /dev/devctl: Device busy
起動中のdevdの順番は出来るだけ遅い方がよさげ(NICがLink_UP...
/etc/rc.d/devd
# REQUIRE: netif ldconfig ntpd
を追加して
#!/bin/sh
#
# $FreeBSD: head/etc/rc.d/devd 282145 2015-04-28 13:13:2...
#
# PROVIDE: devd
# REQUIRE: netif ldconfig ntpd ←これ 追加したntpd
# BEFORE: NETWORKING mountcritremote
# KEYWORD: nojail shutdown
: :
としてみる。
で、em0がリンクダウンすると、こんなメールがやってくる・・・
To: root@localhost.smb.net
Subject: System was Rebooted
Message-Id: <20151014012601.DFD9614A63AE@blackhole.smb.n...
Date: Wed, 14 Oct 2015 10:26:01 +0900 (JST)
From: root@blackhole.smb.net (Charlie Root)
Oct 14 10:22:00 blackhole /usr/sbin/cron[63419]: (operat...
Oct 14 10:25:00 blackhole /usr/sbin/cron[63432]: (root) ...
Oct 14 10:25:00 blackhole /usr/sbin/cron[63433]: (munin)...
Oct 14 10:26:01 blackhole kernel: em0: Watchdog timeout ...
Oct 14 10:26:01 blackhole kernel: Interface is RUNNING a...
Oct 14 10:26:01 blackhole kernel: em0: TX Queue 0 ------
Oct 14 10:26:01 blackhole kernel: em0: hw tdh = 795, hw ...
Oct 14 10:26:01 blackhole kernel: em0: Tx Queue Status =...
Oct 14 10:26:01 blackhole kernel: em0: TX descriptors av...
Oct 14 10:26:01 blackhole kernel: em0: Tx Descriptors av...
Oct 14 10:26:01 blackhole kernel: em0: RX Queue 0 ------
Oct 14 10:26:01 blackhole kernel: em0: hw rdh = 680, hw ...
Oct 14 10:26:01 blackhole kernel: em0: RX discarded pack...
Oct 14 10:26:01 blackhole kernel: em0: RX Next to Check ...
Oct 14 10:26:01 blackhole kernel: em0: RX Next to Refres...
Oct 14 10:26:01 blackhole kernel: em0: link state change...
----
Total access &counter(total);:本日 &counter(today);:昨...
#counter([total|today|yesterday]);
終了行:
CONTENTS
#contents
----
Lastmodified &lastmod;
----
*pingが通らなくなると、自動的に再起動するスクリプト [#vcc...
#!/bin/sh
TARGET_IP="219.117.246.193"
STR_LOST="100.0% packet loss"
while [ 1 ]
do
PING_RESULT=`/sbin/ping -c 3 $TARGET_IP|grep "packet los...
if [ "$PING_RESULT" = "$STR_LOST" ]; then
echo "*** em0 connect lost ***"
date >>/var/log/ping_reboot.log
date|mail -s ping_reboot root
/sbin/reboot
else
echo "*** em connect ok ***"
fi
sleep 30
done
exit 0
【参考URL】http://www2k.biglobe.ne.jp/~motoi/ocn/ocn.cgi
/root/bin/ping_reboot.sh
#!/bin/sh
TARGET_IP="219.117.246.193"
#TARGET_IP="219.117.246.204"
STR_LOST="100.0% packet loss"
while [ 1 ]
do
if [ -e /var/run/watchdogd.pid ]; then
PING_RESULT=`/bin/ping -c 3 $TARGET_IP|grep "packet l...
else
PING_RESULT=$STR_LOST
fi
if [ "$PING_RESULT" = "$STR_LOST" ]; then
echo "*** em0 connect lost ***"
if [ -e /var/run/watchdogd.pid ]; then
kill -KILL `cat /var/run/watchdogd.pid`
rm -f /var/run/watchdogd.pid
sleep 2
fi
date >>/var/log/ping_reboot.log
date|mail -s ping_reboot root
/sbin/reboot
fi
sleep 30
echo "*** em connect ok ***"
done
exit 0
/etc/crontab
@reboot root /root/bin/check.sh && /root/bin/ping_reboot...
----
https://wiki.rookie-inc.com/os/freebsd/tips
*NICの watchdog timeout [#i6c0973e]
大量のトラフィックを流すとこんな感じでネットワークが死ぬ...
msk0: watchdog timeout
msk0: link state changed to DOWN
msk0: link state changed to UP
msk0: watchdog timeout (missed Tx interrupts) -- recover...
この例ではMarvellですがre0(realtek:蟹)とかIntelでも発生し...
googleでお伺いを立ててみましたが、どうもずいぶん前から有...
で、どうも根深すぎてFixもお手上げのような雰囲気なのが…orz
で、対症療法ですが、以下の設定でとりあえずは抑えられます。
# cat /boot/loader.conf
hw.msk.msi_disable="1"
FreeBSD10でもHP G6 の内蔵 NIC等、同様のケースがあるようです
bge0: watchdog timeout -- resetting
bge0: link state changed to DOWN
bge0: link state changed to UP
# cat /boot/loader.conf
hw.bge.allow_asf="0"
----
https://forums.freebsd.org/threads/looking-for-a-network-...
シェルスクリプト /root/bin/pingorrestart.sh:
Bash:
#!/bin/sh
RIP=`tail -15 /var/db/dhclient.leases.em0 | sed -n '/ o...
ping -c1 -t1 $RIP > /dev/null 2>&1
if [ "$?" != "0" ] ; then
/etc/rc.d/netif restart em0 > /dev/null 2>&1
fi
cronジョブディレクティブ:
コード:
#
# ping the router every 5 minutes and restart the networ...
*/5 * * * * root /root/bi...
*em0 down [#o4b874f4]
SUN1
https://forum.opnsense.org/index.php?PHPSESSID=o4l684klod...
https://forum.opnsense.org/index.php?topic=7601.0
EMシリーズNICのパフォーマンスと安定性を向上させるために、...
/boot/loader.conf.local内(まだ存在しない場合は、このファ...
hw.em.num_queues=0
hw.em.txd="2048"
hw.em.rxd="2048"
net.link.ifqmaxlen="4096"
hw.em.enable_msix=1
hw.pci.enable_msix=1
dev.em.0.fc=0
dev.em.1.fc=0
hw.em.rx_process_limit="-1"
hw.em.tx_process_limit="-1"
----
https://www.google.co.jp/#lr=lang_ja&tbs=lr:lang_1ja&q=Fr...
http://matsup.blogspot.jp/2012/12/freebsd-90-ipfw-natd-em...
http://www.bsddiary.net/d/20100324.html
*DEVD [#j15b0458]
NEC Express5800/GT110b
**オンボードNIC em0 が高負荷で落ちるので、これを監視して...
FreeBSD 10.2-Rから 11.0-CURRENTへ変更したけど、やっぱり落...
http://www.yosbits.com/opensonar/rest/man/freebsd/man/ja/...
http://www.on-sky.net/~hs/misc/?Raspberry+Pi+HA+Server+wi...
http://www.yosbits.com/opensonar/rest/man/freebsd/man/ja/...
devdはシステムに初めから入っているので、
/etc/rc.conf
devd_enable="YES"
として起動するように設定。
**監視対象とアクションを設定。 [#w2f0b681]
/etc/devd/em0.conf
#system=IFNET, subsystem=fxp0, type=LINK_UP
notify 0 {
match "system" "IFNET";
match "subsystem" "em0";
match "type" "LINK_DOWN";
action "/root/bin/reboot.sh";
};
/root/bin/reboot.sh
#!/bin/sh
tail -100 /var/log/all.log | mail -s "System was Reboote...
&& /sbin/reboot
リブート用のスクリプトを書いておく。改行コードがLFでない...
読み込むかどうかテスト
root@blackhole:~ # devd -d
Parsing /etc/devd.conf
setting scsi-controller-regex=(aac|adv|adw|aha|ahb|ahc|a...
setting wifi-driver-regex=(ath|bwi|bwn|ipw|iwi|iwm|iwn|m...
Parsing files in /etc/devd
Parsing /etc/devd/em0.conf
Parsing files in /usr/local/etc/devd
devd: Can't open devctl device /dev/devctl: Device busy
起動中のdevdの順番は出来るだけ遅い方がよさげ(NICがLink_UP...
/etc/rc.d/devd
# REQUIRE: netif ldconfig ntpd
を追加して
#!/bin/sh
#
# $FreeBSD: head/etc/rc.d/devd 282145 2015-04-28 13:13:2...
#
# PROVIDE: devd
# REQUIRE: netif ldconfig ntpd ←これ 追加したntpd
# BEFORE: NETWORKING mountcritremote
# KEYWORD: nojail shutdown
: :
としてみる。
で、em0がリンクダウンすると、こんなメールがやってくる・・・
To: root@localhost.smb.net
Subject: System was Rebooted
Message-Id: <20151014012601.DFD9614A63AE@blackhole.smb.n...
Date: Wed, 14 Oct 2015 10:26:01 +0900 (JST)
From: root@blackhole.smb.net (Charlie Root)
Oct 14 10:22:00 blackhole /usr/sbin/cron[63419]: (operat...
Oct 14 10:25:00 blackhole /usr/sbin/cron[63432]: (root) ...
Oct 14 10:25:00 blackhole /usr/sbin/cron[63433]: (munin)...
Oct 14 10:26:01 blackhole kernel: em0: Watchdog timeout ...
Oct 14 10:26:01 blackhole kernel: Interface is RUNNING a...
Oct 14 10:26:01 blackhole kernel: em0: TX Queue 0 ------
Oct 14 10:26:01 blackhole kernel: em0: hw tdh = 795, hw ...
Oct 14 10:26:01 blackhole kernel: em0: Tx Queue Status =...
Oct 14 10:26:01 blackhole kernel: em0: TX descriptors av...
Oct 14 10:26:01 blackhole kernel: em0: Tx Descriptors av...
Oct 14 10:26:01 blackhole kernel: em0: RX Queue 0 ------
Oct 14 10:26:01 blackhole kernel: em0: hw rdh = 680, hw ...
Oct 14 10:26:01 blackhole kernel: em0: RX discarded pack...
Oct 14 10:26:01 blackhole kernel: em0: RX Next to Check ...
Oct 14 10:26:01 blackhole kernel: em0: RX Next to Refres...
Oct 14 10:26:01 blackhole kernel: em0: link state change...
----
Total access &counter(total);:本日 &counter(today);:昨...
#counter([total|today|yesterday]);
ページ名: