Change ports for DigitalOcean Agent

March 28, 2017 774 views
DigitalOcean DigitalOcean Articles Nginx

I tried to test the DigitalOcean Agent from this link [https://www.digitalocean.com/community/tutorials/how-to-install-and-use-the-digitalocean-agent-for-additional-droplet-graphs].

I have successfully installed. When I see Graph beta, the message show "No data available for this metric".
As I know, DigitalOcean Agent uses ports 80 and 443 for outgoing data.
Unfortunately I also use 80 and 443 on nginx as the following configuration.

server {
  listen 80;
  server_name myserver.com;
  return 301 https://$host$request_uri;
}

server {

    # SSL configuration
    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    ssl on;

    server_name myserver.com;

    ssl_certificate ...;
    ssl_certificate_key ...;

    location / {
        proxy_pass http://localhost:8181;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

   location ^~ /.well-known/ {
       allow all;
   }

   access_log /var/log/nginx/access.log combined;
}

I would like to know how can I change these two ports for DigitalOcean Agent to use other ports.
Thanks.

2 Answers

I don't think it's possible, neither I think it's the problem.
Nginx/Apache or any other Web server works alongside do-agent very well.
At least in my case, without any modification.

AFAIK by researching agent code, it doesn't host anything on your droplet, it pushes data to DigitalOcean metric server.
So Web servers doesn't do anything with it, or make conflicts.

Make sure do-agent is started. On Ubuntu/CentOS, you can use:

  • sudo systemctl status do-agent

If you see any problem, take a look at logs:

  • sudo nano /var/log/syslog

Search for do-agent logs, and if you can't resolve, contact support. They'll be happy to assist you.
If it isn't running, you can try restarting it:

  • sudo systemctl restart do-agent

It helps in some cases.

@kyawswaaung

From looking at Droplets that I have deployed with doagent active, they are not binding to port 80 or 443, so the agent shouldn't be preventing you from using either port.

Have another answer? Share your knowledge.