SUSE 11SP3安装osquery及zabbix-agent

1.升级系统依赖库的libc:

wget http://ftp.gnu.org/gnu/glibc/glibc-2.12.1.tar.gz
wget http://ftp.gnu.org/gnu/glibc/glibc-ports-2.12.1.tar.gz
 
tar -xvf  glibc-2.12.1.tar.gz
 
tar -xvf  glibc-ports-2.12.1.tar.gz
 
mv glibc-ports-2.15 glibc-2.12.1/ports

mkdir glibc-build-2.12.1 
 
cd glibc-build-2.12.1
 
 
../glibc-2.12.1/configure  --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
 
make
make install

2.下载osqurey安装包

https://osquery-packages.s3.amazonaws.com/linux/osquery-3.2.4_1.linux_x86_64.tar.gz

3.解压并测试:

 mkdir osquery
 tar -zxvf osquery-3.2.4_1.linux_x86_64.tar.gz -C osquery/
 cd osquery/
 # ./osqueryi -json "SELECT * FROM routes"
[
  {"destination":"0.0.0.0","flags":"0","gateway":"192.168.100.1","interface":"eth0","metric":"0","mtu":"0","netmask":"0","source":"","type":"gateway"},
  {"destination":"127.0.0.0","flags":"0","gateway":"","interface":"lo","metric":"0","mtu":"0","netmask":"8","source":"","type":"gateway"},
  {"destination":"169.254.0.0","flags":"0","gateway":"","interface":"eth0","metric":"0","mtu":"0","netmask":"16","source":"","type":"gateway"},
  {"destination":"192.168.100.0","flags":"0","gateway":"","interface":"eth0","metric":"0","mtu":"0","netmask":"24","source":"192.168.100.5","type":"gateway"},
  {"destination":"127.0.0.0","flags":"0","gateway":"","interface":"lo","metric":"0","mtu":"0","netmask":"0","source":"127.0.0.1","type":"broadcast"},
  {"destination":"127.0.0.0","flags":"0","gateway":"","interface":"lo","metric":"0","mtu":"0","netmask":"8","source":"127.0.0.1","type":"local"},
  {"destination":"127.0.0.1","flags":"0","gateway":"","interface":"lo","metric":"0","mtu":"0","netmask":"0","source":"127.0.0.1","type":"local"},
  {"destination":"127.0.0.2","flags":"0","gateway":"","interface":"lo","metric":"0","mtu":"0","netmask":"0","source":"127.0.0.1","type":"local"},
  {"destination":"127.255.255.255","flags":"0","gateway":"","interface":"lo","metric":"0","mtu":"0","netmask":"0","source":"127.0.0.1","type":"broadcast"},
  {"destination":"192.168.100.0","flags":"0","gateway":"","interface":"eth0","metric":"0","mtu":"0","netmask":"0","source":"192.168.100.5","type":"broadcast"},
  {"destination":"192.168.100.5","flags":"0","gateway":"","interface":"eth0","metric":"0","mtu":"0","netmask":"0","source":"192.168.100.5","type":"local"},
  {"destination":"192.168.100.255","flags":"0","gateway":"","interface":"eth0","metric":"0","mtu":"0","netmask":"0","source":"192.168.100.5","type":"broadcast"},
  {"destination":"fe80::","flags":"0","gateway":"","interface":"eth0","metric":"256","mtu":"0","netmask":"64","source":"","type":"gateway"},
  {"destination":"0.0.0.0","flags":"0","gateway":"","interface":"lo","metric":"-1","mtu":"0","netmask":"0","source":"","type":"other"},
  {"destination":"::1","flags":"0","gateway":"::","interface":"lo","metric":"0","mtu":"0","netmask":"0","source":"","type":"local"},
  {"destination":"fe80::20c:29ff:fe46:50ac","flags":"0","gateway":"::","interface":"lo","metric":"0","mtu":"0","netmask":"0","source":"","type":"local"},
  {"destination":"ff00::","flags":"0","gateway":"","interface":"eth0","metric":"256","mtu":"0","netmask":"8","source":"","type":"gateway"},
  {"destination":"0.0.0.0","flags":"0","gateway":"","interface":"lo","metric":"-1","mtu":"0","netmask":"0","source":"","type":"other"}
]
linux-6ue1:/home/osquery/usr/bin # 

 
 

3.安装zabbix-agent

zypper addrepo http://download.opensuse.org/repositories/server:/monitoring/SLE_11_SP3/ server_monitoring
zypper update
zypper install zabbix-agent

修改zabbix-agent配置文件

vim /etc/zabbix/zabbix-agentd.conf
Server=192.168.100.2
ServerActive=192.168.100.2

启动并测试:

 # service zabbix-agentd start
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
chkconfig zabbix-agentd on
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Starting zabbix agentd job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
                                                                                                                                        done
开机启动:

chkconfig zabbix-agentd on

测试:

# zabbix_get -s 192.168.100.5 -k system.swap.size[,free]
2153766912
# zabbix_get -s 192.168.100.5 -k proc.num[]
186
# zabbix_get -s 192.168.100.5 -k vm.memory.size[available]
1726746624

猜你喜欢

转载自blog.csdn.net/weixin_38679007/article/details/80548759