在 CentOS 7 上安装 scollector

作为特权用户(root 或 sudo):

创建 scollector 目录:

mkdir /opt/scollector

在/ opt / scollector 目录中,从 bosun / scollector 站点下载最新的二进制版本,[ http://bosun.org/scollector/] [1 ]

wget https://github.com/bosun-monitor/bosun/releases/download/"version"/scollector-"OS"-"arch"

例如:
wget https://github.com/bosun-monitor/bosun/releases/download/0.5.0/scollector-linux-amd64

在/ usr / local / bin 中创建一个符号链接:

ln -s /opt/scollector/scollector-linux-amd64 /usr/local/bin/scollector

创建配置目录;

mkdir /etc/scollector

使用本指南创建 scollector 配置文件 scollector.toml

配置文件的路径是/etc/scollector/scollector.conf

例如:

 Host = "http://xxx.xxx.xxx.xxx:8070" #replace xxx with the IP of your Bosun server
    Hostname = "DevOps-Bosun-Prod"
    [[ICMP]]
      Host = "some.hostname.here"
    [[ICMP]]
      Host = "some.other.hostname.here"
    [tags]
      hostgroup = "system"
    #[[GoogleAnalytics]]
    #  ClientID = ""
    #  Secret = ""
    #  Token = ""

创建服务文件/etc/systemd/system/scollector.service

例如:

[Unit]
Description=Scollector Service
After=network.target

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/scollector -conf=/etc/scollector/scollector.toml
Restart=on-abort

[Install]
WantedBy=multi-user.target

告诉 Systemd 你已创建新服务:

systemctl enable scollector.service

开始 scollector:

systemctl start scollector

你可以通过运行来查看 scollector 是否已启动:

systemctl status scollector

或者,你可以查看系统消息日志,你正在寻找以下内容:

Jul 29 23:19:27 bosun-prod systemd: Started Scollector Service.
Jul 29 23:19:27 bosun-prod systemd: Starting Scollector Service...
Jul 29 23:19:27 bosun-prod scollector[4363]: info: main.go:213: OpenTSDB host: http://127.0.0.1:8070