[Up]常用資訊

[重點文章] 重點文章 [重點文章] 重點文章

2020年7月22日 星期三

[Debian] 另外一種 debian 安裝 TIG 方式

[Debian] 另外一種 debian 安裝 TIG 方式

 
#Step 01 – 安裝 influxdb

# Trust the Influx GPG key
wget -qO- https://repos.influxdata.com/influxdb.key | apt-key add -
# Add the Influx repositories to apt
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | tee /etc/apt/sources.list.d/influxdb.list

OR

echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

# Update the repositories, and install influx
apt-get update && apt-get install influxdb

# Enable influx, and start it
systemctl unmask influxdb.service
systemctl start influxdb


root@linux:~$ influx
Connected to http://localhost:8086 version 1.7.9
InfluxDB shell version: 1.7.9
> quit
root@linux:~$

CREATE DATABASE telegraf
CREATE DATABASE telegraf_downsampled
CREATE RETENTION POLICY "rp_short" ON "telegraf" DURATION 30d REPLICATION 1 DEFAULT
CREATE CONTINUOUS QUERY cq_all_measurement ON telegraf BEGIN SELECT mean(*) INTO telegraf_downsampled.autogen.:MEASUREMENT FROM telegraf.rp_short./.*/ GROUP BY time(15m), * END


ALTER RETENTION POLICY "autogen" ON "telegraf" DURATION 70d REPLICATION 1  # 更新不會影響資料,只又套用新的policy 會影響資料

 
#Step 02 – 安裝 Telegraf



# Update the repositories, and install telegraf
apt-get update && apt-get install telegraf

# Generate the telegraf configuration with input from Cisco
# devices, and output to Influxdb
telegraf --output-filter influxdb --input-filter cisco_telemetry_mdt config | tee /etc/telegraf/telegraf.conf

# Enable and start the service
systemctl enable telegraf
systemctl start telegraf

root@linux:/etc/systemd$ ss -plant
State  Recv-Q  Send-Q        Local Address:Port            Peer Address:Port
LISTEN 0       128           127.0.0.53%lo:53                   0.0.0.0:*       users:(("systemd-resolve",pid=737,fd=13))
LISTEN 0       128                 0.0.0.0:22                   0.0.0.0:*       users:(("sshd",pid=983,fd=3))
LISTEN 0       128               127.0.0.1:8088                 0.0.0.0:*       users:(("influxd",pid=2348,fd=3))
ESTAB  0       0              82.71.240.83:22              212.23.9.213:63810   users:(("sshd",pid=1304,fd=3),("sshd",pid=1166,fd=3))
LISTEN 0       128                       *:8086                       *:*       users:(("influxd",pid=2348,fd=5))
LISTEN 0       128                    [::]:22                      [::]:*       users:(("sshd",pid=983,fd=4))
LISTEN 0       128                       *:3000                       *:*       users:(("grafana-server",pid=3861,fd=6))
LISTEN 0       128                       *:57000                      *:*       users:(("telegraf",pid=4794,fd=6))
ESTAB  0       0                     [::1]:36856                  [::1]:8086    users:(("telegraf",pid=4794,fd=5))
ESTAB  0       0                     [::1]:8086                   [::1]:36856   users:(("influxd",pid=2348,fd=6))
ESTAB  0       0         [::ffff:10.0.2.1]:57000   [::ffff:192.168.0.2]:60761   users:(("telegraf",pid=4794,fd=7))

root@linux:/etc/systemd$ influx
Connected to http://localhost:8086 version 1.7.9
InfluxDB shell version: 1.7.9
> show databases
name: databases
name
----
_internal
telegraf
> exit
 
#Step 03 – 安裝 Grafana


apt install software-properties-common -y

add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
wget -q -O - https://packages.grafana.com/gpg.key | apt-key add -
apt-get update
apt-get install grafana

systemctl daemon-reload
systemctl start grafana-server
systemctl enable grafana-server.service

安裝套件
grafana-cli plugins install grafana-piechart-panel

grafana-cli plugins install grafana-worldmap-panel

grafana-cli plugins install natel-discrete-panel

grafana-cli plugins install grafana-image-renderer



RouterOS 設定NAT loopback (Hairpin NAT)
第一筆 internet 進入NAT
add action=dst-nat chain=dstnat comment="4353_TCP" dst-port=4353 in-interface=ISP1_PPPoE_Out_Fixed protocol=tcp src-address-list="" to-addresses=192.168.8.2 to-ports=4353
第二筆 ROS內部轉換NAT
add action=dst-nat chain=dstnat dst-address-type=local dst-port=4353 protocol=tcp to-addresses=192.168.8.2 to-ports=4353
第三筆 ROS延續上一筆封包內部介面轉出
add action=masquerade chain=srcnat dst-address=192.168.8.2 dst-port=4353 out-interface=ether3-ROS-GTM protocol=tcp src-address=192.168.8.0/24

沒有留言:

張貼留言