wildmountainfarms / solarthing

Monitors an Outback MATE, Renogy Rover - MPPT Charge Controller and EPEver Tracer. Integrates with Grafana, PVOutput and more!
https://solarthing.readthedocs.io
MIT License
127 stars 28 forks source link

Getting data into Grafana? Documentation seems confusing #21

Closed wcrice closed 3 years ago

wcrice commented 3 years ago

Hi! What a great project!

For starters, thank you. I am having trouble getting data into Grafana but I seem to be putting data into the databases and I seem to have Grafana and the GraphQL service up and running correctly. I'm missing something but I don't know what. At this point I have done the following (not necessarily in this order):

I am planning to use a Rover 30A but right now I'm using the dummy test file.

Install Java:

sudo apt install openjdk-11-jre-headless

Downloaded Solarthing: curl https://raw.githubusercontent.com/wildmountainfarms/solarthing/master/other/linux/clone_install.sh | sudo bash sudo usermod -a -G solarthing,dialout,tty,video $USER

Configure Solarthing for Rover:

cd /opt/solarthing/program/rover cp ../../config_templates/io/default_linux_serial.json config/ cp ../../config_templates/base/rover_template.json config/base.json

Edit this bit of the base.json: "dummy": "test/dummy_rover.json"

Install (and configure) both couchdb and influxdb with these commands:

curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | sudo apt-key add - echo "deb https://apache.bintray.com/couchdb-deb bionic main" | sudo tee -a /etc/apt/sources.list sudo apt update sudo apt install couchdb

I made a password during installation that I used for the configuration later on Solarthing.

Install influxdb: sudo apt install influxdb

Easy way to make a first user on influxdb: curl "http://localhost:8086/query" --data-urlencode "q=CREATE USER username WITH PASSWORD 'password' WITH ALL PRIVILEGES"

Configure couchdb and influxdb for my rover setup:

cp ../../config_templates/databases/couchdb_template.json config/couchdb.json cp ../../config_templates/databases/influxdb_template.json config/influxdb.json

I edited both of those files to include the username and passwords I made above.

Now when I test run the rover file I get . what I think if a positive output:

2021-02-04 17:24:06.543 [main] DEBUG me.retrodaredevil.solarthing.couchdb.CouchDbPacketSaver - Already had a design document for packets on database=solarthing

2021-02-04 17:24:06.591 [main] INFO org.influxdb - --> POST http://localhost:8086/query?q=CREATE+DATABASE+default_database (0-byte body)

2021-02-04 17:24:06.594 [main] INFO org.influxdb - <-- 200 OK http://localhost:8086/query?q=CREATE+DATABASE+default_database (2ms, unknown-length body)

2021-02-04 17:24:06.597 [main] INFO org.influxdb - --> POST http://localhost:8086/write?db=default_database&precision=n&consistency=all (2870-byte body)

2021-02-04 17:24:06.601 [main] INFO org.influxdb - <-- 204 No Content http://localhost:8086/write?db=default_database&precision=n&consistency=all (4ms, 0-byte body)

2021-02-04 17:24:06.602 [main] DEBUG me.retrodaredevil.solarthing.influxdb.influxdb1.InfluxDbPacketSaver - Wrote 1 packets to InfluxDB! database=default_database retention policy=null

2021-02-04 17:24:06.602 [main] DEBUG me.retrodaredevil.solarthing.program.RequestMain - Going to sleep for 4879ms

Cool!

Install Grafana on Ubuntu 18.04:

wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" sudo apt update apt-cache policy grafana sudo apt install grafana sudo systemctl start grafana-server sudo systemctl status grafana-server

Grafana runs! It says active! I logged in, made an account, etc.

Next, install Grafana GraphQL plugin:

sudo usermod -a -G grafana $USER exec su -l $USER cd /var/lib/grafana/plugins git clone https://github.com/fifemon/graphql-datasource

GraphQL is in the data sources list of Grafana.

copy the graphQL config file from the template folder (not in the documentation but it seems necessary). sudo cp ../config_templates/graphql/application.properties graphql/config

And edit the application.properties file (also not in the documentation but it seems necessary!)

Instead of:

solarthing.config.database=../config/couchdb/couchdb.json

I made application.properties say: solarthing.config.database=../rover/config/couchdb.json

And now I can enable the service and check on it:

sudo systemctl enable solarthing-graphql sudo systemctl start solarthing-graphql sudo systemctl status solarthing-graphql

It runs! It says active!

