Squid

Supported OS Linux Windows Mac OS

통합 버전4.1.0

개요

Squid는 네트워크에서 클라이언트와 서버 사이의 중개 역할을 하는 오픈 소스 캐싱 및 포워딩 웹 프록시 서버입니다. 클라이언트가 서버의 웹사이트, 파일, 기타 콘텐츠 등 다양한 인터넷 리소스에 액세스할 수 있도록 하는 게이트웨이 역할을 합니다.

본 통합으로 Squid 로그에 대한 보강 및 시각화 기능을 제공합니다. 즉시 사용 가능한 대시보드와 탐지 규칙을 통해 Squid 로그 분석에 관한 자세한 인사이트를 시각화하여 탐지 및 대응 기능을 향상합니다.

또한 다음 사항에 관한 사전 알림을 위해 미리 설정된 모니터가 포함되어 있습니다.

  1. 높은 서버 오류 발생률
  2. CPU 사용량 초과
  3. 레이턴시가 긴 요청
  4. 높은 클라이언트 HTTP 오류 발생률

이 점검은 Datadog Agent를 통해 Cache Manager의 Squid 메트릭을 모니터링합니다.

설정

설치

Agent Squid 점검은 Datadog Agent 패키지에 포함되어 있습니다. Squid 서버에 추가 설치가 필요하지 않습니다.

설정

호스트

호스트에서 실행 중인 에이전트에 이 점검을 구성하는 방법:

메트릭 수집
  1. Agent 구성 디렉터리 루트의 conf.d/ 폴더에 있는 squid.d/conf.yaml 파일을 편집합니다. 사용 가능한 모든 구성 옵션은 샘플 squid.d/conf.yaml을 참조하세요.

  2. 에이전트를 다시 시작합니다.

로그 수집

에이전트 버전 > 6.0에서 사용 가능

  1. 로그 수집은 Datadog 에이전트에서 기본적으로 비활성화되어 있습니다. datadog.yaml 파일에서 활성화합니다.

    logs_enabled: true
    
  2. squid.d/conf.yaml 파일의 하단에서 이 구성 블록의 주석 처리를 제거하고 편집합니다.

    logs:
      - type: file
        path: /var/log/squid/cache.log
        service: "<SERVICE-NAME>"
        source: squid
      - type: file
        path: /var/log/squid/access.log
        service: "<SERVICE-NAME>"
        source: squid
    

    pathservice 파라미터 값을 변경하고 환경에 맞게 설정합니다.

  3. 에이전트를 다시 시작합니다.

컨테이너화된 환경

컨테이너화된 환경의 경우 자동탐지 통합 템플릿에 아래 파라미터를 적용하는 방법이 안내되어 있습니다.

메트릭 수집
파라미터
<INTEGRATION_NAME>squid
<INIT_CONFIG>비어 있음 또는 {}
<INSTANCE_CONFIG>{"name": "<SQUID_INSTANCE_NAME>", "host": "%%host%%", "port":"3128"}
로그 수집

에이전트 버전 > 6.0에서 사용 가능

Datadog 에이전트에서 로그 수집은 기본값으로 비활성화되어 있습니다. 이를 활성화하려면 쿠버네티스(Kubernetes) 로그 수집을 참조하세요.

파라미터
<LOG_CONFIG>{"source": "squid", "service": "<YOUR_APP_NAME>"}

검증

Agent의 상태 하위 명령을 실행하고 Checks 섹션에서 squid를 찾으세요.

수집한 데이터

로그

Squid 통합은 액세스 및 캐시 로그를 수집합니다.

지원되는 액세스 로그 형식

