graphite安装笔记

article/2025/9/20 17:04:19
0.Graphite目录

Graphite安装之后,在安装位置(默认为/opt/graphite)的文件布局如下:

目录介绍
/opt/graphite/bin二进制文件目录
/opt/graphite/conf配置文件目录
/opt/graphite/lib库目录
/opt/graphite/storage数据存放目录,包括log,whisper数据库,索引,rrd数据等
/opt/graphite/webappwebapp文件存放目录
/opt/graphite/examples获取数据的例子


1.安装环境
     Python版本:         2.6.6
     系统版本:           CentOS release 6.4 (Final) 2.6.32-358.el6.x86_64
     yum源:              系统原有的

2.所需软件
         ①. carbon-0.9.10.tar.gz
         ②. graphite-web-0.9.10.tar.gz
         ③. whisper-0.9.10.tar.gz
         ④. check-dependencies.py

3.安装依赖
         vi /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux   6 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6


         yum install bitmap bitmap-fonts-compat Django django-tagging fontconfig cairo python-devel python-memcached python-twisted  pycairo mod_python python-ldap python-simplejson memcached python-zope-interface mod_wsgi python-sqlite2 bitmap Django django-tagging mod_python python-sqlite2 -y

可能出现的问题:

       (1)yum数据源可能找不到,建议可以配置网易的yum数据源

1、下载新源及将本地源备份
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost ~]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[root@localhost ~]# mv CentOS-Base.repo CentOS-Base.repo.bak
[root@localhost ~]# mv CentOS6-Base-163.repo CentOS-Base.repo
下载的CentOS6-Base-163.repo建议将里面的$releaserver统一修改为6或者5(根据lsb_release -a查看系统版本)

2、yum源更新

[root@localhost ~]# yum clean all && yum makecache && yum update -y

       (2)需要使用代理

在/etc/yum.conf中加入

proxy=http://ip:port

proxy_username=your_proxy_user

proxy_password=your_proxy_password


4.安装Graphite组件
         Graphite的默认安装位置是/opt/graphite/。
①.检查依赖:
wget https://launchpadlibrarian.net/104073214/check-dependencies.py
       python check-dependencies.py
         注:少什么,装什么。


②.安装graphite-web:
wget https://launchpadlibrarian.net/106575888/graphite-web-0.9.10.tar.gz
tar -axf graphite-web-0.9.10.tar.gz -C /usr/local/src/
cd /usr/local/src/graphite-web-0.9.10/
python setup.py install


②.安装whisper:
wget https://launchpadlibrarian.net/106575859/whisper-0.9.10.tar.gz
       tar -axf whisper-0.9.10.tar.gz -C /usr/local/src/
       cd /usr/local/src/whisper-0.9.10/
       python setup.py install


③.安装carbon:
         wget https://launchpadlibrarian.net/106575865/carbon-0.9.10.tar.gz
         tar -axf carbon-0.9.10.tar.gz -C /usr/local/src/
         cd /usr/local/src/carbon-0.9.10/
         python setup.py install

5.配置http:

cp /opt/graphite/examples/example-graphite-vhost.conf /etc/httpd/conf.d/graphite.conf

 vi /etc/httpd/conf.d/graphite.conf


# This needs to be in your server's config somewhere, probably
# the main httpd.conf
# NameVirtualHost *:80


# This line also needs to be in your server's config.
# LoadModule wsgi_module modules/mod_wsgi.so


# You need to manually edit this file to fit your needs.
# This configuration assumes the default installation prefix
# of /opt/graphite/, if you installed graphite somewhere else
# you will need to change all the occurances of /opt/graphite/
# in this file to your chosen install location.


<IfModule !wsgi_module.c>
    LoadModule wsgi_module modules/mod_wsgi.so
</IfModule>


# XXX You need to set this up!
# Read http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGISocketPrefix
WSGISocketPrefix run/wsgi


