munin 是一个优秀的监控工具。不过网上对于如何通过跳板机连接目标机的资料不多,本篇文章是一个当时的试验记录,先放在这里,方便后面如果再次查阅的话.
Ensure you can access workers/nodes with your pubkey on munin master side.
On nodes, ensure installing munin-node
(that’s all done on all
debci workers)
On munin master, to install munin
and then:
a. sudo -u munin -s bash
# enter into munin namespace. -s
can avoid permission issue, but forget which link
cd
# return munin’s default home : /var/lib/munin/
b. copy private key to /var/lib/munin/.ssh/
In my case is /var/lib/munin/.ssh/vimer_id_ed25519
. The
key is the one we mentioned above. chown munin
to all files.
b. Configure .ssh/config
Host debian-10
HostName 127.0.0.1
Port 22
User vimer
ProxyCommand ssh jump-host -W %h:%p
IdentityFile /var/lib/munin/.ssh/vimer_id_ed25519
Host jump-host
HostName lab.com
Port 22
ServerAliveInterval 120
User vimer
IdentityFile /var/lib/munin/.ssh/vimer_id_ed25519
This is identical to your ~/.ssh/config except ` IdentityFile arg
forcely. Image under munin namespace, you have to log in on jump host
and workers with
user name`.
On another terminal, we need to configure /etc/munin/munin.conf
which is conf file of munin. Adding something like below:
[debian-01]
address ssh://vimer.7766.org:12345 -W localhost:4949
use_node_name yes
[debian-10]
address ssh://vimer@debci-10:12345 -W localhost:4949
use_node_name yes
then
sudo systemctl restart munin
.
Backing to the previous terminal, you can test it by manual:
munin@debian:~$ /usr/share/munin/munin-update --debug --nofork --host
debian-06 --service df
the --host
is what you want to debug. If everything is okay, you will see log:
munin@debian:~$ /usr/share/munin/munin-update --debug --nofork --host
debian-06 --service df
2024/04/19 02:42:51 [DEBUG] Creating new lock file
/var/run/munin/munin-update.lock
2024/04/19 02:42:51 [DEBUG] Creating lock :
/var/run/munin/munin-update.lock succeeded
2024/04/19 02:42:51 [INFO]: Starting munin-update
2024/04/19 02:42:52 [DEBUG] Creating new lock file
/var/run/munin/munin-debian-06.lock
2024/04/19 02:42:52 [DEBUG] Creating lock :
/var/run/munin/munin-debian-06.lock
succeeded
2024/04/19 02:42:52 [DEBUG] Reading state for
debian-06 in
/var/lib/munin/state-debian--06.storable
2024/04/19 02:42:52 [INFO] starting work in 1387300 for
debian-06 (ssh://vimer@debian-06:13321 -W localhost:4949).
2024/04/19 02:42:52 [DEBUG] open3(ssh -o
ChallengeResponseAuthentication=no -o StrictHostKeyChecking=no -p
13321 vimer@debian-06 -W localhost:4949)
2024/04/19 02:42:53 [INFO] node debian-06 advertised itself
as debci-bj-06 instead.
2024/04/19 02:42:53 TLS set to "disabled".
2024/04/19 02:42:53 [DEBUG] Negotiating capabilities
If you have error generated, you can execute ssh -o
ChallengeResponseAuthentication=no -o StrictHostKeyChecking=no -p
13321 vimer@debian-06 -W localhost:4949 -vvv
by hand to see what
happened on both side.
All steps are done as my testing. Two usefully log:
/var/log/munin/munin-update.log
for munin master and the other is
/var/log/munin/munin-node.log
for munin node.
```
Maybe in 2024 we use nginx heavily to distribute some Debian packages or something like this. But unfortunately, today I found I have forgotsome configs about it. So let’s take it on here now.
/etc/nginx$ ls sites-enabled/
default file.conf repo.conf
cotent of file.conf is:
a@debian:/etc/nginx$ cat sites-enabled/file.conf
server {
listen 81;
listen [::]:81;
#server_name ;
location / {
root /home/a/files/ ;
autoindex on;
}
}
以 Debian 为根据地,围绕 Debian 打造自己的技术栈。
这是一个长期更新的清单,记录我所有 debian 打包的一些情况。
一共13个。see link
dch is a tool to generate new entry in debian/changelog
.
The option to be used as unstable
upload.
export DEBEMAIL=[email protected]
export DEBFULLNAME="xx"
你需要安装 dnsutils
包在 Debian 上。
dig
是用来查询 DNS 的命令。
dig Hostname
dig DomaiNameHere
dig @DNS-server-name Hostname
dig @DNS-server-name IPAddress
dig @DNS-server-name Hostname|IPAddress type
这里是一些具体的解释
dig ipv6.google.com
这个命令执行的是默认查询,通常是 A 记录查询,用于获取主机名对应的 IPv4 地址。如果主机名有对应的 IPv4 地址,dig 会返回该地址。
dig AAAA ipv6.google.com:
这个命令执行的是 AAAA 记录查询,用于获取主机名对应的 IPv6 地址。如果主机名有对应的 IPv6 地址,dig 会返回该地址。
源码目录: https://github.com/yuzibo/vf2-linux
使用 vf2 开头的分支,首先交叉编译出相应的 kernel riscv64 的 deb 包。 配置可以使用 debian_defconfig
或者你可以直接使用 prebuilt image
download from here
sudo debootstrap --arch=riscv64 unstable /tmp/riscv64-chroot http://mirrors.tuna.tsinghua.edu.cn/debian/
sudo systemd-nspawn -D /tmp/riscv64-chroot/ -M debian --bind-ro=/etc/resolv.conf
apt update
apt upgrade
apt-get install initramfs-tools openssh-server systemd-timesyncd rsync bash-completion u-boot-menu
4.0 安装 kernel
这里有2种方式安装 kernel, 一种是自己构建,一种是使用 prebuild 第一种方式可以参考这里,第二种方式可以参考这里. 下面以 prebuilt 方式进行讲解:
# 1 download prebuild kernel image from here:
# https://github.com/yuzibo/vf2-linux *-dev branch with tag published
# then copy into /tmp/riscv64-chroot
~: ls
linux-headers-6.6.7-vf2_2023.12.14.08.37+88bd30f68_riscv64.deb
linux-image-6.6.7-vf2_2023.12.14.08.37+88bd30f68_riscv64.deb
apt install -f ./*.deb
4.0.1 u-boot
接下来需要配置与启动最直接相关的 u-boot 了:
主要一个是 /etc/default/u-boot
,另一个是 uEnv.txt
. 引导设备最好在dd 时再操作。
cat <<EOF >> /etc/default/u-boot
U_BOOT_PARAMETERS="rw console=tty0 console=ttyS0,115200 earlycon rootwait stmmaceth=chain_mode:1 selinux=0"
EOF
$ cat /etc/default/u-boot // double check
sed -i -e 's|root=[^ ]*|root=/dev/mmcblk1p3|' /boot/extlinux/extlinux.conf
Then
mkdir -p /boot/efi
配置 uEvn.txt
cat <<EOF > /boot/uEnv.txt
fdtdir=/boot/dtbs
fdtfile=starfive/jh7110-starfive-visionfive-2-v1.2a.dtb
kernel_comp_addr_r=0xb0000000
kernel_comp_size=0x10000000
EOF
change dtb file following your vf2 boards
最后:
cat <<EOF > /etc/fstab
/dev/mmcblk1p2 /boot/efi vfat umask=0077 0 1
EOF
4.1 配置 网络接口
cat <<EOF >> /etc/network/interfaces
allow-hotplug end0
iface end0 inet dhcp
EOF
echo vf2 > /etc/hostname
passwd # for vf2
# add new user
root@debian:/# adduser debian
info: Adding user `debian' ...
info: Selecting UID/GID from range 1000 to 59999 ...
info: Adding new group `debian' (1000) ...
info: Adding new user `debian' (1000) with group `debian (1000)' ...
info: Creating home directory `/home/debian' ...
info: Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for debian
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n]
info: Adding new user `debian' to supplemental / extra groups `users' ...
info: Adding user `debian' to group `users' ...
# passwd for debian is `debian`
passwd debian
New password:
Retype new password:
passwd: password updated successfully
usermod -aG sudo debian