When I add a datasource to graphql (http://localhost:8080/graphql) with access set to "browser" I get the following: HTTP Response undefined: undefined

When I try connecting to influxdb with my database, username, and password from the influxdb.json file I get a webpage starting with:

Cannot create property 'executedQueryString' on string '<!DOCTYPE html> <html lang="en"> <head> <script> !(function() { if ('PerformanceLongTaskTiming' in window) { var g = (window.__tti = { e: [] }); g.o = new PerformanceObserver(function(l) { g.e = g.e.concat(l.getEntries()); }); g.o.observe({ entryTypes: ['longtask'] }); } })(); </script> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="viewport" content="width=device-width" /> <meta name="theme-color" content="#000" /> <title>Grafana</title> <base href="/" /> <link rel="preload" href="public/fonts/roboto/RxZJdnzeo3R5zSexge8UUVtXRa8TVwTICgirnJhmVJw.woff2" as="font" crossorigin /> <link rel="icon" type="image/png" href="public/img/fav32.png" /> <link rel="apple-touch-icon" sizes="180x180" href="public/img/apple-touch-icon.png" /> <link rel="mask-icon" href="public/img/grafana_mask_icon.svg" color="#F05A28" /> <link rel="stylesheet" href="public/build/grafana.dark.ddf7518003180e1ca7bc.css" /> <script> performance.mark('css done blocking'); </script> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="msapplication-TileColor" content="#2b5797" /> <meta name="msapplication-config" content="public/img/browserconfig.xml" /> </head> <body class="theme-dark app-grafana"> <style> .preloader { height: 100%; flex-direction: column; display: flex; justify-content: center; align-items: center; } .preloader__enter { opacity: 0; animation-name: preloader-fade-in; animation-iteration-count: 1; animation-duration: 0.9s; animation-delay: 1.35s; animation-fill-mode: forwards; } .preloader__bounce { text-align: center; animation-name: preloader-bounce; animation-duration: 0.9s; animation-iteration-count: infinite; } .preloader__logo { display: inline-block; animation-name: preloader-squash; animation-duration: 0.9s; animation-iteration-count: infinite; width: 60px; height: 60px; background-repeat: no-repeat; background-size: contain; background-image: url("data:image/svg+xml,%3csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' width='351px' height='365px' viewBox='0 0 351 365' style='enable-background:new 0 0 351 365%3b' xml:space='preserve'%3e %3cstyle type='text/css'%3e .st0%7bfill:url(%23SVGID_1_)%3b%7d %3c/style%3e %3cg id='Layer_1_1_'%3e %3c/g%3e %3clinearGradient id='SVGID_1_' gradientUnits='userSpaceOnUse' x1='175.5' y1='445.4948' x2='175.5' y2='114.0346'%3e %3cstop offset='0' style='stop-color:%23FFF100'/%3e %3cstop offset='1' style='stop-color:%23F05A28'/%3e %3c/linearGradient%3e %3cpath class='st0' d='M342%2c161.2c-0.6-6.1-1.6-13.1-3.6-20.9c-2-7.7-5-16.2-9.4-25c-4.4-8.8-10.1-17.9-17.5-26.8 c-2.9-3.5-6.1-6.9-9.5-10.2c5.1-20.3-6.2-37.9-6.2-37.9c-19.5-1.2-31.9%2c6.1-36.5%2c9.4c-0.8-0.3-1.5-0.7-2.3-1 c-3.3-1.3-6.7-2.6-10.3-3.7c-3.5-1.1-7.1-2.1-10.8-3c-3.7-0.9-7.4-1.6-11.2-2.2c-0.7-0.1-1.3-0.2-2-0.3 c-8.5-27.2-32.9-38.6-32.9-38.6c-27.3%2c17.3-32.4%2c41.5-32.4%2c41.5s-0.1%2c0.5-0.3%2c1.4c-1.5%2c0.4-3%2c0.9-4.5%2c1.3c-2.1%2c0.6-4.2%2c1.4-6.2%2c2.2 c-2.1%2c0.8-4.1%2c1.6-6.2%2c2.5c-4.1%2c1.8-8.2%2c3.8-12.2%2c6c-3.9%2c2.2-7.7%2c4.6-11.4%2c7.1c-0.5-0.2-1-0.4-1-0.4c-37.8-14.4-71.3%2c2.9-71.3%2c2.9 c-3.1%2c40.2%2c15.1%2c65.5%2c18.7%2c70.1c-0.9%2c2.5-1.7%2c5-2.5%2c7.5c-2.8%2c9.1-4.9%2c18.4-6.2%2c28.1c-0.2%2c1.4-0.4%2c2.8-0.5%2c4.2 C18.8%2c192.7%2c8.5%2c228%2c8.5%2c228c29.1%2c33.5%2c63.1%2c35.6%2c63.1%2c35.6c0%2c0%2c0.1-0.1%2c0.1-0.1c4.3%2c7.7%2c9.3%2c15%2c14.9%2c21.9c2.4%2c2.9%2c4.8%2c5.6%2c7.4%2c8.3 c-10.6%2c30.4%2c1.5%2c55.6%2c1.5%2c55.6c32.4%2c1.2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-0.1l0.6%2c0c0.9-0.1%2c1.7-0.1%2c2.6-0.2l1.3-0.1c0%2c0%2c0.5%2c0%2c0.1%2c0l0.3%2c0 l0.6%2c0c0.7%2c0%2c1.5-0.1%2c2.2-0.1c2.9-0.1%2c5.9-0.1%2c8.8%2c0c5.8%2c0.2%2c11.5%2c0.9%2c17%2c1.9c11.1%2c2.1%2c21.5%2c5.6%2c31%2c10.3 c9.5%2c4.6%2c17.9%2c10.3%2c25.3%2c16.5c0.5%2c0.4%2c0.9%2c0.8%2c1.4%2c1.2c0.4%2c0.4%2c0.9%2c0.8%2c1.3%2c1.2c0.9%2c0.8%2c1.7%2c1.6%2c2.6%2c2.4c0.9%2c0.8%2c1.7%2c1.6%2c2.5%2c2.4 c0.8%2c0.8%2c1.6%2c1.6%2c2.4%2c2.5c3.1%2c3.3%2c6%2c6.6%2c8.6%2c10c5.2%2c6.7%2c9.4%2c13.5%2c12.7%2c19.9c0.2%2c0.4%2c0.4%2c0.8%2c0.6%2c1.2c0.2%2c0.4%2c0.4%2c0.8%2c0.6%2c1.2 c0.4%2c0.8%2c0.8%2c1.6%2c1.1%2c2.4c0.4%2c0.8%2c0.7%2c1.5%2c1.1%2c2.3c0.3%2c0.8%2c0.7%2c1.5%2c1%2c2.3c1.2%2c3%2c2.4%2c5.9%2c3.3%2c8.6c1.5%2c4.4%2c2.6%2c8.3%2c3.5%2c11.7 c0.3%2c1.4%2c1.6%2c2.3%2c3%2c2.1c1.5-0.1%2c2.6-1.3%2c2.6-2.8C342.6%2c170.4%2c342.5%2c166.1%2c342%2c161.2z'/%3e %3c/svg%3e"); } .preloader__text { margin-top: 16px; font-weight: 500; font-size: 14px; font-family: Sans-serif; opacity: 0; animation-name: preloader-fade-in; animation-duration: 0.9s; animation-delay: 1.8s; animation-fill-mode: forwards; } .theme-light .preloader__text { color: #52545c; } .theme-dark .preloader__text { color: #d8d9da; } @keyframes preloader-fade-in { 0% { opacity: 0; animation-timing-function: cubic-bezier(0, 0, 0.5, 1); } 100% { opacity: 1; } } @keyframes preloader-bounce { from, to { transform: translateY(0px); animation-timing-function: cubic-bezier(0.3, 0, 0.1, 1); } 50% { transform: translateY(-50px); animation-timing-function: cubic-bezier(0.9, 0, 0.7, 1); } } @keyframes preloader-squash { 0% { transform: scaleX(1.3) scaleY(0.8); animation-timing-function: cubic-bezier(0.3, 0, 0.1, 1); transform-origin: bottom center; } 15% { transform: scaleX(0.75) scaleY(1.25); animation-timing-function: cubic-bezier(0, 0, 0.7, 0.75); transform-origin: bottom center; } 55% { transform: scaleX(1.05) scaleY(0.95); animation-timing-function: cubic-bezier(0.9, 0, 1, 1); transform-origin: top center; } 95% { transform: scaleX(0.75) scaleY(1.25); animation-timing-function: cubic-bezier(0, 0, 0, 1); transform-origin: bottom center; } 100% { transform: scaleX(1.3) scaleY(0.8); transform-origin: bottom center; animation-timing-function: cubic-bezier(0, 0, 0.7, 1); } } .preloader__text--fail { display: none; } .preloader--done .preloader__bounce, .preloader--done .preloader__logo { animation-name: none; display: none; } .preloader--done .preloader__logo, .preloader--done .preloader__text { display: none; color: #ff5705 !important; font-size: 15px; } .preloader--done .preloader__text--fail { display: block; } [ng\:cloak], [ng-cloak], .ng-cloak { display: none !important; } </style> <div class="preloader"> <div class="preloader__enter"> <div class="preloader__bounce"> <div class="preloader__logo"></div> </div> </div> <div class="preloader__text">Loading Grafana</div> <div class="preloader__text preloader__text--fail"> <p> <strong>If you're seeing this Grafana has failed to load its application files</strong> <br /> <br /> </p> <p> 1. This could be caused by your reverse proxy settings.<br /><br /> 2. If you host grafana under subpath make sure your grafana.ini root_url setting includes subpath. If not using a reverse proxy make sure to set serve_from_sub_path to true.<br /> <br /> 3. If you have a local dev build make sure you build frontend using: yarn start, yarn start:hot, or yarn build<br /> <br /> 4. Sometimes restarting grafana-server can help<br /> </p> </div> </div> <grafana-app class="grafana-app" ng-cloak> <sidemenu class="sidemenu"></sidemenu> <app-notifications-list class="page-alert-list"></app-notifications-list> <search-wrapper></search-wrapper> <div class="main-view"> <div ng-view class="scroll-canvas"></div> </div> </grafana-app> <script> window.grafanaBootData = { user: {"isSignedIn":true,"id":1,"login":"admin","email":"admin@localhost","name":"admin","lightTheme":false,"orgCount":1,"orgId":1,"orgName":"Main Org.","orgRole":"Admin","isGrafanaAdmin":true,"gravatarUrl":"/avatar/46d229b033af06a191ff2267bca9ae56","timezone":"browser","locale":"en-US","helpFlags1":0,"hasEditPermissionInFolders":true}, settings: {"alertingEnabled":true,"alertingErrorOrTimeout":"alerting","alertingMinInterval":1,"alertingNoDataOrNullValues":"no_data","allowOrgCreate":true,"appSubUrl":"","appUrl":"http://localhost:3000/","authProxyEnabled":false,"autoAssignOrg":true,"buildInfo":{"buildstamp":1610613717,"commit":"1e261642f4","edition":"Open Source","env":"production","hasUpdate":true,"hideVersion":false,"isEnterprise":false,"latestVersion":"7.4.0","version":"7.3.7"},"datasources":{"-- Dashboard --":{"meta":{"type":"datasource","name":"-- Dashboard --","id":"dashboard","info":{"author":{"name":"","url":""},"description":"","links":null,"logos":{"small":"public/img/icn-datasource.svg","large":"public/img/icn-datasource.svg"},"build":{},"screenshots":null,"version":"","updated":""},"dependencies":{"grafanaVersion":"*","plugins":[]},"includes":null,"module":"app/plugins/datasource/dashboard/module","baseUrl":"public/app/plugins/datasource/dashboard","category":"","preload":false,"signature":"internal","Root":null,"annotations":false,"metrics":true,"alerting":false,"explore":false,"tables":false,"logs":false,"tracing":false,"builtIn":true,"routes":null,"streaming":false},"name":"-- Dashboard --","type":"datasource"},"-- Grafana --":{"meta":{"type":"datasource","name":"-- Grafana --","id":"grafana","info":{"author":{"name":"","url":""},"description":"","links":null,"logos":{"small":"public/img/icn-datasource.svg","large":"public/img/icn-datasource.svg"},"build":{},"screenshots":null,"version":"","updated":""},"dependencies":{"grafanaVersion":"*","plugins":[]},"includes":null,"module":"app/plugins/datasource/grafana/module","baseUrl":"public/app/plugins/datasource/grafana","category":"","preload":false,"signature":"internal","Root":null,"annotations":true,"metrics":true,"alerting":false,"explore":false,"tables":false,"logs":false,"tracing":false,"builtIn":true,"routes":null,"streaming":false},"name":"-- Grafana --","type":"datasource"},"-- Mixed --":{"meta":{"type":"datasource","name":"-- Mixed --","id":"mixed","info":{"author":{"name":"","url":""},"description":"","links":null,"logos":{"small":"public/img/icn-datasource.svg","large":"public/img/icn-datasource.svg"},"build":{},"screenshots":null,"version":"","updated":""},"dependencies":{"grafanaVersion":"*","plugins":[]},"includes":null,"module":"app/plugins/datasource/mixed/module","baseUrl":"public/app/plugins/datasource/mixed","category":"","preload":false,"signature":"internal","Root":null,"annotations":false,"metrics":true,"alerting":false,"explore":false,"tables":false,"logs":false,"tracing":false,"queryOptions":{"minInterval":true},"builtIn":true,"mixed":true,"routes":null,"streaming":false},"name":"-- Mixed --","type":"datasource"},"GraphQL Data Source":{"id":15,"jsonData":{},"meta":{"type":"datasource","name":"GraphQL Data Source","id":"fifemon-graphql-datasource","info":{"author":{"name":"Kevin Retzke","url":""},"description":"GraphQL Data Source","links":[{"name":"Website","url":"https://github.com/fifemon/graphql-datasource"},{"name":"License","url":"https://github.com/fifemon/graphql-datasource/blob/master/LICENSE"}],"logos":{"small":"public/plugins/fifemon-graphql-datasource/img/logo.svg","large":"public/plugins/fifemon-graphql-datasource/img/logo.svg"},"build":{},"screenshots":[{"path":"public/plugins/fifemon-graphql-datasource/img/db_arrivals.png","name":"DeutscheBahn Arrivals"},{"path":"public/plugins/fifemon-graphql-datasource/img/db_arrivals_annotations.png","name":"DeutscheBahn Arrivals Annotations"},{"path":"public/plugins/fifemon-graphql-datasource/img/github_security_advisories.png","name":"GitHub Security Advisories"}],"version":"1.2.0","updated":"2021-01-14"},"dependencies":{"grafanaVersion":"7.x.x","plugins":[]},"includes":null,"module":"plugins/fifemon-graphql-datasource/module","baseUrl":"public/plugins/fifemon-graphql-datasource","category":"","preload":false,"signature":"unsigned","Root":null,"annotations":true,"metrics":true,"alerting":false,"explore":false,"tables":false,"logs":false,"tracing":false,"routes":null,"streaming":false},"name":"GraphQL Data Source","type":"fifemon-graphql-datasource","uid":"QLAWxULGz","url":"http://localhost:8080/graphql"},"InfluxDB":{"database":"default_database","id":16,"jsonData":{"httpMode":"GET"},"meta":{"type":"datasource","name":"InfluxDB","id":"influxdb","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"Open source time series database","links":null,"logos":{"small":"public/app/plugins/datasource/influxdb/img/influxdb_logo.svg","large":"public/app/plugins/datasource/influxdb/img/influxdb_logo.svg"},"build":{},"screenshots":null,"version":"","updated":""},"dependencies":{"grafanaVersion":"*","plugins":[]},"includes":null,"module":"app/plugins/datasource/influxdb/module","baseUrl":"public/app/plugins/datasource/influxdb","category":"tsdb","preload":false,"signature":"internal","Root":null,"annotations":true,"metrics":true,"alerting":true,"explore":false,"tables":false,"logs":true,"tracing":false,"queryOptions":{"minInterval":true},"routes":null,"streaming":false},"name":"InfluxDB","password":"kPg^B4wp0wbs","type":"influxdb","uid":"wmIY_wLMk","url":"","username":"bill"}},"dateFormats":{"fullDate":"YYYY-MM-DD HH:mm:ss","useBrowserLocale":false,"interval":{"second":"HH:mm:ss","minute":"HH:mm","hour":"MM/DD HH:mm","day":"MM/DD","month":"YYYY-MM","year":"YYYY"},"defaultTimezone":"browser"},"defaultDatasource":"GraphQL Data Source","disableLoginForm":false,"disableSanitizeHtml":false,"disableUserSignUp":true,"editorsCanAdmin":false,"exploreEnabled":true,"externalUserMngInfo":"","externalUserMngLinkName":"","externalUserMngLinkUrl":"","featureToggles":{},"googleAnalyticsId":"","http2Enabled":false,"ldapEnabled":false,"licenseInfo":{"edition":"Open Source","expiry":0,"hasLicense":false,"hasValidLicense":false,"licenseUrl":"/admin/upgrading","stateInfo":""},"loginHint":"email or username","marketplaceUrl":"https://grafana.com/grafana/plugins/","minRefreshInterval":"5s","panels":{"alertlist":{"baseUrl":"public/app/plugins/panel/alertlist","hideFromList":false,"id":"alertlist","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"Shows list of alerts and their current status","links":null,"logos":{"small":"public/app/plugins/panel/alertlist/img/icn-singlestat-panel.svg","large":"public/app/plugins/panel/alertlist/img/icn-singlestat-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/alertlist/module","name":"Alert list","signature":"internal","skipDataQuery":true,"sort":9,"state":""},"bargauge":{"baseUrl":"public/app/plugins/panel/bargauge","hideFromList":false,"id":"bargauge","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"","links":null,"logos":{"small":"public/app/plugins/panel/bargauge/img/icon_bar_gauge.svg","large":"public/app/plugins/panel/bargauge/img/icon_bar_gauge.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/bargauge/module","name":"Bar gauge","signature":"internal","skipDataQuery":false,"sort":4,"state":"beta"},"dashlist":{"baseUrl":"public/app/plugins/panel/dashlist","hideFromList":false,"id":"dashlist","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"List of dynamic links to other dashboards","links":null,"logos":{"small":"public/app/plugins/panel/dashlist/img/icn-dashlist-panel.svg","large":"public/app/plugins/panel/dashlist/img/icn-dashlist-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/dashlist/module","name":"Dashboard list","signature":"internal","skipDataQuery":true,"sort":10,"state":""},"gauge":{"baseUrl":"public/app/plugins/panel/gauge","hideFromList":false,"id":"gauge","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"","links":null,"logos":{"small":"public/app/plugins/panel/gauge/img/icon_gauge.svg","large":"public/app/plugins/panel/gauge/img/icon_gauge.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/gauge/module","name":"Gauge","signature":"internal","skipDataQuery":false,"sort":3,"state":""},"gettingstarted":{"baseUrl":"public/app/plugins/panel/gettingstarted","hideFromList":true,"id":"gettingstarted","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"","links":null,"logos":{"small":"public/app/plugins/panel/gettingstarted/img/icn-dashlist-panel.svg","large":"public/app/plugins/panel/gettingstarted/img/icn-dashlist-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/gettingstarted/module","name":"Getting Started","signature":"internal","skipDataQuery":true,"sort":100,"state":""},"graph":{"baseUrl":"public/app/plugins/panel/graph","hideFromList":false,"id":"graph","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"Graph Panel for Grafana","links":null,"logos":{"small":"public/app/plugins/panel/graph/img/icn-graph-panel.svg","large":"public/app/plugins/panel/graph/img/icn-graph-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/graph/module","name":"Graph","signature":"internal","skipDataQuery":false,"sort":1,"state":""},"heatmap":{"baseUrl":"public/app/plugins/panel/heatmap","hideFromList":false,"id":"heatmap","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"Heatmap Panel for Grafana","links":[{"name":"Brendan Gregg - Heatmaps","url":"http://www.brendangregg.com/heatmaps.html"},{"name":"Brendan Gregg - Latency Heatmaps","url":" http://www.brendangregg.com/HeatMaps/latency.html"}],"logos":{"small":"public/app/plugins/panel/heatmap/img/icn-heatmap-panel.svg","large":"public/app/plugins/panel/heatmap/img/icn-heatmap-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/heatmap/module","name":"Heatmap","signature":"internal","skipDataQuery":false,"sort":8,"state":""},"homelinks":{"baseUrl":"public/app/plugins/panel/homelinks","hideFromList":true,"id":"homelinks","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"","links":null,"logos":{"small":"public/app/plugins/panel/homelinks/img/news.svg","large":"public/app/plugins/panel/homelinks/img/news.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/homelinks/module","name":"Home links","signature":"internal","skipDataQuery":true,"sort":100,"state":""},"logs":{"baseUrl":"public/app/plugins/panel/logs","hideFromList":false,"id":"logs","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"","links":null,"logos":{"small":"public/app/plugins/panel/logs/img/icn-logs-panel.svg","large":"public/app/plugins/panel/logs/img/icn-logs-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/logs/module","name":"Logs","signature":"internal","skipDataQuery":false,"sort":100,"state":""},"news":{"baseUrl":"public/app/plugins/panel/news","hideFromList":false,"id":"news","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"","links":null,"logos":{"small":"public/app/plugins/panel/news/img/news.svg","large":"public/app/plugins/panel/news/img/news.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/news/module","name":"News","signature":"internal","skipDataQuery":true,"sort":10,"state":"beta"},"pluginlist":{"baseUrl":"public/app/plugins/panel/pluginlist","hideFromList":false,"id":"pluginlist","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"Plugin List for Grafana","links":null,"logos":{"small":"public/app/plugins/panel/pluginlist/img/icn-dashlist-panel.svg","large":"public/app/plugins/panel/pluginlist/img/icn-dashlist-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/pluginlist/module","name":"Plugin list","signature":"internal","skipDataQuery":true,"sort":100,"state":""},"singlestat":{"baseUrl":"public/app/plugins/panel/singlestat","hideFromList":false,"id":"singlestat","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"Singlestat Panel for Grafana","links":null,"logos":{"small":"public/app/plugins/panel/singlestat/img/icn-singlestat-panel.svg","large":"public/app/plugins/panel/singlestat/img/icn-singlestat-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/singlestat/module","name":"Singlestat","signature":"internal","skipDataQuery":false,"sort":6,"state":"deprecated"},"stat":{"baseUrl":"public/app/plugins/panel/stat","hideFromList":false,"id":"stat","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"Singlestat Panel for Grafana","links":null,"logos":{"small":"public/app/plugins/panel/stat/img/icn-singlestat-panel.svg","large":"public/app/plugins/panel/stat/img/icn-singlestat-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/stat/module","name":"Stat","signature":"internal","skipDataQuery":false,"sort":2,"state":"beta"},"table":{"baseUrl":"public/app/plugins/panel/table","hideFromList":false,"id":"table","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"Table Panel for Grafana","links":null,"logos":{"small":"public/app/plugins/panel/table/img/icn-table-panel.svg","large":"public/app/plugins/panel/table/img/icn-table-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/table/module","name":"Table","signature":"internal","skipDataQuery":false,"sort":5,"state":""},"table-old":{"baseUrl":"public/app/plugins/panel/table-old","hideFromList":false,"id":"table-old","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"Table Panel for Grafana","links":null,"logos":{"small":"public/app/plugins/panel/table-old/img/icn-table-panel.svg","large":"public/app/plugins/panel/table-old/img/icn-table-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/table-old/module","name":"Table (old)","signature":"internal","skipDataQuery":false,"sort":100,"state":"deprecated"},"text":{"baseUrl":"public/app/plugins/panel/text","hideFromList":false,"id":"text","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"","links":null,"logos":{"small":"public/app/plugins/panel/text/img/icn-text-panel.svg","large":"public/app/plugins/panel/text/img/icn-text-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/text/module","name":"Text","signature":"internal","skipDataQuery":true,"sort":7,"state":""},"welcome":{"baseUrl":"public/app/plugins/panel/welcome","hideFromList":true,"id":"welcome","info":{"author":{"name":"Grafana Labs","url":"https://grafana.com"},"description":"","links":null,"logos":{"small":"public/app/plugins/panel/welcome/img/icn-dashlist-panel.svg","large":"public/app/plugins/panel/welcome/img/icn-dashlist-panel.svg"},"build":{},"screenshots":null,"version":"","updated":""},"module":"app/plugins/panel/welcome/module","name":"Welcome","signature":"internal","skipDataQuery":true,"sort":100,"state":""}},"passwordHint":"password","pluginsToPreload":[],"rendererAvailable":false,"sigV4AuthEnabled":false,"verifyEmailEnabled":false,"viewersCanEdit":false}, navTree: [{"id":"create","text":"Create","icon":"plus","url":"/dashboard/new","sortWeight":-2000,"children":[{"text":"Dashboard","icon":"apps","url":"/dashboard/new"},{"id":"folder","text":"Folder","subTitle":"Create a new folder to organize your dashboards","icon":"folder-plus","url":"/dashboards/folder/new"},{"id":"import","text":"Import","subTitle":"Import dashboard from file or Grafana.com","icon":"import","url":"/dashboard/import"}]},{"id":"dashboards","text":"Dashboards","subTitle":"Manage dashboards \u0026 folders","icon":"apps","url":"/","sortWeight":-1900,"children":[{"id":"home","text":"Home","icon":"home-alt","url":"/","hideFromTabs":true},{"id":"divider","text":"Divider","divider":true,"hideFromTabs":true},{"id":"manage-dashboards","text":"Manage","icon":"sitemap","url":"/dashboards"},{"id":"playlists","text":"Playlists","icon":"presentation-play","url":"/playlists"},{"id":"snapshots","text":"Snapshots","icon":"camera","url":"/dashboard/snapshots"}]},{"id":"explore","text":"Explore","subTitle":"Explore your data","icon":"compass","url":"/explore","sortWeight":-1800},{"id":"profile","text":"admin","img":"/avatar/46d229b033af06a191ff2267bca9ae56","url":"/profile","sortWeight":-1700,"hideFromMenu":true,"children":[{"id":"profile-settings","text":"Preferences","icon":"sliders-v-alt","url":"/profile"},{"id":"change-password","text":"Change Password","icon":"lock","url":"/profile/password","hideFromMenu":true},{"id":"sign-out","text":"Sign out","icon":"arrow-from-right","url":"/logout","target":"_self","hideFromTabs":true}]},{"id":"alerting","text":"Alerting","subTitle":"Alert rules \u0026 notifications","icon":"bell","url":"/alerting/list","sortWeight":-1600,"children":[{"id":"alert-list","text":"Alert Rules","icon":"list-ul","url":"/alerting/list"},{"id":"channels","text":"Notification channels","icon":"comment-alt-share","url":"/alerting/notifications"}]},{"id":"cfg","text":"Configuration","subTitle":"Organization: Main Org.","icon":"cog","url":"/datasources","sortWeight":-1400,"children":[{"id":"datasources","text":"Data Sources","description":"Add and configure data sources","icon":"database","url":"/datasources"},{"id":"users","text":"Users","description":"Manage org members","icon":"user","url":"/org/users"},{"id":"teams","text":"Teams","description":"Manage org groups","icon":"users-alt","url":"/org/teams"},{"id":"plugins","text":"Plugins","description":"View and configure plugins","icon":"plug","url":"/plugins"},{"id":"org-settings","text":"Preferences","description":"Organization preferences","icon":"sliders-v-alt","url":"/org"},{"id":"apikeys","text":"API Keys","description":"Create \u0026 manage API keys","icon":"key-skeleton-alt","url":"/org/apikeys"}]},{"id":"admin","text":"Server Admin","subTitle":"Manage all users \u0026 orgs","icon":"shield","url":"/admin/users","sortWeight":-1300,"hideFromTabs":true,"children":[{"id":"global-users","text":"Users","icon":"user","url":"/admin/users"},{"id":"global-orgs","text":"Orgs","icon":"building","url":"/admin/orgs"},{"id":"server-settings","text":"Settings","icon":"sliders-v-alt","url":"/admin/settings"},{"id":"server-stats","text":"Stats","icon":"graph-bar","url":"/admin/stats"},{"id":"upgrading","text":"Upgrade","icon":"unlock","url":"/admin/upgrading"}]},{"id":"help","text":"Help","subTitle":"Grafana v7.3.7 (1e261642f4)","icon":"question-circle","url":"#","sortWeight":-1200,"hideFromMenu":true}] }; window.onload = function() { var preloader = document.getElementsByClassName("preloader"); if (preloader.length) { preloader[0].className = "preloader preloader--done"; } }; </script> <script src="public/build/runtime.ddf7518003180e1ca7bc.js" type="text/javascript"></script> <script src="public/build/angular~app.ddf7518003180e1ca7bc.js" type="text/javascript"></script> <script src="public/build/app.ddf7518003180e1ca7bc.js" type="text/javascript"></script> <script src="public/build/moment~app.ddf7518003180e1ca7bc.js" type="text/javascript"></script> <script src="public/build/vendors~app.ddf7518003180e1ca7bc.js" type="text/javascript"></script> <script> performance.mark('js done blocking'); </script> </body> </html> '

So I think I have two separate ways to potentially connect but neither of them are working. I've tried nothing and I'm all out of options. Okay, that is a joke. I've tried a lot and I'm all out of ideas. Can you suggest anything? I feel like I'm so close!

Thank you!

retrodaredevil commented 3 years ago

Alright so I want to clear up any confusion first. You are trying to get data into Grafana in two different ways.

First, CouchDB and SolarThing GraphQL. It sounds like you have this set up correctly. I'm not really sure why its giving you an undefined response when you put that in for the GraphQL datasource in Grafana. What do you mean by you set it to "browser"? Is there another option you can use? It's been a while since I've set that up and I don't remember what this is supposed to be set to.

Second, InfluxDB. Again, looks like this is set up correctly in SolarThing. From the debug, I can tell you are using InfluxDB 1.X. Can you make sure you are using the InfluxQL and not Flux as the query language, as flux is only supported on InfluxDB 1.8 and 2.0. I've never seen that error you got for InfluxDB, so I'm not really sure why that's happening either.

I'll admit helping people figure out why their databases aren't working is not something I'm best at because I don't set up databases very frequently. Sometime in the next few days I'll try to install some of these on my own, and hopefully update the documentation (maybe even suggest using docker instead of installing directly.)

Sorry I can't help much right now. Hopefully I'll figure out how to reproduce whatever you're doing wrong and then maybe I can help.

wcrice commented 3 years ago

"Browser" is the option Grafana uses when my database server isn't visible from the web. For security reasons my server is locked down. It pretty much says Grafana to connect locally. Maybe GraphQL doesn't support that option?

The database stuff seems pretty confusing! I am sure you get a little tired of this.

Does Solarthing offer the option to save output files to a flat csv or tab file, appended one row at a time? If so, I already have code on this server that can read that kind of file and process it into an rShiny app. I should admit that I have never touched Java, I'm rusty with Python, but I can do most things in R. I also reluctantly use CRBasic (Campbell Scientific implementation of Basic). I would rewrite the driver for the Rover on CRBasic but wrapping my head around the weird Modbus addresses is making me a little crazy.

retrodaredevil commented 3 years ago

Does GraphQL have a Server access option? I'm pretty sure InfluxDB has that option. From what I understand the if you use the "browser" option it basically means that whatever browser you use have to be able to access the GraphQL server itself, so the browser would be making the request.

SolarThing doesn't support csv. It does support a "POST" request option, which makes SolarThing send its raw json data to a webserver of your choice. post template here. This might be a good option if you want to get data out of SolarThing and use your own script to do what you want with the data.

I will try and figure out what those errors you got mean, I just can't do that for a little while until I find the time to set up a Grafana instance and play around with it. Which could be today or a week from today.

Also, can I ask what version of InfluxDB you're running?

And for the GraphQL program, can you stop it with sudo systemctl stop solarthing-graphql and then run it manually using cd /opt/solarthing/program/graphql; ./run.sh. Once you've done that, can you again try to use Grafana to access it? I want to make sure there are no errors in the output of the GraphQL program. Running it manually is the easiest way to see output of the GraphQL program as the logs are different from the other SolarThing programs.

wcrice commented 3 years ago

This is all running from on the same server and everything has permission for localhost port access. It potentially could be a problem with GraphQL accessing the database if it is trying to access the database using 127.0.0.1 it should work. It would only be an issue if it was trying to connect from someplace on the internet.

I currently have InfluxDB version 1.8.4-1 installed.

I tried running GraphQL from the terminal and it still has the same error from Grafana. It also gave me a warning that may help make sense of my problem. I don't know what it means but maybe you do?

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by me.retrodaredevil.solarthing.graphql.GraphQLProvider (jar:file:/opt/solarthing/program /.downloads/solarthing-graphql-SNAPSHOT.jar!/BOOT-INF/classes!/) to field java.lang.reflect.Field.modifiers WARNING: Please consider reporting this to the maintainers of me.retrodaredevil.solarthing.graphql.GraphQLProvider WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release file: ../rover/config/couchdb.json absolute: /opt/solarthing/program/graphql/../rover/config/couchdb.json No solcast config! Not using solcast! Using defaultInstanceOptions=DefaultInstanceOptions(defaultSourceId='<UNUSED SOURCE ID THAT WILL NEVER BE IN A PACKET>', def aultFragmentId=0)

Thank you!

retrodaredevil commented 3 years ago

That warning can be ignored. I'll try to silence it in an update. Just to make sure, after that warning, you get a message like Started SolarThingGraphQLApplication in 2.875 seconds (JVM running for 3.566), right?

Assuming you get that message I mentioned, then the GraphQL program is running perfectly. Do you get any messages in there if you try to access it from Grafana? Navigate to localhost:8080 and make sure that something pops up in the logs. If it does, that's good. Now try to access it from Grafana. Again, you should get some more log messages in the output. If you don't, then something isn't allowing you to access it.

Also, the page you'll get when navigating to localhost:8080 will have something like Whitelabel Error Page on it. Don't worry about that. Since we aren't doing a real GraphQL query on it, it's gonna get mad at us. We just need to make sure that it's doing something.

wcrice commented 3 years ago

I should have specified. After that warning everything seems to run fine!

2021-02-04 22:56:00.474 INFO 26950 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2021-02-04 22:56:00.709 INFO 26950 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2021-02-04 22:56:00.726 INFO 26950 --- [ main] m.r.s.g.SolarThingGraphQLApplication : Started SolarThingGraphQLApplication in 4.3 seconds (JVM running for 4.983)

And yeah, I just test. From an actual browser I get "Whitelabel Error Page" and a 404 error. From the command curl "http://localhost:8080" I get essentially a 404. If I close the process for GraphQL I get a "Failed to connect to localhost port 8080" with my curl command so I know it did something.

Maybe I should specify that this thing is running headless on an Ubuntu 18.04 server.

I'm still getting the same error connecting to Grafana. Maybe I'm just not setting up my data source correctly?

retrodaredevil commented 3 years ago

When you attempt to connect to GraphQL in Grafana, do the logs say anything in SolarThing GrahpQL? Try relaunching the GraphQL program with ./run.sh, then look to see if anything pops up after Started SolarThingGraphQLApplication.

If anything pops up after that, can you send me those logs? If nothing pops up after that, then for some reason Grafana can't access it.

wcrice commented 3 years ago

Good thought! It only seems to give me something when I use the access method "Server (default)" but doesn't do anything with Browser. It still gives an error in Grafana: HTTP Response undefined: undefined

Tis is what GraphQL gives: 2021-02-04 23:25:53.396 INFO 28412 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2021-02-04 23:25:53.634 INFO 28412 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2021-02-04 23:25:53.652 INFO 28412 --- [ main] m.r.s.g.SolarThingGraphQLApplication : Started SolarThingGraphQLApplication in 4.523 seconds (JVM running for 5.256) 2021-02-04 23:39:55.291 INFO 28412 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2021-02-04 23:39:55.292 INFO 28412 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2021-02-04 23:39:55.301 INFO 28412 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 9 ms

And then that's it. I get the error in Grafana and GraphQL gives no further output.

retrodaredevil commented 3 years ago

Ok, well it's good that Grafana can access SolarThing GraphQL. That means a bunch of things are going right. I was looking at the GraphQL datasource source code and it looks like the GraphQL datasource thinks it's getting some kind of error.

When you test the GraphQL Datasource in Grafana and it gives you HTTP Response undefined: undefined, can you go into the console of your browser (by pressing F12 usually) and give me the most recent log from it? It should look something like Object {...} If you could right click on that, click copy object, and send that to me here. Or you might be able to just highlight the object and copy paste it.

I think I'm starting to get a better idea of what's going on. Once I find the time to get a Grafana server up and running, figuring out your problem should be a lot easier, but I think we're making progress to better understand what's going on.

I'm starting to think that you can ignore the HTTP Response undefined: undefined error. If that's the case, then I'll open an issue for the GraphQL Datasource plugin, which I've contributed to before, but I haven't taken a look at it for a while.

wcrice commented 3 years ago

OH! I'm so sorry! I'm 100% sure that at some point I told it to go to the correct URL but during your process of helping me troubleshoot I must have 1) fixed the underlying problem and 2) screwed up the URL so instead of reading http://localhost:8080/graphql it only read http://localhost:8080