<VirtualHost *:80>
        ServerName 10.10.10.10
        DocumentRoot "/opt/graphite/webapp"
        ErrorLog /opt/graphite/storage/log/webapp/error.log
        CustomLog /opt/graphite/storage/log/webapp/access.log common


        # I've found that an equal number of processes & threads tends
        # to show the best performance for Graphite (ymmv).
        WSGIDaemonProcess graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120
        WSGIProcessGroup graphite
        WSGIApplicationGroup %{GLOBAL}
        WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphite application-group=%{GLOBAL}


        # XXX You will need to create this file! There is a graphite.wsgi.example
        # file in this directory that you can safely use, just copy it to graphite.wgsi
        WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi 


        Alias /content/ /opt/graphite/webapp/content/
        <Location "/content/">
                SetHandler None
        </Location>


        # XXX In order for the django admin site media to work you
        # must change @DJANGO_ROOT@ to be the path to your django
        # installation, which is probably something like:
        # /usr/lib/python2.6/site-packages/django
        Alias /media/ "@DJANGO_ROOT@/contrib/admin/media/"
        <Location "/media/">
                SetHandler None
        </Location>


        # The graphite.wsgi file has to be accessible by apache. It won't
        # be visible to clients because of the DocumentRoot though.
        <Directory /opt/graphite/conf/>
                Order deny,allow
                Allow from all
        </Directory>


</VirtualHost>
红色字体处要修改为对应IP地址或服务器名


vi /etc/httpd/conf.d/wsgi.conf

LoadModule wsgi_module   modules/mod_wsgi.so
WSGISocketPrefix /var/run/wsgi

6.启动httpd

service httpd start

可能出现的问题:

    httpd启动失败,报错:

(13)Permission denied: httpd: could not open error log file /opt/graphite/storage/log/webapp/error.log.
Unable to open logs

    解决办法:

    原因是因为系统启动了SELINUX,只要关闭SELINUX就好。

    关闭SELINUX
    setenforce 0
    或
    vim /etc/selinux/config
    修改
    SELINUX=enforcing
    改成
    SELINUX=disabled

参考:分享Apache 403 error, (13)Permission denied: access to / denied解决办法


7.配置Graphite
         cd /opt/graphite/conf/
         cp graphite.wsgi.example graphite.wsgi
         cp carbon.conf.example carbon.conf
         cp storage-schemas.conf.example storage-schemas.conf
         vi /opt/graphite/webapp/graphite/settings.py

#Initialize database settings - Old style (pre 1.2)
DATABASE_ENGINE = 'django.db.backends.mysql'# 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
#DATABASE_NAME = ''# Or path to database file if using sqlite3.
#DATABASE_USER = ''# Not used with sqlite3.
#DATABASE_PASSWORD = ''# Not used with sqlite3.
#DATABASE_HOST = ''# Set to empty string for localhost. Not used with sqlite3.
#DATABASE_PORT = ''# Set to empty string for default. Not used with sqlite3.


DATABASES={
     'default': {
          'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql',   'sqlite3' or 'oracle'.
          'NAME': 'test',                      # Or path to database   file if using sqlite3.
          'USER': 'graphite',                      # Not used with   sqlite3.
          'PASSWORD': '123456',                  # Not used with sqlite3.
          'HOST': '10.92.35.114',                        # Set to empty string for localhost. Not used with sqlite3.
          'PORT': '3306',                        # Set to empty string for default. Not used with sqlite3.
      }
}
红色为修改部分,使用的是mysql数据库。

注:确保上面的数据库已存在,没有则手动创建。

附mysql创建方法

连接数据库  mysql -u root (默认root密码是空)

创建数据库 create database test;

创建用户 CREATE USER 'username'@'host' IDENTIFIED BY 'password'; (host用%表示不限)

授权grant select on 数据库.* to 用户名@登录主机 identified by “密码”


8.初始化数据库
         chown -R apache.apache /opt/graphite
         python /opt/graphite/webapp/graphite/manage.py syncdb

可能报缺包,缺啥补啥。


9.启动cabon
         /opt/graphite/bin/carbon-cache.py start
10.访问graphite-web
http://10.92.1.177


11.向Graphite发送数据
         graphite默认接收数据的端口是2003。
         /opt/graphite/examples/example-client.py
