{"id":724,"date":"2024-02-05T12:58:09","date_gmt":"2024-02-05T04:58:09","guid":{"rendered":"https:\/\/play.datalude.com\/blog\/?p=724"},"modified":"2024-02-12T16:25:00","modified_gmt":"2024-02-12T08:25:00","slug":"changing-default-port-for-grafana-agent","status":"publish","type":"post","link":"https:\/\/play.datalude.com\/blog\/2024\/02\/changing-default-port-for-grafana-agent\/","title":{"rendered":"Changing default port for grafana agent"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This was much more difficult than it should have been. Grafana agent runs on port 9090 and 9091, so when I installed it on a server where nginx was using those ports, I got an error, not unreasonably.<br><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">error creating the agent server entrypoint\" err=\"creating HTTP listener: listen tcp 127.0.0.1:9090: bind: address already in use<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Fair enough. But\u2002how to change it? I looked through the \/etc\/grafana-agent.yaml file but there was nothing in there. I searched the grafana docs and forums. Nothing. I searched google and asked phind for suggestions, which irritatingly told me to make several changes for files and variables that didn't exist. <br><br>I looked for the systemd service file, which wasn't in the normal places \/etc\/systemd\/system or \/lib\/systemd\/system\/ but in a further subdir of \/etc\/systemd\/system\/multi-user.target.wants\/ and \/usr\/lib\/systemd\/system\/multi-user.target.wants\/<br><br>OK, so now a clue. That contained a line EnvironmentFile=\/etc\/default\/grafana-agent, and that's where you need to edit the ports. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Any user defined arguments<br>CUSTOM_ARGS=\"-server.http.address=127.0.0.1:9090 -server.grpc.address=127.0.0.1:9091\"<br><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">So hopefully that will save someone some time, as I wasted an hour on it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This was much more difficult than it should have been. Grafana agent runs on port 9090 and 9091, so when I installed it on a server where nginx was using those ports, I got an error, not unreasonably. error creating the agent server entrypoint\" err=\"creating HTTP listener: listen tcp 127.0.0.1:9090: bind: address already in use &#8230; <a title=\"Changing default port for grafana agent\" class=\"read-more\" href=\"https:\/\/play.datalude.com\/blog\/2024\/02\/changing-default-port-for-grafana-agent\/\" aria-label=\"Read more about Changing default port for grafana agent\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1,4],"tags":[],"class_list":["post-724","post","type-post","status-publish","format-standard","hentry","category-it","category-linux"],"_links":{"self":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts\/724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/comments?post=724"}],"version-history":[{"count":0,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/posts\/724\/revisions"}],"wp:attachment":[{"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/media?parent=724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/categories?post=724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/play.datalude.com\/blog\/wp-json\/wp\/v2\/tags?post=724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}