SlideShare una empresa de Scribd logo
1 de 39
Descargar para leer sin conexión
【Linux】#7 SNMP cacti @秋葉原UDX
1
アジェンダ
0900~0905 今日出来るようになる事、自己紹介(チーム紹介)
システム構成説明
0905~0915 サーバへの疎通確認
0915~0930 snmp、cactiインストール
0930~0945 cacti初期設定
0945~1000 スイッチ設定
1000~1015 スイッチ→サーバ疎通確認
サーバ→スイッチ疎通確認
1015~1030 大量データダウンロード、グラフ表示
参加いただきありがとうございます!!!
鈴木メモ
持ち物:スイッチ×4、PC×4、LAN線×8、
シリアルケーブル×4
前提
今日、出来るようになる事
snmp、snmptrapの違いが判る
Linuxでsnmpサーバが構築できる
Ciscoスイッチにsnmp設定、snmptrap設定ができる
cactiでスイッチ流量をグラフ確認できる
本ラボは、他勉強会参加者からのリクエスト対応で構築しました
ご期待に応えられていたら幸いです
2
Server1
192.168.210.111
Server2
192.168.210.112
Server3
192.168.210.113
Server4
192.168.210.114
PC1
192.168.210.11
PC2
192.168.210.12
PC3
192.168.210.13
PC4
192.168.210.14
Switch1
vlan1 192.168.210.121
lo0 192.168.0.1
Switch2
vlan1 192.168.210.122
lo0 192.168.0.2
Switch3
vlan1 192.168.210.123
lo0 192.168.0.3
Switch4
vlan1 192.168.210.124
lo0 192.168.0.4
#1
#Gi0/1
#Gi0/2
#Gi0/1
#Gi0/2
#Gi0/1
#Gi0/2
#Gi0/1
#Gi0/2
【Linux】#7 SNMP cacti 物理構成図
snmp
5分毎(デフォルト)
にデータ収集
snmptrap
イベント発
生時に通知
Server = SNMPマネージャ
3
【Linux】#7 設計一覧
項目 設定値
snmpコミュニティ名(ポーリング用) Linux#7
snmpコミュニティ名(トラップ用) Linux#7Trap
snmpのバージョン SNMPv2c
cacti←→mariadbのユーザ cactiDBuser
cacti←→mariadbのパスワード cactiDBpass
cactiのwebログインユーザ admin(初期値のまま)
cactiのwebログインパスワード Linux#7cacti
1 2 3 4
PC 192.168.210.11 192.168.210.12 192.168.210.13 192.168.210.14
Switch Loopback0 192.168.0.1 192.168.0.2 192.168.0.3 192.168.0.4
Switch Vlan1 192.168.210.121 192.168.210.122 192.168.210.123 192.168.210.124
Server CentOS 192.168.210.111 192.168.210.112 192.168.210.113 192.168.210.114
4
今日の流れ
1.環境確認
2.cactiインストール
3.Ciscoスイッチ設定、試験
4.Cacti初期設定
5.cactiグラフ表示
これから実施
5
手順1 vmwareにアクセスする
>「Windowsキー+r」
>「https://192.168.210.100」
手順2 vmwareにログインする
>ユーザ名:root
>パスワード:P@ssw0rd
手順3 仮想マシンの名前を変更する
自分の仮想マシンを選択 → アクション
→名前の変更
「connpassIDの先頭4文字+
【study】+linux1234567」
に変更してください。
手順4 nmtuiを起動してIPアドレスを確認する
Linux上で、「nmtui」
とコマンドを打つと以下のような青い画面が表示
されます。
※tuiは矢印キーでしか動かせません
※再起動するたび<Activate>が必要です。
手順5 IPアドレスを変更する
>「Edit a Connection」
>「ensxx」を選択してEnter
>IPv4 CONFIGURATIONの下にあるAddressでIPアドレス確認
座席番号1の場合、サーバのIPアドレスを「192.168.210.111」
座席番号2の場合、サーバのIPアドレスを「192.168.210.112」
・・・
Gatewayのアドレスを
「192.168.210.254」
DNSのアドレスを
「8.8.8.8」
修正、変更する
【Linux】#7 環境確認(1)IPアドレス
6
手順6 ネットワークを有効にする
画面に戻ったら
>「Activate a Connection」
>「ensxx」を選んで<Activate>でEnter
>「*ensxx」になったことを確認したら<Back>でEnter
「nmtui」を終了して下さい
手順7 SELinuxの状態を確認する
出力結果が「Disabled」であるかを確認します
手順8 出力結果が「Enforcing」だった場合→viで設定ファイルを開き
ファイル中の「SELinux=enforcing」を「SELinux=disabled」に変更し、Linuxを再起動。
【Linux】#7 環境確認(2)SELinux
#getenforce
disabled
# vi /etc/sysconfig/selinux
# shutdown -r now
インターネット未接続環境でのdnf
 ソフトウェアのインストールにはCentOS8のパッケージ管理ソフトウェアである「dnf」を使用していきますが、デフォルトではインターネットからソフトウェアを取得す
