こんにちは。
株式会社クラスアクト インフラストラクチャ事業部の大塚です。
HinemosのAgentを準備していきます。
Managerの構築手順は以下を参照ください。
手順
Vagrantfileを用意してVMを立ち上げていきます。
Vagrantを使わず、普通にポチポチVMを用意しても問題ありません。
shota@shota-20f5a2v5jp:~/ドキュメント/vagrant_hinemos_agent$ cat Vagrantfile
Vagrant.configure("2") do |config|
# 使用するボックス(Alma Linux 8)
config.vm.box = "almalinux/8"
config.vm.box_version = "8.10.20250220" # 必要に応じてバージョンを指定
# 仮想マシンのリソース設定
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096" # メモリ設定
vb.cpus = 2 # CPU設定
end
# ネットワーク設定(ブリッジ接続)とIPアドレスの固定化
config.vm.network "public_network", bridge: "wlp4s0", ip: "192.168.0.131"
# 仮想マシンのホスト名を設定
config.vm.hostname = "hinemos-agent"
# 仮想マシン名の設定
config.vm.define "hinemos-agent" do |alma|
# 仮想マシンを起動した際に実行するシェルスクリプト
alma.vm.provision "shell", inline: <<-SHELL
# システムの更新
sudo dnf update -y
# DNS設定
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
echo "nameserver 8.8.4.4" | sudo tee -a /etc/resolv.conf
SHELL
end
end
VMを立ち上げる
shota@shota-20f5a2v5jp:~/ドキュメント/vagrant_hinemos_agent$ vagrant up
shota@shota-20f5a2v5jp:~/ドキュメント/vagrant_hinemos_agent$ vagrant global-status
id name provider state directory
-----------------------------------------------------------------------------------
8bdf28a hinemos virtualbox running /home/shota/ドキュメント/vagrant_hinemos
03d3eee hinemos-agent virtualbox running /home/shota/ドキュメント/vagrant_hinemos_agent
ssh接続する
shota@shota-20f5a2v5jp:~/ドキュメント/vagrant_hinemos_agent$ vagrant ssh 03d3eee
[vagrant@hinemos-agent ~]$ sudo su
SELinuxとかfirewalldを無効化していきます。
[root@hinemos-agent ~]# vi /etc/selinux/config
[root@hinemos-agent ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@hinemos-agent ~]# systemctl disable firewalld
[root@hinemos-agent ~]# reboot
必要な資材とかをダウンロードしたり、インストールしていきます。
Managerとの差分でsnmpd関連のを追加でインストールしています。
[root@hinemos-agent ~]# dnf install wget libXi libXrender libXtst alsa-lib fontconfig freetype vim-common java-1.8.0-openjdk net-snmp net-snmp-utils
[root@hinemos-agent ~]# echo "view systemview included .1.3.6.1" >> /etc/snmp/snmpd.conf
[root@hinemos-agent ~]# wget https://github.com/hinemos/hinemos/releases/download/v7.0.0/hinemos-7.0-agent-7.0.0-1.el.noarch.rpm
[root@hinemos-agent ~]# ls
hinemos-7.0-agent-7.0.0-1.el.noarch.rpm
Agentをインストールしたり、snmpdをrestartしたりしていきます。
[root@hinemos-agent ~]# rpm -ivh hinemos-7.0-agent-7.0.0-1.el.noarch.rpm
[root@hinemos-agent ~]# systemctl start hinemos_agent
[root@hinemos-agent ~]# systemctl enable hinemos_agent
[root@hinemos-agent ~]# systemctl status hinemos_agent
● hinemos_agent.service - SYSV: Hinemos Agent
Loaded: loaded (/etc/rc.d/init.d/hinemos_agent; generated)
Active: active (running) since Tue 2025-04-29 11:58:21 UTC; 27s ago
Docs: man:systemd-sysv-generator(8)
Tasks: 24 (limit: 24761)
Memory: 75.0M
CGroup: /system.slice/hinemos_agent.service
mq2560 /usr/bin/java -Dhostname=hinemos-agent -server -Xms32m -Xmx32m -Xss256k -Dhinemos.agent.conf.dir=/>
Apr 29 11:58:20 hinemos-agent systemd[1]: Starting SYSV: Hinemos Agent...
Apr 29 11:58:21 hinemos-agent hinemos_agent[2496]: Starting hinemos_agent :
Apr 29 11:58:21 hinemos-agent hinemos_agent[2503]: Hinemos Agent started.
Apr 29 11:58:21 hinemos-agent systemd[1]: Started SYSV: Hinemos Agent.
[root@hinemos-agent ~]# systemctl restart snmpd
[root@hinemos-agent ~]# systemctl enable snmpd
Agentのconfファイルを編集していきます。
次の記事でManagerからジョブ実行していきたいと思います
[root@hinemos-agent ~]# cd /opt/hinemos_agent/conf
[root@hinemos-agent conf]# vi Agent.properties
[root@hinemos-agent conf]# cat Agent.properties | grep -i Web
managerAddress=http://192.168.0.130:8083/HinemosWeb/
[root@hinemos-agent conf]# systemctl restart hinemos_agent