Uhg! I didn't notice it until I went back and did what you asked and got an error that made me go back and reconsider my URL. Thank you for all your help! Now I get to start tinkering.

retrodaredevil commented 3 years ago

Ah yeah I should have stressed that the /graphql part is important. I did mention just navigating straight to localhost:8080 in a browser earlier.

So when you test the connection do you still get the HTTP Response undefined: undefined?

Is the GraphQL datasource working for you now? Can this issue be closed? If you want me to help you get InfluxDB working you can keep this issue open. Otherwise feel free to close it if everything is working fine.

Sorry in advance that there aren't really any examples for GraphQL. Once I get remote access back to the system I monitor, I'll get the JSON for the Grafana dashboard. This dashboard has a combination of InfluxDB annotation queries and regular GraphQL queries that you can look at. I don't recommend copy-pasting it as that usually doesn't work very well.

wcrice commented 3 years ago

Well, I think GraphQL is working because when I run: { data:queryStatusLast(to:"$timeTo", sourceId:"default") { batteryVoltage { Time:dateMillis packet { batteryVoltage } } } }

I get:

batteryVoltage.0.Time 1612486860967

batteryVoltage.0.packet.batteryVoltage 26

I still get diddly from InfluxDB and it seems to be running correctly. I'm still happy to keep troubleshooting! I wasn't trying to use you as free tech support for something that you made for free. I thought I caught a bug! Or at least I found a small flaw in the documentation. Considering the entire process I went through above was run from the terminal I wonder if a simple bash script asking for user responses could be written to fill in the handful of variables in a "default" installation like mine? Maybe there is no such thing as a default installation.