ることになります。
 ここではインストールメディアからソフトウェアを取得する設定を行います。
 インストールメディアのISOイメージをCDROMドライブにセットしてあります。
7
手順9
[root@suzukto ~]# mkdir␣/media/CentOS
[root@suzukto ~]# mount␣–o␣ro␣/dev/cdrom␣/media/CentOS/
[root@suzukto ~]# alias␣dnf=‘dnf␣--disablerepo=¥*␣--enablerepo=c8-media-BaseOS,c8-media-AppStream’
手順10 確認
[root@suzukto ~]# df
ファイルシス 1K-ブロック 使用 使用可 使用% マウント位置
devtmpfs 905304 0 905304 0% /dev
tmpfs 934792 0 934792 0% /dev/shm
tmpfs 934792 9832 924960 2% /run
tmpfs 934792 0 934792 0% /sys/fs/cgroup
/dev/mapper/cl-root 13420544 4243772 9176772 32% /
/dev/sda2 999320 191708 738800 21% /boot
/dev/sda1 613184 6908 606276 2% /boot/efi
tmpfs 186956 1180 185776 1% /run/user/42
tmpfs 186956 4672 182284 3% /run/user/0
/dev/sr0 8037456 8037456 0 100% /media/CentOS
[root@suzukto ~]#
手順11 確認
[root@suzukto ~]# alias
alias cp='cp -i'
alias dnf=‘dnf --disablerepo=¥* --enablerepo=c8-media-BaseOS,c8-media-
AppStream’ ←確認
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
[root@suzukto ~]#
alias␣dnf=‘dnf␣--disablerepo=¥*␣--enablerepo=media-baseos,media-appstream'
設定ファイルは cat␣/etc/yum.repos.d/CentOS-Stream-Media.repo
8
手順12 Apache、PHP、OpenSSLがインストールされている事を確認して下さい
手順13 httpサービスを起動させ、Active:active(running)である事を確認して下さい
httpd、php、OpenSSLインストールする場合
3つインストールします
【Linux】#7 環境確認(3)Apache、PHP、OpenSSL確認
[root@suzukto ~]# httpd␣-v
Server version: Apache/2.4.37 (centos)
Server built: Jun 8 2020 20:14:33
[root@suzukto ~]# php␣-v
PHP 7.2.24 (cli) (built: Oct 22 2019 08:28:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologie
[root@suzukto ~]# rpm␣-aq␣|␣grep␣mod_ssl
mod_ssl-2.4.37-21.module_el8.2.0+382+15b0afa8.x86_64
[root@suzukto ~]# systemctl␣start␣httpd
[root@suzukto ~]# systemctl␣status␣httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled;
vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.dmqphp-fpm.conf
Active: active (running) since Wed 2020-12-30 06:09:30 JST; 18s
ago
[root@suzukto ~]# dnf␣-y␣install␣mod_ssl␣php␣httpd
modとsslの間はアンダーバー
9
手順14 mariadbのバージョン確認 mariadbのインストール
mariadbの初期設定 → xxページへ
【Linux】#7 環境確認(4)mariadb確認
[root@Linux7-CentStream ~]# mysql --version
mysql Ver 15.1 Distrib 10.3.27-MariaDB, for Linux (x86_64) using readline 5.1
# dnf␣install␣mariadb-server␣php-mysqlnd
10
今日の流れ
1.環境確認
2.cactiインストール
3.Ciscoスイッチ設定、試験
4.Cacti初期設定
5.cactiグラフ表示
これから実施
11
EPEL(いーぺる)【Extra Packages for Enterprise Linux】
公式パッケージには含まれない、Linux用ソフトウェアの集まり
手順15 EPELを利用出来るようにする
手順16 確認 「epel.repo」を確認
手順17 cactiのインストール
【Linux】#7 cactiのオンラインインストール(1)
[root@suzukito yum.repos.d]# dnf install https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/e/epel-release-8-10.el8.noarch.rpm
完了しました!
[root@suzukito yum.repos.d]#
[root@suzukito yum.repos.d]# ls /etc/yum.repos.d
CentOS-AppStream.repo CentOS-Devel.repo CentOS-PowerTools.repo CentOS-fasttrack.repo epel-testing.repo
CentOS-Base.repo CentOS-Extras.repo CentOS-Sources.repo epel-modular.repo epel.repo
CentOS-CR.repo CentOS-HA.repo CentOS-Vault.repo epel-playground.repo
CentOS-Debuginfo.repo CentOS-Media.repo CentOS-centosplus.repo epel-testing-modular.repo
[root@suzukito yum.repos.d]#
[root@suzukito yum.repos.d]#dnf --enablerepo=epel -y install cacti net-snmp net-snmp-utils php-snmp php-bcmath rrdtool
12
手順18 バージョンの確認 cacti、snmp、rrdtool
手順19 snmp設定
行数表示 set number
手順20 snmpd.conf 設定変更箇所
【Linux】#7 cactiのインストール(2)snmp設定
[root@suzukito yum.repos.d]# rpm -qa | grep cacti
cacti-1.2.16-1.el8.noarch
[root@suzukito yum.repos.d]#
[root@suzukito yum.repos.d]# rpm -qa | grep snmp
net-snmp-libs-5.8-14.el8.x86_64
net-snmp-agent-libs-5.8-14.el8.x86_64
php-snmp-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64
net-snmp-utils-5.8-14.el8.x86_64
net-snmp-5.8-14.el8.x86_64
[root@suzukito yum.repos.d]# rpm -qa | grep rrdtool
rrdtool-1.7.0-16.el8.x86_64
[root@suzukito yum.repos.d]#
[root@suzukito yum.repos.d]#cp -p /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
[root@suzukito yum.repos.d]#
[root@suzukito yum.repos.d]#vi /etc/snmp/snmpd.conf
40 # sec.name source community
41 #com2sec notConfigUser default public
73 ## sec.name source community
74 com2sec local localhost Linux#7
75 com2sec mynetwork 192.168.210.0/24 Linux#7
41行目コメント
74行目 コメント解除
community名「Linux#7」設定
75行目 コメント解除
source 「192.168.210.0/24」
community名「Linux#7」設定
77 # group.name sec.model sec.name
78 group MyRWGroup v2c local
79 group MyROGroup v2c mynetwork
80 #
78行目 コメント解除
sec.model 「v2c」設定
79行目 コメント解除
sec.model 「v2c」設定
84 ##incl/excl subtreemask
85 view all included .180
92 ##context sec.model sec.level prefix read write notif
93 access MyROGroup "" v2c noauth exact all none none
94 access MyRWGroup "" v2c noauth exact all all all
95
85行目コメント解除
93行目コメント解除、sec.model「v2c」設定、prefix「exact」設定
94行目コメント解除、sec.model「v2c」設定、prefix「exact」設定
13
手順21 差分チェック 手順22 snmpdの起動
【Linux】#7 cactiのインストール(3)snmp設定
[root@Linux7-CentStream ~]# diff /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
41c41
< #com2sec notConfigUser default public
---
> com2sec notConfigUser default public
74,75c74,75
< com2sec local localhost Linux#7
< com2sec mynetwork 192.168.210.0/24 Linux#7
---
> #com2sec local localhost COMMUNITY
> #com2sec mynetwork NETWORK/24 COMMUNITY
78,79c78,79
< group MyRWGroup v2c local
< group MyROGroup v2c mynetwork
---
> #group MyRWGroup any local
> #group MyROGroup any mynetwork
85c85
< view all included .1 80
---
> #view all included .1 80
93,94c93,94
< access MyROGroup "" v2c noauth exact all none none
< access MyRWGroup "" v2c noauth exact all all all
---
> #access MyROGroup "" any noauth 0 all none none
> #access MyRWGroup "" any noauth 0 all all all
[root@Linux7-CentStream ~]#
[root@suzukito ~]# systemctl start snmpd
[root@suzukito ~]# systemctl enable snmpd
Created symlink /etc/systemd/system/multi-
user.target.wants/snmpd.service →
/usr/lib/systemd/system/snmpd.service.
[root@suzukito ~]#
[root@suzukito ~]# systemctl status snmpd
● snmpd.service - Simple Network Management Protocol (SNMP)
Daemon.
Loaded: loaded (/usr/lib/systemd/system/snmpd.service; enabled;
vendor preset: disabled)
Active: active (running) since Fri 2021-05-07 04:22:27 EDT; 3min 42s
ago
Main PID: 14304 (snmpd)
Tasks: 1 (limit: 23566)
Memory: 4.8M
CGroup: /system.slice/snmpd.service
mq14304 /usr/sbin/snmpd -LS0-6d -f
5月 07 04:22:27 suzukito systemd[1]: Starting Simple Network
Management Protocol (SNMP) Daemon....
5月 07 04:22:27 suzukito snmpd[14304]: NET-SNMP version 5.8
5月 07 04:22:27 suzukito systemd[1]: Started Simple Network
Management Protocol (SNMP) Daemon..
[root@suzukito ~]#
14
手順23 snmpポーリング間隔を5分に設定
手順24 差分確認
【Linux】#7 cactiのインストール(4)snmpポーリング
[root@suzukito my.cnf.d]#cp -p /etc/cron.d/cacti /etc/cron.d/cacti.bak
[root@suzukito my.cnf.d]# vi /etc/cron.d/cacti
1 */5 * * * * apache /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1 1行目コメント解除
[root@suzukito my.cnf.d]#diff /etc/cron.d/cacti /etc/cron.d/cacti.bak
1c1
< */5 * * * * apache /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
---
> #*/5 * * * * apache /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
[root@suzukito my.cnf.d]#
15
手順25 Cactiのwebサーバへのアクセス許可を設定します
手順26 PCのセグメント(192.168.210.0/24)を追加します
差分をチェックします
サービスを再起動します
【Linux】#7 cactiのインストール(5)http webサービスアクセス許可
[root@suzukito html]# cp␣–p␣/etc/httpd/conf.d/cacti.conf␣/etc/httpd/conf.d/cacti.conf.bak
[root@suzukito html]# vi /etc/httpd/conf.d/cacti.conf
14 <Directory /usr/share/cacti/>
15 <IfModule mod_authz_core.c>
16 # httpd 2.4
17 Require host localhost
Require ip 192.168.210.0/24
18 </IfModule>
[root@suzukito html]# diff␣/etc/httpd/conf.d/cacti.conf␣/etc/httpd/conf.d/cacti.conf.bak
18d17
< Require ip 192.168.210.0/24
[root@suzukito html]#
[root@suzukito html]# systemctl restart httpd
16
手順27 MariaDBの設定をCacti推奨値に変更して再起動
手順28 ブラウザにて(192.168.210.201)へアクセスして、FTPサーバより設定ファイルをダウンロード
手順29 テラタームの「SSH SCP」設定ファイルを
「/etc/my.cnf.d/mariadb-server.cnf」へアップロード
【Linux】#7 cactiのインストール(6)mariadb
[root@suzukito yum.repos.d]#mv /etc/my.cnf.d/mariadb-server.cnf /etc/my.cnf.d/mariadb-server.cnf.bak
[root@suzukito yum.repos.d]#
[root@suzukito ~]# vi /etc/my.cnf.d/mariadb-server.conf
16 [mysqld]
17 datadir=/var/lib/mysql
18 socket=/var/lib/mysql/mysql.sock
19 log-error=/var/log/mariadb/mariadb.log
20 pid-file=/run/mariadb/mariadb.pid
21
22 default-time-zone='Asia/Tokyo'
23 character-set-server=utf8mb4
24 character_set_client=utf8mb4
25 collation-server=utf8mb4_unicode_ci
26
27 max_heap_table_size=128M
28 tmp_table_size=128M
29 join_buffer_size=256M
30 innodb_file_format=Barracuda
31 innodb_large_prefix=1
32 innodb_buffer_pool_size=2048M
33 innodb_flush_log_at_timeout=3
34 innodb_read_io_threads=32
35 innodb_write_io_threads=16
36 innodb_buffer_pool_instances=17
37 innodb_io_capacity=5000
38 innodb_io_capacity_max=10000
22行目から38行目
参考
17
手順30 タイムゾーン設定反映、mariadbの再起動
手順31 Cacti用データベース「cacti」を作成、ユーザ「cactiDBuser」、パスワード「cactiDBpass」を作成する。
Cacti用テーブルを110個作成する
【Linux】#7 cactiのインストール(7)mariadb
[root@suzukito my.cnf.d]# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
Enter password:
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
[root@suzukito my.cnf.d]#systemctl restart mariadb
P@ssw0rd
[root@Linux7-CentStream my.cnf.d]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or ¥g.
Your MariaDB connection id is 18
MariaDB [(none)]> create database cacti;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> grant all privileges on cacti.* to cactiDBuser@'localhost' identified by 'cactiDBpass’;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> grant select on mysql.time_zone_name to cactiDBuser@'localhost';
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> exit
Bye
[root@Linux7-CentStream my.cnf.d]# mysql -u cactiDBuser -p cacti < /usr/share/doc/cacti/cacti.sql
Enter password:
P@ssw0rd
cactiDBpass
18
手順30 PHP ←→ Mariadbの接続情報を設定します
手順31 差分をチェックします
【Linux】#7 cactiのインストール(8)php
[root@suzukito my.cnf.d]#cp -p /usr/share/cacti/include/config.php /usr/share/cacti/include/config.php.bak
[root@suzukito my.cnf.d]#
[root@suzukito my.cnf.d]#vi /usr/share/cacti/include/config.php
26 * Make sure these values reflect your actual database/host/user/password
27 */
28
29 $database_type = 'mysql';
30 $database_default = 'cacti';
31 $database_hostname = 'localhost';
32 $database_username = 'cactiDBuser';
33 $database_password = 'cactiDBpass';
34 $database_port = '3306';
35 $database_retries = 5;
36 $database_ssl = false;
37 $database_ssl_key = '';
38 $database_ssl_cert = '';
39 $database_ssl_ca = '';
32行目 username「cactiDBuser」設定
33行目 password「cactiDBpass」設定
[root@Linux7-CentStream include]# diff /usr/share/cacti/include/config.php /usr/share/cacti/include/config.php.bak
32,33c32,33
< $database_username = 'cactiDBuser';
< $database_password = 'cactiDBpass';
---
> $database_username = 'cactiuser';
> $database_password = 'cactiuser';
[root@Linux7-CentStream include]#
19
手順32 PHP情報を設定します
手順33 差分を確認します
【Linux】#7 cactiのインストール(9)php
[root@suzukito my.cnf.d]#cp -p /etc/php.ini /etc/php.ini.bak
[root@suzukito my.cnf.d]#
[root@suzukito my.cnf.d]#vi /etc/php.ini
383 max_execution_time = 60
404 memory_limit = 512M
902 date.timezone = Asia/Tokyo
383行目 タイムアウト値を「30秒」から「60秒」へ設定
404行目 メモリ上限値「128M」から「512M」へ設定
902行目 「;」コメントを解除、時刻ゾーンを東京へ「;」
[root@Linux7-CentStream include]# diff /etc/php.inicp -p /etc/php.ini /etc/php.ini.bak
383c383
< max_execution_time = 60
---
> max_execution_time = 30
404c404
< memory_limit = 512M
---
> memory_limit = 128M
902c902
< date.timezone = Asia/Tokyo
---
> ;date.timezone =
[root@Linux7-CentStream include]#
20
手順32 firewallでsnmp、snmptrapを許可します
手順33 snmp、snmptrapを追加します
手順34 firewallの設定変更を確認します
手順35 一時的な設定を恒久にします
【Linux】#7 cactiのインストール(10)firewall
[root@suzukito ~]# firewall-cmd --runtime-to-permanent
success
[root@suzukito ~]#
[root@suzukito ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens192
sources:
services: bacula cockpit dhcpv6-client http https snmp snmptrap ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@suzukito ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens192
sources:
services: bacula cockpit dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@suzukito ~]# firewall-cmd --add-service=snmp
success
[root@suzukito ~]# firewall-cmd --add-service=snmptrap
success
21
今日の流れ
1.環境確認
2.cactiインストール
3.Ciscoスイッチ設定、試験
4.Cacti初期設定
5.cactiグラフ表示
これから実施
22
ここからCiscoスイッチを設定します
手順34 スイッチにホスト名を設定します
Linux7Switch-1、Linux7Switch-2、LinuxSwitch-3、LinuxSwitch-4
手順35 ループバックインターフェースを作成します
192.168.0.1、 192.168.0.2、 192.168.0.3、 192.168.0.4
手順36 スイッチにIPアドレスを採番します
192.168.210.121、 192.168.210.122、 192.168.210.123、 192.168.210.124
手順37 snmp設定をします
手順38 snmptrap設定をします
【Linux】#7 スイッチにsnmp、snmptrapの設定を追加します
Switch(config)#hostname Linux7Switch-1
Linux7Switch-1(config)#interface Loopback0
Linux7Switch-1(config-if)#ip address 192.168.0.1 255.255.255.255
Linux7Switch-1(config-if)#exit
Linux7Switch-1(config)#interface Vlan1
Linux7Switch-1(config-if)# ip address 192.168.210.121 255.255.255.0
Linux7Switch-1(config-if)#exit
Linux7Switch-1(config)#snmp-server community Linux#7 RW
Linux7Switch-1(config)#snmp-server trap-source Loopback0
Linux7Switch-1(config)#snmp-server system-shutdown
Linux7Switch-1(config)#snmp-server enable traps snmp linkdown linkup
Linux7Switch-1(config)#snmp-server host 192.168.210.111 version 2c Linux#7Trap
自分のサーバのIPアドレス
192.168.210.111、192.168.210.112、192.168.210.113、192.168.210.114
23
手順39 サーバに戻って、snmptrap設定を追加します
【Linux】#7 サーバにsnmp、snmptrapの設定を追加します
[root@suzukito ~]# cp -p /etc/snmp/snmptrapd.conf /etc/snmp/snmptrapd.conf.bak
[root@suzukito ]# vi /etc/snmp/snmptrapd.conf
5 authCommunity log,execute,net Linux#7Trap
5行目 コメント「#」を削除、コミュニティ名を「Linux#7Trap」へ設定
[root@suzukito ~]# systemctl restart snmptrapd
[root@suzukito ~]# systemctl status snmptrapd
● snmptrapd.service - Simple Network Management Protocol (SNMP) Trap Daemon.
Loaded: loaded (/usr/lib/systemd/system/snmptrapd.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2021-05-08 04:23:10 EDT; 10s ago
Main PID: 2435 (snmptrapd)
Tasks: 1 (limit: 23566)
Memory: 2.9M
CGroup: /system.slice/snmptrapd.service
mq2435 /usr/sbin/snmptrapd -Lsd -f
5月 08 04:23:10 suzukito systemd[1]: Starting Simple Network Management Protocol (SNMP) Trap Daemon....
5月 08 04:23:10 suzukito snmptrapd[2435]: NET-SNMP version 5.8
5月 08 04:23:10 suzukito systemd[1]: Started Simple Network Management Protocol (SNMP) Trap Daemon..
[root@suzukito ~]#
24
スイッチ(192.168.210.121)からサーバ(192.168.210.111)にsnmptrap発報し、到
着するかを検証します
手順42 ループバックインターフェースを無効化、有効化します
手順41 snmptrapのログファイルを開きます
手順43 ログが約3秒後に表示される事を確認します
【Linux】#7 snmptrapの検証 左にスイッチのteraterm、右にサーバのteraterm
Linux7Switch-1(config)#interface loopback 0
Linux7Switch-1(config-if)#shutdown
Mar 30 07:57:15.645: %LINK-5-CHANGED: Interface Loopback0, changed
state to administratively down
Mar 30 07:57:16.646: %LINEPROTO-5-UPDOWN: Line protocol on Interface
Loopback0, changed state to down
[root@suzukito ~]# tail -f /var/log/messages | grep snmp
May 8 04:47:53 suzukito snmptrapd[2435]: 2021-05-08 04:47:47
<UNKNOWN> [UDP: [192.168.0.1]:65215-
>[192.168.210.28]:162]:#012DISMAN-EVENT-MIB::sysUpTimeInstance =
Timeticks: (2339451) 6:29:54.51#011SNMPv2-MIB::snmpTrapOID.0 = OID: IF-
MIB::linkDown#011IF-MIB::ifIndex.22067 = INTEGER: 22067#011IF-
MIB::ifDescr.22067 = STRING: Loopback0#011IF-MIB::ifType.22067 =
INTEGER: softwareLoopback(24)#011SNMPv2-
SMI::enterprises.9.2.2.1.1.20.22067 = STRING: "administratively down"
May 8 04:48:29 suzukito snmptrapd[2435]: 2021-05-08 04:48:23
<UNKNOWN> [UDP: [192.168.0.1]:65215-
>[192.168.210.28]:162]:#012DISMAN-EVENT-MIB::sysUpTimeInstance =
Timeticks: (2343089) 6:30:30.89#011SNMPv2-MIB::snmpTrapOID.0 = OID: IF-
MIB::linkUp#011IF-MIB::ifIndex.22067 = INTEGER: 22067#011IF-
MIB::ifDescr.22067 = STRING: Loopback0#011IF-MIB::ifType.22067 =
INTEGER: softwareLoopback(24)#011SNMPv2-
SMI::enterprises.9.2.2.1.1.20.22067 = STRING: "up"
[root@suzukito ~]# tail -f /var/log/messages | grep snmp
Linux7Switch-1#conf t
Linux7Switch-1(config)#interface loopback 0
Linux7Switch-1(config-if)#no shut
Linux7Switch-1#
Mar 30 07:57:52.030: %LINK-3-UPDOWN: Interface Loopback0, changed
state to up
Linux7Switch-1#
Mar 30 07:57:52.109: %SYS-5-CONFIG_I: Configured from console by
console
Mar 30 07:57:53.032: %LINEPROTO-5-UPDOWN: Line protocol on Interface
Loopback0, changed state to up
Linux7Switch-1#
snmptrap
イベント発
生時に通知
25
サーバからsnmpwalk
手順44 snmp対象ネットワーク内(192.168.210.0/24)のコミュニティ名
(Linux#7)から情報を収集してきます。
スイッチIP(192.168.210.122、192.168.210.123、192.168.210.124)でも可能
【Linux】#7 snmp検証
snmp
5分毎(デフォルト)
にデータ収集
[root@suzukito ~]# snmpwalk␣-v2c␣-c␣Linux#7␣192.168.210.121
[root@suzukito ~]# snmpwalk -v2c -c Linux#7 192.168.210.121
SNMPv2-MIB::sysDescr.0 = STRING: Cisco IOS Software, C2960C Software (C2960c405ex-UNIVERSALK9-M), Version 15.0(2)SE6, RELEASE SOFTWARE (fc2)
・・・(たくさん出力されます)・・・
SNMPv2-SMI::mib-2.47.1.1.1.1.7.1017 = STRING: "GigabitEthernet0/9"
SNMPv2-SMI::mib-2.47.1.1.1.1.7.1018 = STRING: "GigabitEthernet0/10"
・・・(ポートが確認出来ます)・・・
・・・(たくさん出力されます)・・・
・・・(たくさん出力されます)・・・
・・・(たくさん出力されます)・・・
26
今日の流れ
1.環境確認
2.cactiインストール
3.Ciscoスイッチ設定、試験
4.Cacti初期設定
5.cactiグラフ表示
これから実施
27
手順45
ブラウザを起動して(https://192.168.210.111/cacti)
にアクセスします。
192.168.210.112、192.168.210.113、
192.168.210.114
初期パスワードは「admin / admin」
手順46
adminの管理者パスワードを「Linux#7cacti」に変更しま
す
手順47
Step1 ライセンスに合意します
「Accept GPL License Agreement」にチェックをいれ
「Begin」をクリックします。
【Linux】#7 cacti初期セットアップ(1)ブラウザからアクセス出来るように
28
手順48
Step2「Next」
手順49
Step3「Next」
手順50
Step4「Next」
【Linux】#7 cacti初期セットアップ(2)
29
手順51
Step5「Next」
手順52
Step6 「I have read this statement」にチェック
「Next」
手順53
Step7「Next」
【Linux】#7 cacti初期セットアップ(3)
30
手順54
Step8「Next」
手順55
Step9「Next」
手順56
Step10「Confirm Installation」にチェック
「Install」
【Linux】#7 cacti初期セットアップ(4)
31
手順57
Step98 プログレスバーが進捗する。「Get Started」
画面表示されました
【Linux】#7 cacti初期セットアップ(5)
32
今日の流れ
1.環境確認
2.cactiインストール
3.Ciscoスイッチ設定、試験
4.Cacti初期設定
5.cactiグラフ表示
これから実施
33
手順60 「Create devices」をクリックします
手順61 「+」をクリックします
手順62
Description 「Linux7Switch-1」
Hostnaem 「192.168.210.121」
Device Template 「Cisco Router」
SNMP Community String 「Linux#7」
「Create」をクリック
手順63
疎通成功すると画面上部にメッセージが出力され、画面下部
にて
保存が選択できるようになります
「Save」をクリックして、
画面上部に戻り「Create Graphs for this Device」
【Linux】#7 cactiグラフ表示(1)
34
手順64
GigabitEthernet0/1にチェックを追加
「In/Out Bytes(BW)」を選択
「Create」をクリック
手順65
大きいファイルをダウンロードします。
ブラウザで(192.168.210.201)にアクセスし、LargeFile
(3.7GB)をダウンロードします。1分程度です
グラフ表示に時間がかかるので、3分程度雑談します。
雑談例)好きなポケモンは?
新入社員研修で何をしましたか?登山?
【Linux】#7 cactiグラフ表示(2)
35
手順66
グラフを確認します
「console」→「management」→「Graphs」
ダウンロード時のトラフィックを確認出来ました データ取得が未完了の場合、以下画面になります
【Linux】#7 cactiグラフ表示(3)
おしまい。おつかれさまでした。
DBサーバーの初期設定(1)
 MariaDBのインストール確認
 --version
 MariaDBの起動
 systemctl start
 MariaDBの起動確認
 Systemctl status
 自動起動設定もあわせて設定します。
 Systemctl enable
36
手順6 [root@suzukto ~]# systemctl␣start␣mariadb
● mariadb.service - MariaDB 10.3 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2020-12-30 05:50:28 JST; 2s ago
Docs: man:mysqld(8)
手順5 [root@suzukto ~]# mysql␣--version
mysql Ver 15.1 Distrib 10.3.17-MariaDB, for Linux (x86_64) using readline 5.1
手順8 [root@suzukto ~]# systemctl␣enable␣mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service →
/usr/lib/systemd/system/mariadb.service.
手順7 [root@suzukto ~]# systemctl␣status␣mariadb
DBサーバーの初期設定(2)
 MariaDBの自動起動確認
 --version
37
手順9 [root@suzukto ~]# systemctl␣status␣mariadb
● mariadb.service - MariaDB 10.3 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-12-30 05:50:28 JST; 15min ago
Docs: man:mysqld(8)
DBサーバーの初期設定(3)
 MariaDBの初期化
 環境によって設定の差異が出ないように初期化します。
 mysql_secure_installation
 Enter current password for root (enter for none):
 Enterを押します。rootの初期パスワードは空です。
 Set root password? [Y/n]
 「y」で応答し、rootユーザーのパスワードを設定します。
 Remove anonymous users? [Y/n]
 「y」で応答し、匿名ユーザーを削除します。
38
手順10 [root@suzukto ~]#mysql_secure_installation
Set root password? [Y/n] Y
New password: ←P@ssw0rdを入力します。(表示はされません)
Re-enter new password: ←確認のためもう一度入力します。
Password updated successfully! ←成功しました。
Reloading privilege tables..
... Success!
... Success!
Set root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Enter current password for root (enter for none):
間はアンダーバー
DBサーバーの初期設定(4)
 Disallow root login remotely? [Y/n]
 「y」で応答し、rootユーザーのリモートログインを無効化します。
 Remove test database and access to it? [Y/n]
 「y」で応答し、デフォルトで作成されているテストデータベースを削除します。
 Reload privilege tables now? [Y/n]
 「y」で応答し、権限テーブルを再読み込みします
 「Cleaning up...」と表示されたら初期化成功です。
39
Disallow root login remotely? [Y/n] Y
... Success!
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
... Success!

Más contenido relacionado

Destacado

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
Simplilearn
 

Destacado (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Linux#7