Cacti

Supported OS Linux

Integration version2.1.0

개요

실시간으로 Cacti에서 메트릭을 받아 다음을 수행할 수 있습니다.

  • Cacti 상태를 시각화하고 모니터링합니다.
  • Cacti 페일오버와 이벤트에 대한 알림을 받습니다.

설정

설치

Cacti 점검은 Datadog 에이전트 패키지에 포함되어 있으므로 메트릭 수집을 시작하려면 먼저 다음을 수행해야 합니다.

  1. librrd 헤더와 라이브러리를 설치합니다.
  2. 파이썬(Python) 바인딩을 rrdtool에 설치합니다.

헤더 및 라이브러리

데비안(Debian)/우분투(Ubuntu):

sudo apt-get install librrd-dev

RHEL/CentOS:

sudo yum install rrdtool-devel

파이썬(Python) 바인딩

다음 명령을 사용해 rrdtool 파이썬 패키지를 에이전트에 추가합니다.

sudo -u dd-agent /opt/datadog-agent/embedded/bin/pip install rrdtool

설정

Datadog 사용자 생성

  1. Cacti 데이터베이스에 읽기 전용 권한이 있는 Datadog 사용자를 생성합니다.

    sudo mysql -e "create user 'datadog'@'localhost' identified by '<MYSQL_PASSWORD>';"
    sudo mysql -e "grant select on cacti.* to 'datadog'@'localhost';"
    
  2. 사용자 및 권한을 확인합니다.

    mysql -u datadog --password=<MYSQL_PASSWORD> -e "show status" | \
    grep Uptime && echo -e "\033[0;32mMySQL user - OK\033[0m" || \
    echo -e "\033[0;31mCannot connect to MySQL\033[0m"
    
    mysql -u datadog --password=<MYSQL_PASSWORD> -D cacti -e "select * from data_template_data limit 1" && \
    echo -e "\033[0;32mMySQL grant - OK\033[0m" || \
    echo -e "\033[0;31mMissing SELECT grant\033[0m"
    
  3. datadog-agent 사용자에게 RRD 파일 액세스 권한을 부여합니다.

    sudo gpasswd -a dd-agent www-data
    sudo chmod -R g+rx /var/lib/cacti/rra/
    sudo su - datadog-agent -c 'if [ -r /var/lib/cacti/rra/ ];
    then echo -e "\033[0;31mdatadog-agent can read the RRD files\033[0m";
    else echo -e "\033[0;31mdatadog-agent can not read the RRD files\033[0m";
    fi'
    

Agent 설정

  1. 에이전트를 설정해 MySQL에 연결하고 cacti.d/conf.yaml 파일을 편집합니다. 사용 가능한 모든 설정 옵션은 샘플 cacti.d/conf.yaml을 참조하세요.

    init_config:
    
    instances:
      ## @param mysql_host - string - required
      ## url of your MySQL database
      #
      - mysql_host: "localhost"
    
        ## @param mysql_port - integer - optional - default: 3306
        ## port of your MySQL database
        #
        # mysql_port: 3306
    
        ## @param mysql_user - string - required
        ## User to use to connect to MySQL in order to gather metrics
        #
        mysql_user: "datadog"
    
        ## @param mysql_password - string - required
        ## Password to use to connect to MySQL in order to gather metrics
        #
        mysql_password: "<MYSQL_PASSWORD>"
    
        ## @param rrd_path - string - required
        ## The Cacti checks requires access to the Cacti DB in MySQL and to the RRD
        ## files that contain the metrics tracked in Cacti.
        ## In almost all cases, you'll only need one instance pointing to the Cacti
        ## database.
        ## The `rrd_path` will probably be `/var/lib/cacti/rra` on Ubuntu
        ## or `/var/www/html/cacti/rra` on any other machines.
        #
        rrd_path: "<CACTI_RRA_PATH>"
    
  2. Restart the Agent.

검증

에이전트 상태 하위 명령을 실행하고 점검 섹션 아래에서 cacti를 찾으세요.

수집한 데이터

메트릭

