prometheus相关 离线安装

以下是基于裸机且离线安装的方式(内网环境)

1.下载基本安装包和后续需要使用的安装包

(1)首先在可以访问外网的服务器将rpm包和二进制安装包下载好

下载基本环境rpm包

 yum install yum-utils  #此工具用来下载需要的RPM包(就是将我们在线yum安装的东西只下载不安装)
 yumdownloader lsof --resolve --destdir=/home/softpackage/ #--resolve 下载其依赖包
 yumdownloader lrzsz --resolve --destdir=/home/softpackage/
 yumdownloader telnet --resolve --destdir=/home/softpackage/

若有其它依赖或者工具包,都可采用此方法下载

(2) 下载prometheus相关二进制tar包

wget https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz
wget https://dl.grafana.com/oss/release/grafana-6.4.3.linux-amd64.tar.gz
wget https://github.com/prometheus/prometheus/releases/download/v2.14.0-rc.0/prometheus-2.14.0-rc.0.linux-amd64.tar.gz
wget https://github.com/prometheus/alertmanager/releases/download/v0.19.0/alertmanager-0.19.0.linux-amd64.tar.gz
wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.linux-amd64.tar.gz
wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
wget https://github.com/prometheus/pushgateway/releases/download/v1.0.0/pushgateway-1.0.0.linux-amd64.tar.gz
wget https://github.com/oliver006/redis_exporter/releases/download/v1.3.2/redis_exporter-v1.3.2.linux-amd64.tar.gz
wget https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.12.0/jmx_prometheus_javaagent-0.12.0.jar
...
这里不一一罗列了,如有其它需要网上找资源下载

(3)小编将prometheus相关包和基础工具包已下载好,若使用以下下载资源,上述两步骤可忽略(没有工具的小伙伴用推荐此步骤下载,里边包含nginx1.12编译安装需要的拓展包及依赖包)

链接:https://pan.baidu.com/s/1a4GJEGRfNcWWQs4ERLuQ_Q 
提取码:ve7n 

2.将下载好的包通过跳板机和ftp上传到服务器并安装

<1>安装基本环境,再装prometheus相关的包

# rpm -ivh lrzsz-0.12.20-36.el7.x86_64.rpm
# rpm -ivh lsof-4.87-6.el7.x86_64.rpm
# rpm -ivh telnet-0.17-64.el7.x86_64.rpm

<2>安装prometheus(prometheus配置下文有单读章节讲解)

tar zxvf prometheus-2.14.0-rc.0.linux-amd64.tar.gz
mv prometheus-2.13.1.linux-amd64 prometheus
cd prometheus
nohup ./prometheus &

<3>安装alertmanage(alertmanage配置下文有单读章节讲解)

tar zxvf alertmanager-0.19.0.linux-amd64.tar.gz
mv alertmanager-0.19.0.linux-amd64.tar.gz alertmanager
cd alertmanager
nohup ./alertmanager &

<4>安装exporter(这里只例举了其中一个,其他详细下文有单独章节讲解)

tar zxvf node_exporter-0.18.1.linux-amd64.tar.gz
mv node_exporter-0.18.1.linux-amd64 node_exporter
nohup ./node_exporter &

<5>安装Grafana(grafana二次开发、汉化下文有单独章节讲解)

# tar -zxvf go1.9.linux-amd64.tar.gz -C /usr/local
# vi /etc/profile
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
# source /etc/profile
# go version  #查看是否安装成功
# tar -xzvf grafana-6.4.3.linux-amd64.tar.gz
# vim /usr/local/grafana-6.4.3/conf/defaults.ini
http_port = 80

# vim /usr/lib/systemd/system/grafana-server.service
[Unit]
Description=Grafana
After=network.target

[Service]
Type=notify
ExecStart=/usr/local/grafana/bin/grafana-server -homepath /usr/local/grafana
Restart=on-failure

[Install]
WantedBy=multi-user.target

另外需要安装panel插件,将插件安装包解压到plugins目录下:
#cd /usr/local/grafana-6.4.3/data/plugins/
#tar -zxvf grafana-piechart-panel.tar

启动grafana服务
# systemctl enable grafana-server.service
# systemctl start grafana-server.service

访问
web地址:http://ip
账号密码:admin / admin

注:此章节侧重各资源获取及安装,配置及衔接使用有后续有具体章节

你可能感兴趣的:(监控)