[root@localhost  ~]#   /opt/graphite/examples/example-client.py
sending message

--------------------------------------------------------------------------------
system.loadavg_1min 0.03 1397360637
system.loadavg_5min 0.02 1397360637
system.loadavg_15min 0.00 1397360637

对应在浏览器窗口中的显示为在system目录下,loadavg_15min、loadavg_5min、loadavg_1min这三条线就是example-client.py的数据产生的图形。


注意事项:默认显示24小时,因此可能好像没有图形出现。可以点击上图中右箭头选择时间范围。


转载:http://my.oschina.net/fufangchun/blog/232895?fromerr=RjbUoabY#OSC_h2_15


http://chatgpt.dhexx.cn/article/wN4KL5uW.shtml

相关文章

graphite 数据库_大数据存储和分析-IBM DB2和Graphite

在本文中,我们将结合IBM™Persistence API使用IBM DB2作为数据源,描述PCC系统中的数据存储。 此外,我们讨论了如何使用Graphite来检测代码库和工作负载。 最后,我们描述了用于分析数据的工具。 成绩单 IBM DB2和Java Persistence API DB2是IBM关系数据库服务器,已在整个…

graphite安装(一键搞定版)

一、python部分&#xff1a; 0、系统&#xff1a; $ cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) 1、检查系统python是否2.7以上&#xff08;最新graphite需要python至少2.7&#xff09;&#xff1a; $ python -V Python 2.7.5 2、安装pip&#xff1a;…

graphite http api

Render API Graphite web 提供了/render API用来生成图片和获取原始数据。这个API通过查询字符串支持各种参数。参数之间通过&进行分割&#xff0c;如下所示&#xff1a; &namevalue 你可以通过访问 http://GRAPHITE_HOST:GRAPHITE_PORT/render 这个url来确认这个A…

sitespeed+graphite+grafana

最近在看性能UI performance testing 的工具 其中一个是 sitespeed。 sitespeed.io 是 一款可监视和衡量网站前端性能的开源工具。 1. 开 源 2 . 支持事务模 拟 3 . 自动性能分析&#xff0c;形成可视化报 告 4 . 提供的 docker 镜像已搭建完成监控系统&#xff0c;满足…

在Ubuntu18.04使用Docker安装graphite

安装docker apt install docker.io 参照graphite官网&#xff0c;运行docker docker run -d \--name graphite \--restartalways \-p 80:80 \-p 2003-2004:2003-2004 \-p 2023-2024:2023-2024 \-p 8125:8125/udp \-p 8126:8126 \graphiteapp/graphite-statsd 查看docker&am…

graphite

Graphite 是一个用于采集网站实时信息并进行统计的开源项目&#xff0c;可用于采集多种网站服务运行状态信息。Graphite服务平均每分钟有4800次更新操作。实践已经 证实要监测网站发发生什么是非常有用的&#xff0c;它的简单文本协议和绘图功能可以方便地即插即 用的方式用于任…

Graphite详解

Graphite详解 作者&#xff1a;chszs&#xff0c;未经博主允许不得转载。经许可的转载需注明作者和博客主页&#xff1a;http://blog.csdn.net/chszs Graphite是一个开源实时的、显示时间序列度量数据的图形系统。Graphite并不收集度量数据本身&#xff0c;而是像一个数据库&…

时序数据库-Graphite

Graphite就属于一种时序数据库&#xff0c;作用是存储和聚合监控数据并绘制图标&#xff0c;不负责数据的收集。之所以想写一篇关于Graphite的博文主要是因为这是我接触到的另一种新型数据库&#xff0c;其特点和功能让人眼前一亮。但是需要强调的是&#xff0c;这里所谓的时序…

Graphite介绍

Graphite详解 https://www.2cto.com/kf/201603/494435.html Graphite是一个开源实时的、显示时间序列度量数据的图形系统。Graphite并不收集度量数据本身&#xff0c;而是像一个数据库&#xff0c;通过其后端接收度量数据&#xff0c;然后以实时方式查询、转换、组合这些度量数…

http中的XFF(X-Forwarded-For)

详细知识请移步大佬网页

攻防世界-xff_referer