이름형식 사양
squid%ts.%03tu %6tr %>a %Ss/%03>Hs %<st %rm %ru %[un %Sh/%<a %mt
공통%>a - %[un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st %Ss:%Sh
결합%>a - %[un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh

자세한 내용은 Squid 로그 형식을 참조하세요.

참고: 기본 logformat 유형은 squid입니다. /etc/squid/squid.conf에서 지원되는 로그 형식을 업데이트한 다음 Squid를 다시 시작할 수 있습니다.

logformatcombined 유형을 사용하려면 /etc/squid/squid.conf 파일에 다음 줄을 추가합니다.

logformat combined   %>a %[ui %[un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
access_log /var/log/squid/access.log combined

그런 다음 아래 명령으로 squid 서비스를 다시 시작합니다.

sudo systemctl restart squid

참고:

  • Top Avg Request Duration by URL Host 패널은 logformatsquid 유형이 구성된 경우에만 로드됩니다.
  • Top BrowsersTop HTTP Referrer 패널은 logformatcombined 유형이 구성된 경우에만 로드됩니다.

메트릭

squid.cachemgr.aborted_requests
(gauge)
The number of server-side HTTP requests aborted due to client-side aborts.
Shown as request
squid.cachemgr.cd.kbytes_recv
(gauge)
The amount of traffic received from neighbors in Cache Digest messages.
Shown as kibibyte
squid.cachemgr.cd.kbytes_sent
(gauge)
The amount of traffic sent to neighbors in Cache Digest messages.
Shown as kibibyte
squid.cachemgr.cd.local_memory
(gauge)
The amount of memory used to store Squid’s own Cache Digest.
Shown as kibibyte
squid.cachemgr.cd.memory
(gauge)
The amount of memory used by enabling the Cache Digests’ feature.
Shown as kibibyte
squid.cachemgr.cd.msgs_recv
(gauge)
The number of Cache Digest messages received from neighbors.
Shown as message
squid.cachemgr.cd.msgs_sent
(gauge)
The number of Cache Digest messages sent to neighbors.
Shown as message
squid.cachemgr.cd.times_used
(gauge)
The number of times Cache Digests resulted in the selection of a neighbor as the next-hop for a cache miss.
squid.cachemgr.client_http.errors
(gauge)
The number of client transactions that resulted in an error.
Shown as error
squid.cachemgr.client_http.hit_kbytes_out
(gauge)
The amount of traffic sent to clients in responses that are cache hits
Shown as kibibyte
squid.cachemgr.client_http.hits
(gauge)
The number of cache hits in response to client requests.
Shown as hit
squid.cachemgr.client_http.kbytes_in
(gauge)
The amount of traffic received from clients in their requests.
Shown as kibibyte
squid.cachemgr.client_http.kbytes_out
(gauge)
The amount of traffic sent to clients in responses.
Shown as kibibyte
squid.cachemgr.client_http.requests
(gauge)
The number of HTTP requests received from clients
Shown as request
squid.cachemgr.cpu_time
(gauge)
The amount of CPU used by squid, as reported by getrusage( ).
Shown as percent
squid.cachemgr.icp.kbytes_recv
(gauge)
The amount of traffic received in all ICP messages, including both queries and replies.
Shown as kibibyte
squid.cachemgr.icp.kbytes_sent
(gauge)
The amount of traffic sent in all ICP messages, including both queries and replies.
Shown as kibibyte
squid.cachemgr.icp.pkts_recv
(gauge)
The number of ICP messages received from neighbors, including both queries and replies
Shown as message
squid.cachemgr.icp.pkts_sent
(gauge)
The number of ICP messages sent to neighbors. This includes both queries and replies but doesn’t include HTCP messages.
Shown as message
squid.cachemgr.icp.q_kbytes_recv
(gauge)
The amount of traffic received from neighbors in ICP queries.
Shown as kibibyte
squid.cachemgr.icp.q_kbytes_sent
(gauge)
The amount of traffic sent to neighbors in ICP queries.
Shown as kibibyte
squid.cachemgr.icp.queries_recv
(gauge)
The number of ICP queries received from neighbors.
Shown as query
squid.cachemgr.icp.queries_sent
(gauge)
The number of ICP queries sent to neighbors.
Shown as query
squid.cachemgr.icp.query_timeouts
(gauge)
The number of times that Squid timed out waiting for ICP replies to arrive.
Shown as error
squid.cachemgr.icp.r_kbytes_recv
(gauge)
The amount of traffic received from neighbors in ICP replies.
Shown as kibibyte
squid.cachemgr.icp.r_kbytes_sent
(gauge)
The amount of traffic sent to neighbors in ICP replies.
Shown as kibibyte
squid.cachemgr.icp.replies_queued
(gauge)
The number of times Squid queued an ICP message after the initial attempt to send failed.
Shown as message
squid.cachemgr.icp.replies_recv
(gauge)
The number of ICP replies received from neighbors.
Shown as response
squid.cachemgr.icp.replies_sent
(gauge)
The number of ICP replies sent to neighbors.
Shown as response
squid.cachemgr.icp.times_used
(gauge)
The number of times ICP resulted in the selection of a neighbor as the next-hop for a cache miss.
squid.cachemgr.page_faults
(gauge)
The number of (major) page faults as reported by getrusage( ).
Shown as fault
squid.cachemgr.select_loops
(gauge)
The number of times Squid called select( ) or poll( ) in the main I/O loop.
Shown as item
squid.cachemgr.server.all.errors
(gauge)
The number of server-side requests (all protocols) that resulted in some kind of error.
Shown as error
squid.cachemgr.server.all.kbytes_in
(gauge)
The amount of traffic read from the server-side for all protocols.
Shown as kibibyte
squid.cachemgr.server.all.kbytes_out
(gauge)
The amount of traffic written to origin servers and/or neighbor caches for server-side requests.
Shown as kibibyte
squid.cachemgr.server.all.requests
(gauge)
The number of requests forwarded to origin servers (or neighbor caches) for all server-side protocols.
Shown as request
squid.cachemgr.server.ftp.errors
(gauge)
The number of requests sent to FTP servers that resulted in an error.
Shown as error
squid.cachemgr.server.ftp.kbytes_in
(gauge)
The amount of traffic read from FTP servers, including control channel traffic.
Shown as kibibyte
squid.cachemgr.server.ftp.kbytes_out
(gauge)
The amount of traffic written to FTP servers, including control channel traffic.
Shown as kibibyte
squid.cachemgr.server.ftp.requests
(gauge)
The number of requests sent to FTP servers.
Shown as request
squid.cachemgr.server.http.errors
(gauge)
The number of server-side HTTP requests that resulted in an error.
Shown as error
squid.cachemgr.server.http.kbytes_in
(gauge)
The amount of traffic read from HTTP origin servers and neighbor caches.
Shown as kibibyte
squid.cachemgr.server.http.kbytes_out
(gauge)
The amount of traffic written to HTTP origin servers and neighbor caches.
Shown as kibibyte
squid.cachemgr.server.http.requests
(gauge)
The number of server-side requests to HTTP servers, including neighbor caches.
Shown as request
squid.cachemgr.server.other.errors
(gauge)
The number of Gopher, WAIS, and SSL requests that resulted in an error.
Shown as error
squid.cachemgr.server.other.kbytes_in
(gauge)
The amount of traffic read from Gopher, WAIS, and SSL servers.
Shown as kibibyte
squid.cachemgr.server.other.kbytes_out
(gauge)
The amount of traffic written to Gopher, WAIS, and SSL servers.
Shown as kibibyte
squid.cachemgr.server.other.requests
(gauge)
The number of “other” server-side requests. Currently, the other protocols are Gopher, WAIS, and SSL.
Shown as request
squid.cachemgr.swap.files_cleaned
(gauge)
The number of orphaned cache files removed by the periodic cleanup procedure.
Shown as file
squid.cachemgr.swap.ins
(gauge)
The number of objects (swap files) read from disk.
Shown as file
squid.cachemgr.swap.outs
(gauge)
The number of objects (swap files) saved to disk.
Shown as file
squid.cachemgr.unlink.requests
(gauge)
The number of unlink requests given to the (optional) unlinkd process.
Shown as request

이벤트

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

서비스 점검

squid.can_connect

Returns Critical if the Agent cannot connect to the Squid URL, OK otherwise.

Statuses: ok, critical

트러블슈팅

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