{"id":29294,"date":"2025-06-17T15:42:23","date_gmt":"2025-06-17T10:12:23","guid":{"rendered":"https:\/\/opstree.com\/blog\/?p=29294"},"modified":"2025-07-26T12:11:44","modified_gmt":"2025-07-26T06:41:44","slug":"supervisor-process-monitoring-with-open-telemetry","status":"publish","type":"post","link":"https:\/\/opstree.com\/blog\/2025\/06\/17\/supervisor-process-monitoring-with-open-telemetry\/","title":{"rendered":"Implementing Supervisor Process Monitoring with Open Telemetry"},"content":{"rendered":"<p><span class=\"TextRun SCXW193935938 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW193935938 BCX0\">In this blog, <\/span><span class=\"NormalTextRun SCXW193935938 BCX0\">I\u2019ll<\/span><span class=\"NormalTextRun SCXW193935938 BCX0\"> Walk you through how I set up a custom monitoring system for <\/span><\/span><span class=\"TextRun SCXW193935938 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW193935938 BCX0\">Supervisor-managed processes<\/span><\/span><span class=\"TextRun SCXW193935938 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW193935938 BCX0\"> like <\/span><\/span><span class=\"TextRun SCXW193935938 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW193935938 BCX0\">Nginx and Apache2<\/span><\/span><span class=\"TextRun SCXW193935938 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW193935938 BCX0\">, <\/span><span class=\"NormalTextRun SCXW193935938 BCX0\">this<\/span><span class=\"NormalTextRun SCXW193935938 BCX0\"> setup will allow you to track the health and performance of processes running under Supervisor in real time.<\/span><\/span><span class=\"EOP SCXW193935938 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><!--more--><\/p>\n<div class=\"toc-container\" style=\"background: #f8f9fa; border-left: 4px solid #4a6ee0; border-radius: 4px; padding: 20px 25px; margin: 30px 0; font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;\">\n<h2 style=\"margin-top: 0; color: #2c3e50; border-bottom: 2px solid #eaeaea; padding-bottom: 12px;\">Table of Contents<\/h2>\n<ol style=\"padding-left: 20px; margin: 0;\">\n<li style=\"margin-bottom: 12px;\"><a style=\"color: #4a6ee0; text-decoration: none; font-weight: 500;\" href=\"#introduction\">Introduction to Supervisor Monitoring<\/a><\/li>\n<li style=\"margin-bottom: 12px;\"><a style=\"color: #4a6ee0; text-decoration: none; font-weight: 500;\" href=\"#what-is-supervisor\">What is Supervisor?<\/a><\/li>\n<li style=\"margin-bottom: 12px;\"><a style=\"color: #4a6ee0; text-decoration: none; font-weight: 500;\" href=\"#step1\">Setup Guide<\/a>\n<ul style=\"padding-left: 20px; margin-top: 8px;\">\n<li style=\"margin-bottom: 8px;\"><a style=\"color: #6c757d; text-decoration: none;\" href=\"#step1\">Step 1: Install Supervisor<\/a><\/li>\n<li style=\"margin-bottom: 8px;\"><a style=\"color: #6c757d; text-decoration: none;\" href=\"#step2\">Step 2: Configure Supervisor (Nginx &amp; Apache)<\/a><\/li>\n<li style=\"margin-bottom: 8px;\"><a style=\"color: #6c757d; text-decoration: none;\" href=\"#step3\">Step 3: Reload Supervisor &amp; Start Services<\/a><\/li>\n<li style=\"margin-bottom: 8px;\"><a style=\"color: #6c757d; text-decoration: none;\" href=\"#step4\">Step 4: Check Service Status<\/a><\/li>\n<\/ul>\n<\/li>\n<li style=\"margin-bottom: 12px;\"><a style=\"color: #4a6ee0; text-decoration: none; font-weight: 500;\" href=\"#monitoring-system\">Monitoring System Setup<\/a>\n<ul style=\"padding-left: 20px; margin-top: 8px;\">\n<li style=\"margin-bottom: 8px;\"><a style=\"color: #6c757d; text-decoration: none;\" href=\"#step5\">Step 5: Create Python Monitoring Script<\/a><\/li>\n<li style=\"margin-bottom: 8px;\"><a style=\"color: #6c757d; text-decoration: none;\" href=\"#step6\">Step 6: Install Required Libraries<\/a><\/li>\n<li style=\"margin-bottom: 8px;\"><a style=\"color: #6c757d; text-decoration: none;\" href=\"#step7\">Step 7: Run the Script<\/a><\/li>\n<li style=\"margin-bottom: 8px;\"><a style=\"color: #6c757d; text-decoration: none;\" href=\"#step8\">Step 8: Access Prometheus Metrics<\/a><\/li>\n<li style=\"margin-bottom: 8px;\"><a style=\"color: #6c757d; text-decoration: none;\" href=\"#step9\">Step 9: Visualize Metrics in Grafana<\/a><\/li>\n<\/ul>\n<\/li>\n<li style=\"margin-bottom: 12px;\"><a style=\"color: #4a6ee0; text-decoration: none; font-weight: 500;\" href=\"#conclusion\">Conclusion<\/a><\/li>\n<\/ol>\n<\/div>\n<h2 id=\"what-is-supervisor\"><span class=\"TextRun SCXW75465776 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW75465776 BCX0\">What Is S<\/span><span class=\"NormalTextRun SCXW75465776 BCX0\">upervisor?<\/span> <\/span><span class=\"EOP SCXW75465776 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/h2>\n<p><span class=\"TextRun SCXW139954173 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW139954173 BCX0\">Supervisor is a process control system that allows users to manage and <\/span><span class=\"NormalTextRun SCXW139954173 BCX0\">monitor<\/span> <span class=\"NormalTextRun SCXW139954173 BCX0\">numerous<\/span><span class=\"NormalTextRun SCXW139954173 BCX0\"> processes.<\/span><\/span><span class=\"EOP SCXW139954173 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/p>\n<h4 id=\"step1\"><span class=\"TextRun Highlight SCXW259406645 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW259406645 BCX0\">Step 1<\/span><\/span><span class=\"TextRun SCXW259406645 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW259406645 BCX0\"> Install Supervisor<\/span><\/span><span class=\"EOP SCXW259406645 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/h4>\n<ul>\n<li><span class=\"TextRun SCXW213762295 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW213762295 BCX0\">you can install it using this command:<\/span><\/span><span class=\"EOP SCXW213762295 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<\/ul>\n<div class=\"wp-block-code\" style=\"background: #1e1e1e; color: #d4d4d4; border-radius: 8px; overflow: hidden; margin: 20px 0; font-family: 'Fira Code','Courier New',monospace;\">\n<pre style=\"padding: 16px; margin: 0; overflow-x: auto; line-height: 1.5; font-size: 15px;\"><span style=\"color: #dcdcaa;\">sudo apt update<\/span>\u00a0\r\n<span style=\"color: #dcdcaa;\">sudo apt install supervisor<\/span><\/pre>\n<\/div>\n<h4 id=\"step2\"><span class=\"TextRun Highlight SCXW68868668 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW68868668 BCX0\">Step 2<\/span><\/span><span class=\"TextRun SCXW68868668 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW68868668 BCX0\"> Configure Supervisor for Nginx and Apache<\/span><\/span><span class=\"EOP SCXW68868668 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/h4>\n<ul>\n<li><span class=\"TextRun SCXW259550308 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW259550308 BCX0\">Once Supervisor is installed, <\/span><span class=\"NormalTextRun SCXW259550308 BCX0\">you\u2019ll<\/span><span class=\"NormalTextRun SCXW259550308 BCX0\"> need to create configuration files for Nginx and Apache.<\/span><\/span><span class=\"EOP SCXW259550308 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><strong><span class=\"TextRun Highlight SCXW123253811 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2Themed SCXW123253811 BCX0\">For\u00a0<\/span> <span class=\"NormalTextRun ContextualSpellingAndGrammarErrorV2Themed SCXW123253811 BCX0\">Nginx<\/span><\/span><span class=\"EOP SCXW123253811 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/strong><\/p>\n<ul>\n<li><span class=\"TextRun SCXW152706215 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW152706215 BCX0\">Create a file in this path in this format\u00a0\u00a0 \/etc\/supervisor\/<\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW152706215 BCX0\">conf.d<\/span><span class=\"NormalTextRun SCXW152706215 BCX0\">\/<\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW152706215 BCX0\">nginx.conf<\/span><span class=\"NormalTextRun SCXW152706215 BCX0\">\/.<\/span><\/span><span class=\"EOP SCXW152706215 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<\/ul>\n<h5><span class=\"TextRun SCXW260186023 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW260186023 BCX0\">One-line Summary for NGINX (Supervisor Configuration)<\/span><\/span><span class=\"EOP SCXW260186023 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/h5>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><span class=\"TextRun SCXW136199097 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW136199097 BCX0\">This Supervisor configuration enables effective management of the NGINX service by running it in the foreground, ensuring automatic startup, handling unexpected failures through automatic restarts, and directing logs to specified output and error files.<\/span><\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-code\" style=\"background: #1e1e1e; color: #d4d4d4; border-radius: 8px; overflow: hidden; margin: 20px 0; font-family: 'Fira Code','Courier New',monospace;\">\n<pre style=\"padding: 16px; margin: 0; overflow-x: auto; line-height: 1.5; font-size: 15px;\"><span style=\"color: #ff9900;\"><span class=\"NormalTextRun CommentHighlightClicked SCXW102655790 BCX0\">[<\/span><span class=\"NormalTextRun SpellingErrorV2Themed CommentHighlightClicked SCXW102655790 BCX0\">program:nginx<\/span><span class=\"NormalTextRun CommentHighlightClicked SCXW102655790 BCX0\">]<\/span><\/span>\r\n<span class=\"TextRun SCXW3464452 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentHighlightClicked SCXW3464452 BCX0\"><span style=\"color: #3366ff;\">command=<\/span><span style=\"color: #00ff00;\">\/<\/span><\/span><span style=\"color: #00ff00;\"><span class=\"NormalTextRun SpellingErrorV2Themed CommentHighlightClicked SCXW3464452 BCX0\">usr<\/span><span class=\"NormalTextRun CommentHighlightClicked SCXW3464452 BCX0\">\/<\/span><span class=\"NormalTextRun SpellingErrorV2Themed CommentHighlightClicked SCXW3464452 BCX0\">sbin<\/span><span class=\"NormalTextRun CommentHighlightClicked SCXW3464452 BCX0\">\/nginx -g \"daemon off;\"<\/span><\/span><\/span><span class=\"EOP CommentHighlightClicked SCXW3464452 BCX0\" data-ccp-props=\"{}\">\u00a0<\/span>\r\n<span class=\"TextRun SCXW7860072 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SpellingErrorV2Themed CommentHighlightClicked SCXW7860072 BCX0\" style=\"color: #99cc00;\">autostart<\/span><span class=\"NormalTextRun CommentHighlightClicked SCXW7860072 BCX0\"><span style=\"color: #99cc00;\">=<\/span>true<\/span><\/span><span class=\"EOP CommentHighlightClicked SCXW7860072 BCX0\" data-ccp-props=\"{}\">\u00a0<\/span>\r\n<span class=\"TextRun SCXW75869062 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SpellingErrorV2Themed CommentHighlightClicked SCXW75869062 BCX0\" style=\"color: #00ccff;\">autorestart<\/span><span class=\"NormalTextRun CommentHighlightClicked SCXW75869062 BCX0\"><span style=\"color: #00ccff;\">=<\/span><span style=\"color: #33cccc;\">true<\/span><\/span><\/span><span class=\"EOP CommentHighlightClicked SCXW75869062 BCX0\" data-ccp-props=\"{}\">\u00a0<\/span>\r\n<span class=\"TextRun SCXW191379222 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SpellingErrorV2Themed CommentHighlightClicked SCXW191379222 BCX0\" style=\"color: #99ccff;\">stderr_logfile<\/span><span class=\"NormalTextRun CommentHighlightClicked SCXW191379222 BCX0\"><span style=\"color: #99ccff;\">=<\/span><span style=\"color: #00ff00;\">\/var\/log\/nginx.err.log<\/span><\/span><\/span><span class=\"EOP CommentHighlightClicked SCXW191379222 BCX0\" style=\"color: #00ff00;\" data-ccp-props=\"{}\">\u00a0<\/span>\r\n<span class=\"NormalTextRun SpellingErrorV2Themed CommentHighlightClicked SCXW39657450 BCX0\" style=\"color: #ff9900;\">stdout_logfile<\/span><span class=\"NormalTextRun CommentHighlightClicked SCXW39657450 BCX0\"><span style=\"color: #ff9900;\">=<\/span><span style=\"color: #ccffff;\">\/var\/log\/nginx.out.log<\/span><\/span><\/pre>\n<\/div>\n<p><strong>For Apache\u00a0<\/strong><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"5\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Create another file on this path in this format \/etc\/supervisor\/conf.d\/apache2.conf.<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<\/ul>\n<h5><b><span data-contrast=\"auto\">One-line Summary for Apache (Supervisor Configuration):<\/span><\/b><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/h5>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"16\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559683&quot;:0,&quot;335559684&quot;:-2,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">This Supervisor configuration enables effective management of the <a href=\"https:\/\/opstree.com\/blog\/2025\/01\/14\/part-2-automating-data-migration-with-apache-airflow\/\">Apache service<\/a> by running it in the foreground, ensuring automatic startup, handling failures through automatic restarts, and storing standard output and error logs in specified files.<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<\/ul>\n<div class=\"wp-block-code\" style=\"background: #1e1e1e; color: #d4d4d4; border-radius: 8px; overflow: hidden; margin: 20px 0; font-family: 'Fira Code','Courier New',monospace;\">\n<div style=\"background: #3c3c3c; padding: 8px 12px; font-size: 14px; display: flex; align-items: center;\">\n<div style=\"display: flex; gap: 6px;\"><\/div>\n<\/div>\n<pre style=\"padding: 16px; margin: 0; overflow-x: auto; line-height: 1.5; font-size: 15px;\"><span style=\"color: #d7ba7d;\">[program:apache2]<\/span>\r\n<span style=\"color: #9cdcfe;\">command<\/span>=<span style=\"color: #ce9178;\">\/usr\/sbin\/apachectl -D FOREGROUND<\/span>\r\n<span style=\"color: #9cdcfe;\">autostart<\/span>=<span style=\"color: #b5cea8;\">true<\/span>\r\n<span style=\"color: #9cdcfe;\">autorestart<\/span>=<span style=\"color: #b5cea8;\">true<\/span>\r\n<span style=\"color: #9cdcfe;\">stderr_logfile<\/span>=<span style=\"color: #ce9178;\">\/var\/log\/apache2.err.log<\/span>\r\n<span style=\"color: #9cdcfe;\">stdout_logfile<\/span>=<span style=\"color: #ce9178;\">\/var\/log\/apache2.out.log<\/span><\/pre>\n<\/div>\n<h4 id=\"step3\"><span class=\"LineBreakBlob BlobObject DragDrop SCXW136199097 BCX0\"><span class=\"TextRun Highlight SCXW203604272 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW203604272 BCX0\">Step <\/span><span class=\"NormalTextRun SCXW203604272 BCX0\">3<\/span><\/span><span class=\"TextRun SCXW203604272 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW203604272 BCX0\"> Reload<\/span><span class=\"NormalTextRun SCXW203604272 BCX0\"> Supervisor and Start Services<\/span><\/span><span class=\"EOP SCXW203604272 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/span><span class=\"EOP SCXW136199097 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/h4>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><span class=\"TextRun SCXW151021581 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW151021581 BCX0\">Once the configurations<\/span><span class=\"NormalTextRun SCXW151021581 BCX0\"> are created, <\/span><span class=\"NormalTextRun SCXW151021581 BCX0\">updated,<\/span><span class=\"NormalTextRun SCXW151021581 BCX0\"> we need to reload Supervisor to apply these changes and start both services.<\/span><\/span><span class=\"EOP SCXW151021581 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-code\" style=\"background: #1e1e1e; color: #d4d4d4; border-radius: 8px; overflow: hidden; margin: 20px 0; font-family: 'Fira Code','Courier New',monospace;\">\n<pre style=\"padding: 16px; margin: 0; overflow-x: auto; line-height: 1.5; font-size: 15px;\"><span style=\"color: #569cd6;\"><span class=\"NormalTextRun SCXW176779292 BCX0\">sudo<\/span> <span class=\"NormalTextRun SpellingErrorV2Themed SCXW176779292 BCX0\">supervisorctl<\/span><span class=\"NormalTextRun SCXW176779292 BCX0\"> reread \r\n<span class=\"TextRun SCXW267224589 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SpellingErrorV2Themed SCXW267224589 BCX0\">sudo<\/span> <span class=\"NormalTextRun SpellingErrorV2Themed SCXW267224589 BCX0\">supervisorctl<\/span><span class=\"NormalTextRun SCXW267224589 BCX0\"> update<\/span><\/span><span class=\"EOP SCXW267224589 BCX0\" data-ccp-props=\"{}\"> \r\n<span class=\"TextRun SCXW44793787 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SpellingErrorV2Themed SCXW44793787 BCX0\">sudo<\/span> <span class=\"NormalTextRun SpellingErrorV2Themed SCXW44793787 BCX0\">supervisorctl<\/span><span class=\"NormalTextRun SCXW44793787 BCX0\"> start nginx<\/span><\/span><span class=\"EOP SCXW44793787 BCX0\" data-ccp-props=\"{}\"> \r\n<span class=\"TextRun SCXW63344410 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SpellingErrorV2Themed SCXW63344410 BCX0\">sudo<\/span> <span class=\"NormalTextRun SpellingErrorV2Themed SCXW63344410 BCX0\">supervisorctl<\/span><span class=\"NormalTextRun SCXW63344410 BCX0\"> start apache2<\/span><\/span><span class=\"EOP SCXW63344410 BCX0\" data-ccp-props=\"{}\">\u00a0<\/span><\/span><\/span><\/span><\/span><\/pre>\n<\/div>\n<h4 id=\"step4\"><span class=\"TextRun Highlight SCXW80112318 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW80112318 BCX0\">Step 4<\/span><span class=\"NormalTextRun SCXW80112318 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW80112318 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW80112318 BCX0\">Check the Status of Nginx and Apache<\/span><span class=\"NormalTextRun SCXW80112318 BCX0\">.<\/span><\/span><span class=\"EOP SCXW80112318 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/h4>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><span class=\"TextRun SCXW145247421 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW145247421 BCX0\">Now <\/span><span class=\"NormalTextRun SCXW145247421 BCX0\">check if the <\/span><span class=\"NormalTextRun SCXW145247421 BCX0\">Supervisor is managing Nginx and Apache<\/span><span class=\"NormalTextRun SCXW145247421 BCX0\"> or not<\/span><span class=\"NormalTextRun SCXW145247421 BCX0\">.<\/span><span class=\"NormalTextRun SCXW145247421 BCX0\"> If it does you will see the output like below.<\/span><\/span><span class=\"EOP SCXW145247421 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-code\" style=\"background: #1e1e1e; color: #d4d4d4; border-radius: 8px; overflow: hidden; margin: 20px 0; font-family: 'Fira Code','Courier New',monospace;\">\n<pre style=\"padding: 16px; margin: 0; overflow-x: auto; line-height: 1.5; font-size: 15px;\"><span style=\"color: #ffff00;\"><span class=\"TextRun SCXW161408866 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW161408866 BCX0\">sudo<\/span> <span class=\"NormalTextRun SpellingErrorV2Themed SCXW161408866 BCX0\">supervisorctl<\/span><span class=\"NormalTextRun SCXW161408866 BCX0\"> status<\/span><\/span> \r\n<\/span><\/pre>\n<\/div>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><span class=\"TextRun SCXW101256674 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW101256674 BCX0\">You should see output like:<\/span><\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-code\" style=\"background: #1e1e1e; color: #d4d4d4; border-radius: 8px; overflow: hidden; margin: 20px 0; font-family: 'Fira Code','Courier New',monospace;\">\n<pre style=\"padding: 16px; margin: 0; overflow-x: auto; line-height: 1.5; font-size: 15px; white-space: pre-wrap;\"><span style=\"display: block; margin-bottom: 8px;\"><span style=\"color: #4ec9b0;\">nginx<\/span>     <span style=\"color: #6a9955;\">RUNNING<\/span>   pid  <span style=\"color: #b5cea8;\">1234<\/span>, uptime  <span style=\"color: #ce9178;\">0:01:10<\/span><\/span><span style=\"display: block;\"><span style=\"color: #4ec9b0;\">apache2<\/span>   <span style=\"color: #6a9955;\">RUNNING<\/span>   pid  <span style=\"color: #b5cea8;\">5678<\/span>, uptime  <span style=\"color: #ce9178;\">0:01:10<\/span><\/span><\/pre>\n<\/div>\n<h4 id=\"step5\"><span class=\"TextRun Highlight SCXW263043885 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW263043885 BCX0\">Step 5<\/span><\/span><span class=\"TextRun SCXW263043885 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW263043885 BCX0\"> Create a Python Script for Monitoring with Open Telemetry and Prometheus.<\/span><\/span><span class=\"EOP SCXW263043885 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/h4>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><span class=\"TextRun SCXW228249291 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW228249291 BCX0\">I <\/span><span class=\"NormalTextRun SCXW228249291 BCX0\">have <\/span><span class=\"NormalTextRun SCXW228249291 BCX0\">created a Python script to gather performance metrics of the processes under Supervisor.<\/span><\/span><span class=\"EOP SCXW228249291 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5><span class=\"TextRun SCXW210265800 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW210265800 BCX0\">What does this Script <\/span><span class=\"NormalTextRun SCXW210265800 BCX0\">do?<\/span><\/span><span class=\"EOP SCXW210265800 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/h5>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ol>\n<li><span data-contrast=\"auto\">Monitors the status of nginx and apache2 processes.<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"auto\">Collects metrics like CPU usage, memory usage, uptime, and the number of threads.<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"auto\">Exposes the data in Prometheus-compatible format at <span style=\"color: #0000ff;\">http:\/\/{server_ip}:9876\/metrics<\/span><\/span><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"auto\">This script automatically monitors critical processes (like nginx, apache2) using Open Telemetry.<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"auto\">It collects real-time metrics such as:<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5><span class=\"TextRun SCXW199046063 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW199046063 BCX0\">Python Script to Export Supervisor Metrics<\/span><span class=\"NormalTextRun SCXW199046063 BCX0\">:<\/span><\/span><span class=\"EOP SCXW199046063 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/h5>\n<p><span data-contrast=\"auto\">I\u2019ve developed a Python script that uses <\/span><a href=\"https:\/\/opstree.com\/blog\/2025\/06\/10\/monitor-open-telemetry-collector-performance\/\"><b><span data-contrast=\"auto\">Open Telemetry<\/span><\/b><\/a><span data-contrast=\"auto\"> to collect custom metrics from a supervisor-managed application, including:<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><b><span data-contrast=\"auto\">Process status<\/span><\/b><span data-contrast=\"auto\"> (up\/down)<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<li><b><span data-contrast=\"auto\">Uptime in seconds<\/span><\/b><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<li><b><span data-contrast=\"auto\">CPU usage in percent<\/span><\/b><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><span data-contrast=\"auto\">These metrics are exposed over an HTTP endpoint in a Prometheus-compatible format.<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">You can find the complete script hosted on <\/span><b><span data-contrast=\"auto\">GitHub<\/span><\/b><span data-contrast=\"auto\">:<\/span><span data-ccp-props=\"{&quot;134233117&quot;:false,&quot;134233118&quot;:false,&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/github.com\/kumaribhanu\/supervisor-python-script\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/kumaribhanu\/supervisor-python-script<\/a><\/p>\n<h4 id=\"step6\"><span class=\"TextRun Highlight SCXW69934579 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW69934579 BCX0\">Step 6<\/span><\/span><span class=\"TextRun SCXW69934579 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW69934579 BCX0\"> Install Required Libraries for Python Script.<\/span><\/span><span class=\"EOP SCXW69934579 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/h4>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><span class=\"TextRun SCXW224175135 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW224175135 BCX0\">Now t<\/span><span class=\"NormalTextRun SCXW224175135 BCX0\">o run the script, <\/span><span class=\"NormalTextRun SCXW224175135 BCX0\">you\u2019ll<\/span><span class=\"NormalTextRun SCXW224175135 BCX0\"> need to install a few Python libraries.<\/span><\/span><span class=\"EOP SCXW224175135 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-code\" style=\"background: #1e1e1e; color: #d4d4d4; border-radius: 8px; overflow: hidden; margin: 20px 0; font-family: 'Fira Code','Courier New',monospace;\">\n<div style=\"background: #3c3c3c; padding: 8px 12px; font-size: 14px; display: flex; align-items: center;\">\n<div style=\"display: flex; gap: 6px;\"><\/div>\n<div style=\"margin-left: 10px; color: #9d9d9d;\"><\/div>\n<\/div>\n<pre style=\"padding: 16px; margin: 0; overflow-x: auto; line-height: 1.5; font-size: 15px;\"><span style=\"color: #569cd6;\"><span style=\"color: #ff9900;\"><span class=\"TextRun SCXW129523571 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW129523571 BCX0\">pip install <\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW129523571 BCX0\">opentelemetry-sdk<\/span> <span class=\"NormalTextRun SpellingErrorV2Themed SCXW129523571 BCX0\">opentelemetry<\/span><span class=\"NormalTextRun SCXW129523571 BCX0\">-exporter-<\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW129523571 BCX0\">prometheus<\/span> <span class=\"NormalTextRun SpellingErrorV2Themed SCXW129523571 BCX0\">prometheus<\/span><span class=\"NormalTextRun SCXW129523571 BCX0\">-client <\/span><span class=\"NormalTextRun SCXW129523571 BCX0\">psutil<\/span><\/span> <\/span><\/span><\/pre>\n<\/div>\n<h4 id=\"step7\"><span class=\"TextRun Highlight SCXW218732661 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW218732661 BCX0\">Step 7<\/span><\/span><span class=\"TextRun SCXW218732661 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW218732661 BCX0\"> Run the Python Script<\/span><\/span><span class=\"EOP SCXW218732661 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/h4>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><span class=\"TextRun SCXW166108792 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW166108792 BCX0\">Once the libraries are installed, run the script.<\/span><\/span><span class=\"EOP SCXW166108792 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-code\" style=\"background: #1e1e1e; color: #d4d4d4; border-radius: 8px; overflow: hidden; margin: 20px 0; font-family: 'Fira Code','Courier New',monospace;\">\n<pre style=\"padding: 16px; margin: 0; overflow-x: auto; line-height: 1.5; font-size: 15px;\"><span style=\"color: #ff00ff;\"><span class=\"TextRun SCXW218025684 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW218025684 BCX0\">python3 test2.py<\/span><\/span> <\/span><\/pre>\n<\/div>\n<h4 id=\"step8\"><span class=\"TextRun Highlight SCXW227927123 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW227927123 BCX0\">Step 8<\/span><\/span><span class=\"TextRun SCXW227927123 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW227927123 BCX0\"> Access Prometheus Metrics<\/span><\/span><span class=\"EOP SCXW227927123 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559685&quot;:0}\">\u00a0<\/span><\/h4>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><span data-contrast=\"auto\">In your browser to view the live metrics of your Nginx and Apache processes.<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"auto\">open the following URL in your browser.<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><span style=\"color: #0000ff;\">http:\/\/localhost:9001\/metrics<\/span> .<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><span data-contrast=\"auto\">Replace <\/span><span data-contrast=\"auto\">&lt;localhost&gt;<\/span><span data-contrast=\"auto\"> with the actual server IP or domain name.<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<li><span data-contrast=\"auto\">You should see output like<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<div class=\"wp-block-code\" style=\"background: #1e1e1e; color: #d4d4d4; border-radius: 8px; overflow: hidden; margin: 20px 0; font-family: 'Fira Code','Courier New',monospace;\">\n<pre style=\"padding: 16px; margin: 0; overflow-x: auto; line-height: 1.5; font-size: 15px;\"><span style=\"color: #4ec9b0;\">supervisord_process_up<\/span><span style=\"color: #d7ba7d;\">{<\/span><span style=\"color: #9cdcfe;\">process_name<\/span>=<span style=\"color: #ce9178;\">\"nginx\"<\/span><span style=\"color: #d7ba7d;\">}<\/span> <span style=\"color: #b5cea8;\">1<\/span>\r\n<span style=\"color: #4ec9b0;\">supervisord_process_cpu_percent<\/span><span style=\"color: #d7ba7d;\">{<\/span><span style=\"color: #9cdcfe;\">process_name<\/span>=<span style=\"color: #ce9178;\">\"apache2\"<\/span><span style=\"color: #d7ba7d;\">}<\/span> <span style=\"color: #b5cea8;\">4.5<\/span><\/pre>\n<\/div>\n<h4 id=\"step9\"><span class=\"TextRun Highlight SCXW47059925 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW47059925 BCX0\">Step 9<\/span><span class=\"NormalTextRun CommentStart CommentHighlightPipeClicked CommentHighlightClicked CommentImportant SCXW47059925 BCX0\">:<\/span><\/span><span class=\"TextRun SCXW47059925 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentHighlightClicked CommentImportant SCXW47059925 BCX0\"> Visualize Supervisor Metrics in Grafana<\/span><\/span><span class=\"EOP CommentHighlightPipeClicked SCXW47059925 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/h4>\n<p><span class=\"TextRun SCXW139763348 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW139763348 BCX0\">Here are some recommended metrics to <a href=\"https:\/\/opstree.com\/blog\/2024\/06\/04\/harnessing-the-power-of-lokis-json-log-parsing-in-grafana\/\">visualize in Grafana<\/a>, along with their explanation and <\/span><span class=\"NormalTextRun SCXW139763348 BCX0\">benefits.<\/span><\/span><span class=\"EOP SCXW139763348 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/p>\n<div class=\"wp-block-table\" style=\"overflow-x: auto; margin: 30px 0; font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;\">\n<table style=\"border-collapse: collapse; width: 100%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.05); border-radius: 8px; overflow: hidden;\">\n<thead>\n<tr style=\"background: #2c3e50; color: #fff;\">\n<th style=\"padding: 16px; text-align: left; font-weight: 600;\">Metric Name<\/th>\n<th style=\"padding: 16px; text-align: left; font-weight: 600;\">Description<\/th>\n<th style=\"padding: 16px; text-align: left; font-weight: 600;\">Why Monitor It?<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"border-bottom: 1px solid #eee;\">\n<td style=\"padding: 16px; font-weight: 600; color: #3498db;\"><span style=\"color: #0000ff;\"><code>supervisord_process_up<\/code><\/span><\/td>\n<td style=\"padding: 16px;\">Indicates whether the process is currently running (1) or not (0).<\/td>\n<td style=\"padding: 16px;\">Helps quickly detect if a critical process has stopped or crashed.<\/td>\n<\/tr>\n<tr style=\"border-bottom: 1px solid #eee; background-color: #f9f9f9;\">\n<td style=\"padding: 16px; font-weight: 600; color: #3498db;\"><span style=\"color: #0000ff;\"><code>supervisord_process_uptime_seconds<\/code><\/span><\/td>\n<td style=\"padding: 16px;\">Shows how long the process has been running in seconds.<\/td>\n<td style=\"padding: 16px;\">Useful to track process restarts or unexpected downtime.<\/td>\n<\/tr>\n<tr style=\"border-bottom: 1px solid #eee;\">\n<td style=\"padding: 16px; font-weight: 600; color: #3498db;\"><span style=\"color: #0000ff;\"><code>supervisord_process_cpu_percent<\/code><\/span><\/td>\n<td style=\"padding: 16px;\">Displays the CPU usage percentage of the process.<\/td>\n<td style=\"padding: 16px;\">Detects performance bottlenecks or abnormal CPU consumption.<\/td>\n<\/tr>\n<tr style=\"border-bottom: 1px solid #eee; background-color: #f9f9f9;\">\n<td style=\"padding: 16px; font-weight: 600; color: #3498db;\"><span style=\"color: #0000ff;\"><code>supervisord_process_memory_rss_bytes<\/code><\/span><\/td>\n<td style=\"padding: 16px;\">Tracks the Resident Set Size (actual memory used in RAM) by the process.<\/td>\n<td style=\"padding: 16px;\">Helps identify memory leaks or inefficient memory usage.<\/td>\n<\/tr>\n<tr style=\"border-bottom: 1px solid #eee;\">\n<td style=\"padding: 16px; font-weight: 600; color: #3498db;\"><span style=\"color: #0000ff;\"><code>supervisord_process_threads<\/code><\/span><\/td>\n<td style=\"padding: 16px;\">Shows the number of active threads within the process.<\/td>\n<td style=\"padding: 16px;\">Useful to monitor threading issues or unexpected thread growth.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2 id=\"conclusion\"><span class=\"TextRun Highlight SCXW215392586 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW215392586 BCX0\">Conclusion<\/span><\/span><\/h2>\n<p><span class=\"TextRun SCXW123808255 BCX0\" lang=\"EN-GB\" xml:lang=\"EN-GB\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW123808255 BCX0\">This Blog helps <\/span><span class=\"NormalTextRun SCXW123808255 BCX0\">us to<\/span><span class=\"NormalTextRun SCXW123808255 BCX0\"> create a comprehensive<\/span><span class=\"NormalTextRun SCXW123808255 BCX0\"> monitoring system for Supervisor-managed processes like Nginx and Apache2 using <\/span><span class=\"NormalTextRun SCXW123808255 BCX0\">Open Telemetry<\/span><span class=\"NormalTextRun SCXW123808255 BCX0\"> and Prometheus. By visualizing key metrics in Grafana, you can easily track the health and performance of your services in real time. This proactive monitoring helps <\/span><span class=\"NormalTextRun SCXW123808255 BCX0\">identify<\/span><span class=\"NormalTextRun SCXW123808255 BCX0\"> and address issues such as high CPU usage, memory leaks, or downtime, ensuring that your system <\/span><span class=\"NormalTextRun SCXW123808255 BCX0\">remains<\/span><span class=\"NormalTextRun SCXW123808255 BCX0\"> reliable and performs optimally.<\/span><\/span><span class=\"EOP SCXW123808255 BCX0\" data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1}\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, I\u2019ll Walk you through how I set up a custom monitoring system for Supervisor-managed processes like Nginx and Apache2, this setup will allow you to track the health and performance of processes running under Supervisor in real time.\u00a0<\/p>\n","protected":false},"author":241065127,"featured_media":29297,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[697649],"tags":[768739545,768739409,343865],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/opstree.com\/blog\/wp-content\/uploads\/2025\/06\/What-are-the-must-know-Python-libraries-for-data-engineers.jpg","jetpack_likes_enabled":false,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfDBOm-7Cu","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/29294"}],"collection":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/users\/241065127"}],"replies":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/comments?post=29294"}],"version-history":[{"count":8,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/29294\/revisions"}],"predecessor-version":[{"id":29303,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/29294\/revisions\/29303"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/media\/29297"}],"wp:attachment":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/media?parent=29294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/categories?post=29294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/tags?post=29294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}