题目 访问题目场景 抓包看看&#xff0c;打开场景&#xff0c;页面提示我们ip必须是123.123.123.123&#xff0c;我们就想到burpsuite抓包&#xff0c;添加上X-Forwarded-For:123.123.123.123 GET / HTTP/1.1 Host: 223.112.5.156:54671 X-Forwarded-For:123.123.123.123 User-…

XCTF2-web xff_referer

xff_referer 题目描述 X老师告诉小宁其实xff和referer是可以伪造的。 进入场景 提示对ip地址进行了限制 根据题目的描述&#xff0c;可以推测是伪造xff和referer。 根据要求构造xff和referer 轻松获得flag xff x-forwarded-for简称XFF&#xff0c;是http协议的一个扩展…

攻防世界-WEB:xff_referer

题目&#xff1a;https://adworld.xctf.org.cn/challenges/problem-set-index?id25&rwNmOdr1679149714756 题目描述&#xff1a;X老师告诉小宁其实xff和referer是可以伪造的。 根据题目描述&#xff0c;那就是考验xff和referer知识。 知识补充&#xff1a; XFF X-Forwarde…

day28 SQL注入HTTP头XFFCOOKIEPOST请求

前言 #知识点&#xff1a; 1、数据请求方式-GET&POST&COOKIE等 2、常见功能点请求方式-用户登录&IP记录等 3、黑盒白盒注入测试要点-SQLMAP注入参数 #补充点&#xff1a; 黑盒测试&#xff1a;功能点分析 1、后台要记录操作访问IP IP要进行代码的获取&#…

NGINX动态XFF黑名单配置

通过XFF地址动态限制访问 方案特点&#xff1a; 无需reloadAPI管理 NGINX PLUS的KEYVAL是可以通过API进行管理的内部可持久化kv存储。 KEYVAL查找XFF地址是否在黑白名单中&#xff0c;来实现访问控制。 KEYVAL存放黑白名单列表&#xff1a; 定义键值为1为白名单定义键值为…

xff-referer伪造ip地址和域名

layout: post title: “xff-referer伪造ip地址和域名” categories: [ctf] tags: [xff referer] 最新版的BurpSuite与以前版本不同&#xff0c;将raw headers hex这些二级导航栏去掉&#xff0c;改在了右侧显示&#xff0c;需要Add伪造ip和域名的时候&#xff0c;在该部分右侧底…

[CTF/网络安全] 攻防世界 xff_referer 解题详析

[CTF/网络安全] 攻防世界 xff_referer 解题详析 XFF及refererXFF格式referer格式姿势总结 题目描述&#xff1a;X老师告诉小宁其实xff和referer是可以伪造的。 XFF及referer X-Forwarded-For&#xff08;简称 XFF&#xff09;是一个 HTTP 请求头部字段&#xff0c;它用于表示 …

XCTF攻防世界练习区-web题-xff_referer

0x08 XFF Referer 【题目描述】 X老师告诉小宁其实xff和referer是可以伪造的。 【目标】 掌握有关X-Forwarded-For和Referer的知识: (1)X-Forwarded-For:简称XFF头,它代表客户端,也就是HTTP的请求端真实的IP,只有在通过了HTTP 代理或者负载均衡服务器时才会添加该项。…

ctf之xff_referer伪造

xff&#xff1a;xff 是http的拓展头部&#xff0c;作用是使Web服务器获取访问用户的IP真实地址&#xff08;可伪造&#xff09;。由于很多用户通过代理服务器进行访问&#xff0c;服务器只能获取代理服务器的IP地址&#xff0c;而xff的作用在于记录用户的真实IP&#xff0c;以及…

Web安全原理剖析(十一)——XFF注入攻击

目录 2.14 XFF注入2.14 XFF注入代码分析 2.14 XFF注入 XFF注入攻击的测试地址&#xff1a;http://127.0.0.1/sqli/xff.php。 X-Forwarded-for简称XFF头&#xff0c;它代表客户端真实的IP&#xff0c;通过修改X-Forwarded-for的值可以伪造客户端IP。通过Burp Suite住区数据包内容…