RaspberryPi起点で自宅インターネット回線モニタリング作戦 の環境構築コード
+ 自宅のグローバルIPが変わるのを監視する用のコード
refs
- Pubs/Mackerel Ambassador (sogaoh) blogs/
- https://zenn.dev/sogaoh
-
RaspberryPi
- Purchase
- Assemble
- Initial setup
- SSH connect configure (for running
ansible-playbook
)
-
Local
- install Ansible
- [macOS] brew install ansible
- install Ansible
-
Sign up https://mackerel.io/
- confirm API key
cd ${your_appropriate_directory}
git clone https://github.com/sogaoh/mackerel-practice.git
cd mackerel-practice/raspi-01
cd 02_ansible/roles
#ansible-galaxy install mackerelio.mackerel-agent
#mv ${/path/to/.ansible}/roles/* ./
cd .. # 02_ansible
(vi inventry)
(vi variables.yaml)
ansible-playbook ./raspi-01.yaml -i "[target host IP, etc...]," -e @variables.yaml -v -C
ansible-playbook ./raspi-01.yaml -i "[target host IP, etc...]," -e @variables.yaml -vv
rm -f *.retry
cd ../.. # mackerel-practice
mackerel_agent_apikey: "${Set Yours}"
service_to_post: "${Set Service}"
[localhost]
127.0.0.1 ansible_connection=local
[raspi]
raspi-01 ansible_host=192.168.0.34
[raspi:vars]
#ansible_port=${Set if necessary}
ansible_ssh_user=pi # RaspberryPi default
ansible_ssh_private_key_file=${Set Yours}
ansible_become=yes
ansible_become_user=root
ansible_become_method=enable
- mackerel-agent-raspi
- mackerel-plugins-raspi
- speedtest_net-cli-raspi
- sardine_service-raspi
ip2metric.sh
added 2021/07/22