httpd – JGuru https://jguru.fi When you need a guru Thu, 28 May 2020 01:23:46 +0000 en-US hourly 1 https://jguru.fi/wp-content/uploads/2015/01/javaguru_icon-54c89537v1_site_icon-32x32.png httpd – JGuru https://jguru.fi 32 32 83852845 Monitoring Apache HTTPd with New Relic https://jguru.fi/monitoring-apache-httpd-with-new-relic.html?utm_source=rss&utm_medium=rss&utm_campaign=monitoring-apache-httpd-with-new-relic https://jguru.fi/monitoring-apache-httpd-with-new-relic.html#respond Fri, 28 Aug 2015 07:18:47 +0000 http://javaguru.fi/?p=124 When figuring out what’s wrong with a sites performance it’s important to get facts about every aspect and component involved with that site. Apache is quite often used in front of java applications and it’s the app server for php applications. Bad apache configuration can make a site seem sluggish even when there are plenty of other resources available so it’s important to see what’s going on here. From the first screen of Apache HTTPd plugin you’ll get a nice overview of all your monitored apaches.

New Relic Plugins Apache Listing

Drilling down to a single server overview shows request velocity, cpu load, busy/idle workers and even bytes sent over time.

New Relic Plugins Apache Overview

Going to throughtput shows throughtput details over time.

New Relic Plugins Apache Throughtput

Workers section shows you what is happening with the workers. If you have a lot of busy workers you can see in what state their are and that might provide some insight to what is going on.

New Relic Plugins Apache Workers

Installing Apache HTTPd agent for New Relic

1) I’m using the MeetMe New Relic Agent to monitor Apache HTTPd. It’s written in python and we’ll need to install pip. The following is using the Ubuntu python-pip package. You can find alternative install methods from pip docs.

apt-get install python-pip libyaml-dev python-dev

2) Next use pip to install newrelic-plugin-agent. When I ran it I got some errors but it still worked.

pip install newrelic-plugin-agent

3) Next we’ll need to create the configuration file for the agent. You can start by copying /opt/newrelic-plugin-agent/newrelic-plugin-agent.cfg or just use what I have posted below. The first thing you need is to set license_key. You can find your license key from your account settings page on rpm.newrelic.com. The second one is to add apache_httpd configuration. You can add multiple httpds to monitor.

cat - <<EOF>> /etc/newrelic/newrelic-plugin-agent.cfg
%YAML 1.2
---
Application:
 license_key: YOUR_LICENSE_KEY
 wake_interval: 60
 #newrelic_api_timeout: 10
 #proxy: http://localhost:8080

 apache_httpd:
  - name: localhost
    scheme: http
    host: localhost
    verify_ssl_cert: true
    port: 80
    path: /server-status

Daemon:
 user: newrelic
 pidfile: /var/run/newrelic/newrelic-plugin-agent.pid

Logging:
 formatters:
   verbose:
     format: '%(levelname) -10s %(asctime)s %(process)-6d %(processName) -15s %(threadName)-10s %(name) -45s %(funcName) -25s L%(lineno)-6d: %(message)s'
 handlers:
   file:
     class : logging.handlers.RotatingFileHandler
     formatter: verbose
     filename: /var/log/newrelic/newrelic-plugin-agent.log
     maxBytes: 10485760
     backupCount: 3
 loggers:
   newrelic_plugin_agent:
     level: INFO
     propagate: True
     handlers: [console, file]
   requests:
     level: ERROR
     propagate: True
     handlers: [console, file]
EOF

4) Make sure you have enabled mod_status in your apache and you’ve allowed access from the host your agent is running if it’s not running in the same host as your apache.

5) Then we need to add a init script for the newrelic-plugin-agent. There’s one under /opt/newrelic-plugin-agent but for me it was incomplete file so I just downloaded the one from github.

wget https://raw.githubusercontent.com/MeetMe/newrelic-plugin-agent/master/etc/init.d/newrelic-plugin-agent.deb
mv newrelic-plugin-agent.deb /etc/init.d/newrelic-plugin-agent
chmod 755 /etc/init.d/newrelic-plugin-agent
update-rc.d newrelic-plugin-agent defaults

Now you can start the newrelic-plugin-agent with

service newrelic-plugin-agent start

Now in few minutes you should see your Apache HTTPd server(s) listed under Plugins HTTPd on rpm.newrelic.com.

]]>
https://jguru.fi/monitoring-apache-httpd-with-new-relic.html/feed 0 124
Monitoring Nginx with New Relic https://jguru.fi/monitoring-nginx-new-relic.html?utm_source=rss&utm_medium=rss&utm_campaign=monitoring-nginx-new-relic Wed, 29 Apr 2015 03:20:41 +0000 http://javaguru.fi/?p=100 Apache HTTPd has always been my goto httpd, reverse proxy and load balancer but lately I’ve grown more interested in Nginx. It’s very high performance and lightweight not to mention easy to configure. Of course with my currently a single Nginx I wanted to see how could I hook it up my monitoring. Turns our there’s a New Relic agent directly from Nginx.

New Relic Plugins Nginx Listing

From the overview you can see the number of active and idle connections as well as the request rate.

New Relic Plugins Nginx Overview

From connections you’ll even more connection details. With very little connections and requests my graphs are currently slightly boring. In addition to connection details you can find more details about requests, upstreams, servers and cache.

New Relic Plugins Nginx Connections
Installing New Relic Monitoring Agent for Nginx

1) First you need to add the Ubuntu package repository for Nginx. If you’ve done this already when you installed Nginx you can skip to next step. If you are not using Ubuntu 14.04 like I am you can find the other Linux packages from Nginx website.

wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key

cat - <<-EOF >> /etc/apt/sources.list.d/nginx.list
deb http://nginx.org/packages/ubuntu/ trusty nginx
deb-src http://nginx.org/packages/ubuntu/ trusty nginx
EOF

apt-get update

2) Next you need to install the Nginx New Relic Agent

apt-get install nginx-nr-agent

3) Next you’ll need to edit the agent configuration file in /etc/nginx-nr-agent/nginx-nr-agent.ini. You need to add your license key which you can find from your account settings page on rpm.newrelic.com.

newrelic_license_key=YOUR_LICENSE_KEY

Additionally you need to add a new source which points to your Nginx status url.

[source1]
name=localhost
url=http://localhost/nginx_stub_status

4) You’ll need to add a server block to Nginx for the status. Since I had very simple configuration in my Nginx I just added the following to /etc/nginx/sites-enabled/default

server {
   listen 127.0.0.1:80;
   server_name localhost;

   location = /nginx_stub_status {
     stub_status on;
     allow 127.0.0.1;
     deny all;
   }
}

5) Last thing you need to do is reload Nginx and start the Nginx New Relic Agent.

service nginx reload
service nginx-nr-agent start

Now in few minutes you should start seeing your Nginx server listed under Plugins Nginx on rpm.newrelic.com.

]]>
100