Closed Sandaru48 closed 2 years ago
Looks like we might be able to debug it a bit with #127. Handful of additional questions:
<your grafana host>/api/search?type=dash-db
from the bot host?# If you have an API key
curl -H "Authorization: bearer <your token>" "<your grafana host>/api/search?type=dash-db"
# If you do not have an API token
curl "<your grafana host>/api/search?type=dash-db"
The JSON parsing error is because it received some other content instead of JSON, which is usually caused by an HTML page coming over instead. The linked PR aims to improve debugging to find this out sooner, but I'm not a fan of the way it requires changing every method call in order to echo back to the user.
Looks like we might be able to debug it a bit with #127. Handful of additional questions:
- Has it worked previously or is this a new install?
- Can you confirm that you can open
<your grafana host>/api/search?type=dash-db
from the bot host?# If you have an API key curl -H "Authorization: bearer <your token>" "<your grafana host>/api/search?type=dash-db" # If you do not have an API token curl "<your grafana host>/api/search?type=dash-db"
The JSON parsing error is because it received some other content instead of JSON, which is usually caused by an HTML page coming over instead. The linked PR aims to improve debugging to find this out sooner, but I'm not a fan of the way it requires changing every method call in order to echo back to the user.
Hi @stephenyeargin , Sorry for the late response. Answers for 2 questions ;
<your grafana host>/api/search?type=dash-db
from the bot host
Let's try using the debug branch to get a better look at it. In your package.json
, change to:
"hubot-grafana": "stephenyeargin/hubot-grafana#improve-error-handling",
Then, in your environment settings, set HUBOT_LOG_LEVEL=debug
.
Here's an example of it encountering a redirect:
Hubot> !graf list
Hubot> [Sat Jan 09 2021 22:32:04 GMT-0600 (Central Standard Time)] DEBUG Message '!graf list' matched regex //^\s*[@]?(?:Hubot[:,]?|![:,]?)\s*(?:(?:grafana|graph|graf) list\s?(.+)?)/i/; listener.options = { id: null }
[Sat Jan 09 2021 22:32:04 GMT-0600 (Central Standard Time)] DEBUG Executing listener callback for Message '!graf list'
[Sat Jan 09 2021 22:32:04 GMT-0600 (Central Standard Time)] DEBUG <html>
<head><title>308 Permanent Redirect</title></head>
<body>
<center><h1>308 Permanent Redirect</h1></center>
<hr><center>nginx/1.15.10</center>
</body>
</html>
[Sat Jan 09 2021 22:32:04 GMT-0600 (Central Standard Time)] ERROR An error ocurred calling the Grafana API on <http://play.grafana.org>. See logs for details.
[Sat Jan 09 2021 22:32:04 GMT-0600 (Central Standard Time)] DEBUG false
[Sat Jan 09 2021 22:32:04 GMT-0600 (Central Standard Time)] DEBUG false
An error ocurred calling the Grafana API on <http://play.grafana.org>. See logs for details.
Describe the bug I'm trying to get Grafana dashboard to slack API using hubot. Once tyoe @jarvis-bot graf list, its giving following error
ubuntu@ubuntu:~/hubot$ HUBOT_SLACK_TOKEN=xoxb-XXXXXXXXXXXXXXXXXXXX ./bin/hubot --adapter slack audited 168 packages in 4.264s
2 packages are looking for funding run
npm fund
for detailsfound 0 vulnerabilities
[Sun Jan 03 2021 08:15:18 GMT+0000 (Coordinated Universal Time)] INFO hubot-slack adapter v4.8.1 warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide. warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide. [Sun Jan 03 2021 08:15:19 GMT+0000 (Coordinated Universal Time)] INFO Logged in as @jarvis-bot in workspace Team-PSMT [Sun Jan 03 2021 08:15:20 GMT+0000 (Coordinated Universal Time)] INFO Connected to Slack RTM [Sun Jan 03 2021 08:15:20 GMT+0000 (Coordinated Universal Time)] INFO hubot-redis-brain: Using default redis on localhost:6379 [Sun Jan 03 2021 08:15:21 GMT+0000 (Coordinated Universal Time)] INFO hubot-redis-brain: Data for hubot brain retrieved from Redis [Sun Jan 03 2021 08:16:06 GMT+0000 (Coordinated Universal Time)] ERROR SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (:null:null)
at /home/ubuntu/hubot/node_modules/hubot-grafana/src/grafana.coffee:428:7, :424:21
at IncomingMessage. (/home/ubuntu/hubot/node_modules/scoped-http-client/src/index.js:95:22)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
To Reproduce Steps to reproduce the behavior: 1.Installed proetheus, node_exporter as service and installed grafana with image render plugin using docker-compose in a Raspberry pi 4 (armv8)
Expected behavior getting grafana dashboard without error
Screenshots
Software: