글쓴이 : 윤성재 (공작명왕)
E-mail : <gongjak@gmail.com>
Facebook : < https://www.facebook.com/sungjae.yun >
Apache Httpd Plugin
1.Apache Httpd 설치와 시작
< Debian 8 >
sudo apt-get install apache2 sudo service apache2 start sudo service apache2 status
< CentOS 7 >
sudo yum install httpd sudo systemctl start httpd sudo systemctl status httpd
웹서버로 직접 접속하여 확인하고자 한다면 방화벽을 열어줘야만 한다.
GCP 콘솔 -> Compute Engine -> VM instance -> 인스턴스 클릭 -> EDIT -> Firewalls -> Allow HTTP traffic 클릭 -> Save
이제 각 인스턴스의 “External IP”로 웹서버에 접속할 수 있다.
2.사전 준비
Apache plugin 중에 mod_status 가 설치되어 있는지 확인한다.
curl http://localhost:80/server-status?auto
[ 출처: Flickr, gongjak1 ]
< Debian 8 >
GCP 에서는 status.conf 가 기본으로 설치되므로 잘 된다.
< CentOS 7 >
server-status 가 없어서 404 Not Found 가 나온다. server-status 를 설치해주자.
cd /etc/httpd/conf.d/ && sudo curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/httpd/conf.d/status.conf sudo sed -i s/127.0.0.1:/localhost:/g /etc/httpd/conf.d/status.conf sudo sed -i s/127.0.0.1/"127.0.0.1 localhost"/g /etc/httpd/conf.d/status.conf sudo su -c "echo 'LoadModule status_module modules/mod_status.so' > /etc/httpd/conf.modules.d/00-status.conf" sudo systemctl restart httpd
3.plugin 설치
cd /opt/stackdriver/collectd/etc/collectd.d/ && sudo curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/apache.conf
4.Stackdriver Agent 재시작
< Debian 8 >
sudo service stackdriver-agent restart
< CentOS 7 >
sudo systemctl restart stackdriver-agent
5.Monitoring 확인
Monitoring -> Resources -> Instances
각 서버를 클릭해보자. stackdriver agent가 plugin이 정상으로 동작하여 정보를 제대로 가져온다면 Monitoring의 오른쪽 그래프 윗부분에서 다음과 같은 화면을 볼 수 있다.
[ 출처: Flickr, gongjak1 ]
6.현재 모니터링이 가능한 항목
- Active Connections (count): The number of active connections currently attached to Apache.
- Idle Workers (count): The number of idle workers currently attached to Apache.
- Requests (count/s): The number of requests per second serviced by Apache.
- Scoreboard
- Traffic