centos7 zabbix+grafana监控nginx
GRAFANA 安装
Grafana是领先的开源可视化软件工具,无论您的数据在哪里,或者它所处的数据库是什么类型,您都可以将它与Grafana结合在一起,做成精美的可视化图表
Grafana官网:https://grafana.com/
Grafana官方手册:https://grafana.com/docs/
Grafana安装
上传Grafana安装包或者下载rpm安装包到服务器,执行如下命令安装:
配置yum源
[root@localhost ~]# vim /etc/yum.repos.d/grafana.repo [grafana] name=grafana baseurl=https://packages.grafana.com/oss/rpm-beta repo_gpgcheck=1 enabled=1 gpgcheck=1 gpgkey=https://packages.grafana.com/gpg.key sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt
[root@localhost ~]# yum -y install grafana
启动grafana-server
systemctl start grafana-server systemctl status grafana-server systemctl enable grafana-server.service
定义环境变量文件:/etc/sysconfig/grafana-server
/etc/sysconfig/grafana-server文件内容:不用修改
配置文件:/etc/grafana/grafana.ini 不用修改
Paths配置段
#################################### Paths #################################### [paths] # Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used) ;data = /var/lib/grafana # 默认存放数据位置 # Temporary files in `data` directory older than given duration will be removed ;temp_data_lifetime = 24h # 删除 'data'目录给定时间前的临时文件,使用0则不删除临时文件,时间格式h,m。如168h,30m,10h30m # Directory where grafana can store logs ;logs = /var/log/grafana # grafana存储日志的目录 # Directory where grafana will automatically scan and look for plugins ;plugins = /var/lib/grafana/plugins # grafana存放插件的目录 # folder that contains provisioning config files that grafana will apply on startup and while running. ;provisioning = conf/provisioning
Server配置段
[server] # Protocol (http, https, h2, socket) ;protocol = http #支持的协议 # The ip address to bind to, empty will bind to all interfaces ;http_addr = #服务监听的地址 # The http port to use ;http_port = 3000 #监听的端口 # The public facing domain name used to access grafana from a browser ;domain = localhost #使用域名访问服务 # Redirect to correct domain if host header does not match domain # Prevents DNS rebinding attacks ;enforce_domain = false #是否 强制使用域名访问服务 # The full public facing url you use in browser, used for redirects and emails # If you use reverse proxy and sub path specify full url (with sub path) ;root_url = %(protocol)s://%(domain)s:%(http_port)s/ #定义访问服务的路径 # Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons. ;serve_from_sub_path = false # Log web requests #是否记录web请求 ;router_logging = false # the path relative working path #定义静态文件的访问路径 ;static_root_path = public # enable gzip #是否开启压缩 ;enable_gzip = false # https certs & key file #证书文件 ;cert_file = ;cert_key = # Unix socket path #定义socket路径 ;socket =
grafana默认存储数据采用的是sqlite3数据库,当然我们也可以使用mysql,这个需要在grafana配置文件中更改Database相关的配置即可
grafana的UI管理页面默认监听端口是3000,也可以通过修改配置文件server的相关配置即可
grafana默认登录的管理员账号密码都是:admin
改变默认登录 密码!,然后进入系统
安装zabbix 插件点击如图所示
复制图中代码在xshell中执行命令
grafana-cli plugins install alexanderzobnin-zabbix-app
这表示zabbix插件安装成功
重启grafana
systemctl restart grafana-server.service
回到主页,开启zabbix app
再次添加zabbix作为数据源
zabbix的用户名:admin
zabbix的密码:zabbix
这里会有添加的三个仪表盘
创建一个仪表盘
可以看到效果
注意:务必要保证zabbix-server 和grafana server 这两台服务器的时间保持同步,否则 grafana server 是不会出图的!
时间同步
[root@localhost ~]# yum -y install ntpdate [root@localhost ~]# ntpdate 2.cn.pool.ntp.org
- 阿里云服务器使用freessl配置免费证书Nginx
- window系统安装部署nginx
- nginx如何解决跨域,加上这串代码就好啦
- spring boot 使用Nginx及其基本概念、安装、配置
- 云主机服务器centOS系统nginx项目部署环境搭建配置详细步骤
- Linux学习 -搭建python3环境和Nginx
- Nginx企业级优化,隐藏版本号,修改用户与组,配置网页缓存时间,nginx日志切割,设置nginx链接超时,更改nginx进程数,配置网页压缩,配置nginx网页防盗链,FPM参数进程优化
- nginx 常见参数以及重定向参数配置
- nginx的安装、配置和作用
- nginx 配置 wss 转发
- nginx 文件(路径)映射
- Nginx
- Nginx学习笔记-简介
- Nginx学习笔记-基本配置
- Nginx学习笔记-FastCGI
- nginx 命令 及配置文件详解
- nginx---动静分离(server配置)
- nginx---负载均衡(server配置)
- centos 7.2 yum 安装 nginx
- deepin下搭建 nginx+rtmp流媒体服务器