1. DiCE Install
Whenever the global IP changes, which happens when the network is disconnected or the router is disconnected and rebooted, the dynamic DNS must be accessed to inform the user that the global IP has changed. DiCE does this automatically!
1. 1 Download and install Dice
①Download
# wget https://centos.rcg.jp/download/DiCE.tar.gz (--no-check-certificate)
# tar -xzvf DiCE.tar.gz
#cd /usr/local/bin/DiCE
②DiCE Settings
DiCE output characters are EUC and therefore garbled.
Install nkf to convert to UTF-8
#To run 32-bit software Dice on 64-bit OS
③Start DiCE
# ./diced | nkf -uw
1. 2 Add Event
This time, the DNS service is VALUEDOMAIN
There is no English version of DiCE, so it is written in Japanese
: add
DynamicDNSサービス名を入力してください
"?"で対応しているサービスを一覧表示します
(P)戻る
>VALUEDOMAIN
ドメイン名を入力してください
"?"でドメイン一覧を表示します
(P)戻る
><ドメイン名>
ホスト名を入力してください
(P)戻る
><ホスト名>
ログインユーザ名を入力してください
(P)戻る
><ユーザー名> ←VALUEDOMAINに登録したユーザー名
ログインパスワードを入力してください
(P)戻る
><passwd> ←VALUEDOMAINにログインするパスワード
登録するIPアドレスを入力してください
空白にすると現在のIPアドレスを自動検出します
(P)戻る
>空白
このイベントに題名を付けてください
(P)戻る
>xxxxxxxxx(適当に付ける)
実行する頻度を指定してください (番号入力)
(0)1回のみ (1)1日1回 (2)1週間に1回 (3)1ヵ月に1回
(4)その他の周期 (5)IPアドレス変化時 (6)起動時
(P)戻る
>5
IPアドレスがあまり変化しない環境の場合、更新せずに一定期間を過ぎると
アカウントを削除されてしまうことがあります
IPアドレスの変化が無い時に実行する間隔を指定してください
(0)7日毎 (1)14日毎 (2)21日毎 (3)28日毎
(4)35日毎 (5)56日毎 (6)84日毎
(P)戻る
>0(任意に決める)
このイベントを有効にしますか? (Y/N)
(イベントの有効/無効は"EN/DIS"コマンドで切替えられます)
>y
イベントを保存しますか? (Y/N)
>y
1. 3 Event Confirmation
(No.) (イベント名) (スケジュール) (次回予定)
0 * xxxxxxxxx IPアドレス変化時 (7日毎) 07/29 06:27ー
手動実行
:ex 0
+ 7/22 6:33 にddns_valuedomainが実行されました
IPアドレスを更新しました
1. 4 Automatic execution of Dice
Start the DiCE daemon
=-=-=- DiCE DynamicDNS Client -=-=-=
Version 0.19 for Japanese
Copyright(c) 2001 sarad# DiCE Daemon Started !!
Check if it is activated
root 2207 2.7 0.0 7712 124 ? Ss 22:32 0:01 /usr/local/bin/DiCE/diced -d -l
Set to start automatically
/usr/local/bin/DiCE/diced -d -l ←add
Become systemd and write a script to register the program you want to run at startup as a service.
In the case of Ubuntu, if you write /etc/rc.local as root and set up the execution bit, it will be automatically executed by a service called rc-local.
Create New
# vi /etc/rc.local
#!/bin/sh
/usr/sbin/ethtool -s eno1 wol g
※ eno1is the name of their network interface (check with # ip addr)
# chmod 700 /etc/rc.local
2. Introduce disk usage check script
2.1 Create Script
# vi disk_capacity_check.sh
#!/bin/bash
#Designation of e-mail address to be notified
MAIL="<your mailaddress> "
DVAL=`/bin/df / | /usr/bin/tail -1 | /bin/sed 's/^.* \([0-9]*\)%.*$/\1/'`
if [ $DVAL -gt 80 ]; then
echo "Disk usage alert: $DVAL %" | mail -s "Disk Space Alert in `hostname`" $MAIL
fi
2.2 Execution check
①Check current utilization
The following appears
tmpfs 390M 1.6M 388M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 9.8G 4.9G 4.4G 53% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/sda2 1.8G 125M 1.5G 8% /boot
tmpfs 390M 4.0K 390M 1% /run/user/1000
②Create a dummy file (in the example, it is called "dummyfile" and is about 4G) so that the utilization is 80% or more.
# dd if=/dev/zero of=dummyfile bs=1M count=4000
③Reaffirmation
Run it and make sure it is above 80%.
④Run disk space check script
You will receive an e-mail to the e-mail address you have set up with the body of the message as "Disk usage alert : 95%".
⑤Delete the "dummyfile" you created.
⑥Periodic Execution Setting
30 2 * * * /opt/script/disk_capacity_check.sh
3. Log analysis tool logwatch installed
3.1 Install
3.2 Edit logwatch configuration file
①Copy the default configuration file
②Change the destination of your email, etc.
# Line 52
MailTo =<your mailaddress> # < = Mailing address
# Line 84
Detail = High
3.3 Creating Directories
There is no directory used by the cache, so create one.
3.4 operation check
When logwatch is installed, cron is registered by default, so daily report emails are sent
If you want to check it immediately, do the following