{"id":879,"date":"2022-04-07T22:01:45","date_gmt":"2022-04-08T02:01:45","guid":{"rendered":"https:\/\/www.ebnet.us\/?p=879"},"modified":"2022-05-31T23:53:16","modified_gmt":"2022-06-01T03:53:16","slug":"monitor-your-ups-with-nut-and-grafana","status":"publish","type":"post","link":"https:\/\/www.ebnet.us\/index.php\/2022\/04\/07\/monitor-your-ups-with-nut-and-grafana\/","title":{"rendered":"Monitor your UPS with NUT and Grafana"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">If you are using <strong><a href=\"https:\/\/networkupstools.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">NUT (Network UPS Tools)<\/a><\/strong> you can monitor your UPS current and historical usage with <strong><a href=\"https:\/\/grafana.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Grafana<\/a><\/strong>. There are several Grafana dashboards available for NUT however I decided to settle on <strong><a href=\"https:\/\/grafana.com\/grafana\/dashboards\/10914\" target=\"_blank\" rel=\"noreferrer noopener\">Unraid NUT UPS Dashboard TR<\/a><\/strong>. Now don&#8217;t worry if you are not running Unraid, neither am I and I was able to tweak their Unraid instructions to running in my Docker Swarm environment of Raspberry Pies.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/ebnet.local.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"561\" src=\"https:\/\/ebnet.local.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard-1024x561.png\" alt=\"NUT UPS Grafana Dashboard\" class=\"wp-image-958\" srcset=\"https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard-1024x561.png 1024w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard-300x164.png 300w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard-768x420.png 768w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard-1536x841.png 1536w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard.png 1847w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>NUT UPS Grafana Dashboard<\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Requirements<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This post is not going into setting up Grafana or NUT and is tweaked for running for containerized in a Docker Swarm cluster. However the information here should be enough to setup if you are not using containerization.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A running instance of Grafana<\/li><li>A running instance of InfluxDB version 1.x (the exporter script does not support v2+)<\/li><li>A running instance of NUT<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">nut-influxdb-exporter<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><a href=\"https:\/\/github.com\/kiwimato\/nut-influxdb-exporter\" target=\"_blank\" rel=\"noreferrer noopener\">nut-influxdb-exporter<\/a><\/strong> is a dockerized Python script that will send data from NUT to InfluxDB.&nbsp;Now here you have 2 options:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><a href=\"https:\/\/hub.docker.com\/r\/maihai\/nut-influxdb-exporter\" target=\"_blank\" rel=\"noreferrer noopener\">maihai\/nut-influxdb-exporter<\/a><\/strong> (Creators own Docker image, only supports AMD64 processors)<\/li><li><strong><a href=\"https:\/\/hub.docker.com\/r\/eblabs\/nut-influxdb-exporter\" target=\"_blank\" rel=\"noreferrer noopener\">eblabs\/nut-influxdb-exporter<\/a><\/strong> (My multi-arch clone of the above image with supports arm7, arm64 and AMD64 processors)<\/li><\/ul>\n\n\n\n<h4 class=\"has-text-align-center wp-block-heading\">nut-influxdb-exporter service definition<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>nut-influxdb-exporter:\n    image: eblabs\/nut-influxdb-exporter\n    environment:\n      INFLUXDB_HOST: influxdb\n      INFLUXDB_PORT: 8086\n      INFLUXDB_USER: <em>yourusername<\/em>\n      INFLUXDB_PASSWORD: '<em>yourpassword<\/em>'\n      INFLUXDB_DATABASE: nut\n      NUT_HOST: <em>NUTserverIP<\/em>\n      NUT_PORT: 3493\n      NUT_USERNAME: <em>nutusername<\/em>\n      NUT_PASSWORD: '<em>nutpassword<\/em>'\n      UPS_NAME: '<em>yourUPSname<\/em>'\n#      VERBOSE: 'true'<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Setting up the Datasource in Grafana<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>In Grafana go to Configuration -&gt; Datasources<\/li><li>Select &#8220;Add data source&#8221;<\/li><li>Select &#8220;InfluxDB&#8221;<\/li><\/ol>\n\n\n\n<h4 class=\"has-text-align-center wp-block-heading\">Influx-UPS-NUT datasource settings<\/h4>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/ebnet.local.ebnet.us\/wp-content\/uploads\/2022\/04\/Influx_UPS_NUT_Data_Source.png\"><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"941\" src=\"https:\/\/ebnet.local.ebnet.us\/wp-content\/uploads\/2022\/04\/Influx_UPS_NUT_Data_Source.png\" alt=\"Influx_UPS_NUT_Data_Source\" class=\"wp-image-881\" srcset=\"https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/04\/Influx_UPS_NUT_Data_Source.png 979w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/04\/Influx_UPS_NUT_Data_Source-300x288.png 300w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/04\/Influx_UPS_NUT_Data_Source-768x738.png 768w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/a><figcaption>If Save &amp; Test works we are ready to import the dashboard<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Importing the dashboard into Grafana<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>In Grafana go to Create (+) -&gt; Import<\/li><li>ID is 10914<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"864\" height=\"524\" src=\"https:\/\/ebnet.local.ebnet.us\/wp-content\/uploads\/2022\/04\/Grafana-Import-Screen.png\" alt=\"Grafana-Import-Screen\" class=\"wp-image-882\" srcset=\"https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/04\/Grafana-Import-Screen.png 864w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/04\/Grafana-Import-Screen-300x182.png 300w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/04\/Grafana-Import-Screen-768x466.png 768w\" sizes=\"auto, (max-width: 864px) 100vw, 864px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">And now you should be able to monitor your UPS<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/ebnet.local.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"561\" src=\"https:\/\/ebnet.local.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard-1024x561.png\" alt=\"NUT UPS Grafana Dashboard\" class=\"wp-image-958\" srcset=\"https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard-1024x561.png 1024w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard-300x164.png 300w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard-768x420.png 768w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard-1536x841.png 1536w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/05\/NUT-Grafana-Dashboard.png 1847w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>NUT UPS Grafana Dashboard<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/amzn.to\/37ogwGu\" target=\"_blank\" rel=\"noreferrer noopener\">Looking for a UPS?<\/a><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;ve been using APC Uninterruptible Power Supplies for over twenty years. I&#8217;ve worked with probably their entire product line from desktop, rack mounted and data center power distribution. If you&#8217;ve never had a UPS or need a new one APC is the way to go.<\/p>\n\n\n\n<a href=\"https:\/\/www.amazon.com\/APC-Battery-Protector-BackUPS-BX1500M\/dp\/B06VY6FXMM?keywords=apc%2Bbattery%2Bbackup&amp;pd_rd_r=51d0984a-9c3c-4275-92ce-98d9ddce51f3&amp;pd_rd_w=bf9Cd&amp;pd_rd_wg=wqFWD&amp;pf_rd_p=4fa0e97a-13a4-491b-a127-133a554b4da3&amp;pf_rd_r=CEEM3HA7T4SCHSPSP1F5&amp;qid=1649384046&amp;sr=8-5&amp;th=1&amp;linkCode=li3&amp;tag=astroed0a-20&amp;linkId=1ed646bc02cbec797ff438d09454fc4b&amp;language=en_US&amp;ref_=as_li_ss_il\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" border=\"0\" src=\"\/\/ws-na.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=B06VY6FXMM&amp;Format=_SL250_&amp;ID=AsinImage&amp;MarketPlace=US&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=astroed0a-20&amp;language=en_US\"><\/a><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ir-na.amazon-adsystem.com\/e\/ir?t=astroed0a-20&amp;language=en_US&amp;l=li3&amp;o=1&amp;a=B06VY6FXMM\" width=\"1\" height=\"1\" border=\"0\" alt=\"\" style=\"border:none !important; margin:0px !important;\">\n","protected":false},"excerpt":{"rendered":"<p>If you are using NUT (Network UPS Tools) you can monitor your UPS current and historical usage with Grafana. There are several Grafana dashboards available for NUT however I decided to settle on Unraid NUT UPS Dashboard TR. Now don&#8217;t worry if you are not running Unraid, neither am I and I was able to&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":878,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[29,25],"tags":[44,45,43],"class_list":["post-879","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-grafana","category-software","tag-grafana","tag-nut","tag-ups"],"featured_image_src":"https:\/\/www.ebnet.us\/wp-content\/uploads\/2022\/04\/NUT-logo.png","author_info":{"display_name":"Ed Brandon","author_link":"https:\/\/www.ebnet.us\/index.php\/author\/bigeb\/"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/posts\/879","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/comments?post=879"}],"version-history":[{"count":2,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/posts\/879\/revisions"}],"predecessor-version":[{"id":960,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/posts\/879\/revisions\/960"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/media\/878"}],"wp:attachment":[{"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/media?parent=879"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/categories?post=879"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/tags?post=879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}