cacti.hosts.count
(gauge)
The number of hosts monitored by Cacti
Shown as host
cacti.metrics.count
(gauge)
The number of metrics collected from Cacti
cacti.rrd.count
(gauge)
The number of Cacti RRD files
Shown as file
system.disk.free.last
(gauge)
The amount of disk space that is free - last polling value
Shown as byte
system.disk.free.max
(gauge)
The amount of disk space that is free - max polling value
Shown as byte
system.disk.free.min
(gauge)
The amount of disk space that is free - min polling value
Shown as byte
system.disk.used.last
(gauge)
The amount of disk space that is used - last polling value
Shown as byte
system.disk.used.max
(gauge)
The amount of disk space that is used - max polling value
Shown as byte
system.disk.used.min
(gauge)
The amount of disk space that is used - min polling value
Shown as byte
system.load.1.last
(gauge)
The average system load over one minute - last polling value
system.load.1.max
(gauge)
The average system load over one minute - max polling value
system.load.1.min
(gauge)
The average system load over one minute - min polling value
system.load.15.last
(gauge)
The average system load over 15 minute - last polling value
system.load.15.max
(gauge)
The average system load over 15 minute - max polling value
system.load.15.min
(gauge)
The average system load over 15 minute - min polling value
system.load.5.last
(gauge)
The average system load over five minute - last polling value
system.load.5.max
(gauge)
The average system load over five minute - max polling value
system.load.5.min
(gauge)
The average system load over five minute - min polling value
system.mem.buffered.last
(gauge)
The amount of physical RAM used for file buffers - last polling value
Shown as byte
system.mem.buffered.max
(gauge)
The amount of physical RAM used for file buffers - max polling value
Shown as byte
system.mem.buffered.min
(gauge)
The amount of physical RAM used for file buffers - min polling value
Shown as byte
system.ping.latency
(gauge)
The system ping latency - avg polling value
Shown as millisecond
system.ping.latency.max
(gauge)
The system ping latency - max polling value
Shown as millisecond
system.proc.running.last
(gauge)
The number of processes running - last polling value
Shown as process
system.proc.running.max
(gauge)
The number of processes running - max polling value
Shown as process
system.proc.running.min
(gauge)
The number of processes running - min polling value
Shown as process
system.swap.free.max
(gauge)
The amount of free swap space - max polling value
Shown as byte
system.users.current.last
(gauge)
The number of logged in users - last polling value
system.users.current.max
(gauge)
The number of logged in users - max polling value
system.users.current.min
(gauge)
The number of logged in users - min polling value

로그 수집

  1. Datadog 에이전트에서 로그 수집은 기본적으로 사용하지 않도록 설정되어 있습니다. datadog.yaml 파일에서 로그 수집을 사용하도록 설정합니다.

    logs_enabled: true
    
  2. 이 설정 블록을 cacti.d/conf.yaml 파일에 추가하여 Cacti 로그 수집을 시작합니다.

    logs:
      - type: file
        path: /opt/cacti/log/cacti.log
        source: cacti
    

    환경에 따라 path 파라미터 값을 변경합니다. 사용 가능한 모든 설정 옵션은 샘플 cacti.d/conf.yaml을 참조하세요.

  3. Restart the Agent.

이벤트

Cacti 점검은 이벤트를 포함하지 않습니다.

서비스 검사

Cacti 점검은 서비스 점검을 포함하지 않습니다.

트러블슈팅

알려진 문제

이 통합에서 사용하는 파이썬(Python) 라이브러리는 특정 상황에서 메모리를 유출합니다. 메모리 유출이 있는 경우 다른 방법은 rrdtool 대신 python-rrdtool 패키지를 설치하는 것입니다. 이 이전 버전의 패키지는 유지관리되지 않으므로 이 통합에서 공식적으로 지원되지 않지만 다른 사용자들이 메모리 문제를 해결할 수 있도록 도왔습니다.

이 메모리 유출을 추적하기 위한 Github 문제 조사가 현재 진행 중입니다.

도움이 필요하신가요? Datadog 지원팀에 문의하세요.