Thank you again!

wcrice commented 3 years ago

And if you could write an example Grafana dashboard that uses GraphQL that would be AMAZING because I'm looking at all of this and... well, I'm sure it is very intuitive but my brain is full of code and jargon and I can't see it right now.

retrodaredevil commented 3 years ago

I'm glad you got GraphQL working. Yeah I will get the documentation for GraphQL better soon. I've been using GraphQL for a while, but just recently did people start using it for SolarThing. CouchDB used to be pretty difficult to set up but now it's much easier.

How are you trying to access InfluxDB? I don't think InfluxDB 1.8 has a web interface, so you can only do things through a terminal I think. Also if you do want to get InfluxDB working, I recommend getting InfluxDB 2.0 working, as that is a much nicer experience for SolarThing, although I have exactly 0 examples for InfluxDB 2.0 queries.

wcrice commented 3 years ago

I have only tried using the influx CLI through the terminal but I was able to make a username and password for myself using a version of the command: curl "http://localhost:8086/query" --data-urlencode "q=CREATE USER username WITH PASSWORD 'password' WITH ALL PRIVILEGES"

When I try connecting to myself I follow something pretty similar to this: https://siytek.com/influxdb-grafana-setup/

But at the very last step instead of a friendly green "Data source is working" all I see accessing it via "server (default)" is: `InfluxDB Error: Bad Gateway'

And browser is the long gobbldygook I posted in my first message.

I may be on to something.. When I pulled up sudo systemctl status influxd.service I got this:

Feb 05 01:30:06 ip-172-31-21-135 influxd[20330]: [httpd] 127.0.0.1 - bill [05/Feb/2021:01:30:06 +0000] "POST /write?db=default_database&precision=n&consistency=all HTTP/1.1" 204 0 "-" "okhttp/4.9.0" ad2da05e-6751-11eb-868d-06c419357b84 3052 Feb 05 01:30:11 ip-172-31-21-135 influxd[20330]: ts=2021-02-05T01:30:11.038198Z lvl=info msg="Executing query" log_id=0S7_AxO0000 service=query query="CREATE DATABASE default_database" Feb 05 01:30:11 ip-172-31-21-135 influxd[20330]: [httpd] 127.0.0.1 - bill [05/Feb/2021:01:30:11 +0000] "POST /query?q=CREATE+DATABASE+default_database HTTP/1.1" 200 57 "-" "okhttp/4.9.0" b0285dbe-6751-11eb-868e-06c419357b84 422 Feb 05 01:30:11 ip-172-31-21-135 influxd[20330]: [httpd] 127.0.0.1 - bill [05/Feb/2021:01:30:11 +0000] "POST /write?db=default_database&precision=n&consistency=all HTTP/1.1" 204 0 "-" "okhttp/4.9.0" b0288da6-6751-11eb-868f-06c419357b84 2826 Feb 05 01:30:16 ip-172-31-21-135 influxd[20330]: ts=2021-02-05T01:30:16.061093Z lvl=info msg="Executing query" log_id=0S7_AxO0000 service=query query="CREATE DATABASE default_database" Feb 05 01:30:16 ip-172-31-21-135 influxd[20330]: [httpd] 127.0.0.1 - bill [05/Feb/2021:01:30:16 +0000] "POST /query?q=CREATE+DATABASE+default_database HTTP/1.1" 200 57 "-" "okhttp/4.9.0" b326cc97-6751-11eb-8690-06c419357b84 405 Feb 05 01:30:16 ip-172-31-21-135 influxd[20330]: [httpd] 127.0.0.1 - bill [05/Feb/2021:01:30:16 +0000] "POST /write?db=default_database&precision=n&consistency=all HTTP/1.1" 204 0 "-" "okhttp/4.9.0" b32714c2-6751-11eb-8691-06c419357b84 3072 Feb 05 01:30:21 ip-172-31-21-135 influxd[20330]: ts=2021-02-05T01:30:21.038027Z lvl=info msg="Executing query" log_id=0S7_AxO0000 service=query query="CREATE DATABASE default_database" Feb 05 01:30:21 ip-172-31-21-135 influxd[20330]: [httpd] 127.0.0.1 - bill [05/Feb/2021:01:30:21 +0000] "POST /query?q=CREATE+DATABASE+default_database HTTP/1.1" 200 57 "-" "okhttp/4.9.0" b61e3828-6751-11eb-8692-06c419357b84 981

Which made me wonder if the server is just making a new database over and over and over again. I connected to influx via terminal and ran show database which listed default_database so I think it exists. Yep, I'm lost. I'm getting more familiar with how you have this setup and it is a wonderful piece of software! It sure is complicated and getting everything to play nicely is a challenge, but it seems pretty cool when it works!

retrodaredevil commented 3 years ago

SolarThing will attempt to create the default_database over and over again, just to make sure it's there. This is normal.

Can you follow some of the commands on this page and make sure that your user you created is actually created? curl -G http://localhost:8086/query -u username:password --data-urlencode "q=SHOW DATABASES". I expect that to work, but I just want to make sure.

In this forum post the user was able to make it work by using http://localhost:8086/ instead of http://localhost:8086. Also this post has a bunch of things you can try.

wcrice commented 3 years ago

Well, your query SHOW DATABASES via RFC 2617, query parameters, and using the request body all gave me: {"results":[{"statement_id":0,"series":[{"name":"databases","columns":["name"],"values":[["_internal"],["default_database"]]}]}]}

OH, I just saw your mention about using http://localhost:8086/ and that fixed it. Okay, weird. Cool. Well, that is neat and confusing. So for some reason my computer was stuck on that / and the GraphQL thing was probably because I needed to start and stop all the services a few times.... I think in the end that was all I did. Huh! Thank you SO MUCH!

retrodaredevil commented 3 years ago

OH, I just saw your mention about using http://localhost:8086/

That's kind of dumb that this was the reason it wasn't working... I'll be sure to stress that somewhere in the documentation when setting up InfluxDB. I'm sure I ran into this issue a while ago and if I didn't... then I'm just lucky. Honestly this should probably be fixed in the InfluxDB datasource.