divinity666 / ruby-grafana-reporter

Reporting Service for Grafana
MIT License
66 stars 5 forks source link

bash: ruby-grafana-reporter: command not found using Snap #8

Closed ECONOS closed 2 years ago

ECONOS commented 2 years ago

Hi after completing the installation as below I could not execute the program.

pi@raspberrypi:~ $ gem install ruby-grafana-reporter Successfully installed ruby-grafana-reporter-0.4.4 Parsing documentation for ruby-grafana-reporter-0.4.4 Done installing documentation for ruby-grafana-reporter after 1 seconds 1 gem installed pi@raspberrypi:~ $ ruby-grafana-reporter -w bash: ruby-grafana-reporter: command not found

How can I overcome this? Thanks

divinity666 commented 2 years ago

Hi ECONOS,

sounds as if gem couldn't properly install the executable in the binary folder.

Try executing gem env and have a look in the EXECUTABLE DIRECTORY, if the ruby-grafana-reporter script is located there. If not, you may consider uninstalling the gem again and install it as root, which should fix your issue.

Happy to hear your feedback.

Best regards

ECONOS commented 2 years ago

pi@raspberrypi:~ $ gem env RubyGems Environment:

Sorry I am new to Linux programming, from my understanding installing as root means adding a "sudo" command in front. Yet it doesn't work.

ECONOS commented 2 years ago

I realized that I installed ruby using snap.

I have uninstalled it and reinstalled using sudo apt install ruby and things turned out fine.

Right now I am facing with new problem. I have followed the instruction in ruby-grafana-reporter -w and fill up the form as below :

pi@raspberrypi:~ $ ruby-grafana-reporter -w
Configuration file 'grafana_reporter.config' already exists. Do you want to [o]verwrite it, use it to for [d]emo report creation only, or [a]bort? [odA]: o
This wizard will guide you through an initial configuration for the ruby-grafana-reporter. The configuration file will be created in the current folder. Please make sure to specify necessary paths either with a relative or an absolute path properly.

Wizard is creating configuration file 'grafana_reporter.config'.

Specify port on which reporter shall run [8815]: 8815
Specify grafana host [http://localhost:3000]: http://192.168.0.183:3000
Testing connection to 'http://192.168.0.183:3000' _without_ API key...done.
Grafana could not be accessed at 'http://192.168.0.183:3000'. Do you want to use an [a]pi key, [r]e-enter url, or [i]gnore and proceed? [aRi]: a
Enter API key: eyJrIjoieUh3YVVtU21qZVdkd25FbUd5UzNCZURQbURzcVVBYlkiLCJuIjoicmVwb3J0ZXIiLCJpZCI6MX0=
Testing connection to 'http://192.168.0.183:3000' _with_ API key...I, [2021-07-27T19:05:58.830298 #3017]  INFO -- : Reporter is running with NON-Admin privileges on grafana.
done.
Access to grafana is permitted as NON-Admin.Specify path where templates shall be stored [./templates]: /home/pi/Documents/Grafana/templates
Directory '/home/pi/Documents/Grafana/templates does not exist: [c]reate, [r]e-enter path or [i]gnore? [cRi]: c
Directory '/home/pi/Documents/Grafana/templates' successfully created.
Specify path where created reports shall be stored [./reports]: /home/pi/Documents/Grafana/Reports
Directory '/home/pi/Documents/Grafana/Reports does not exist: [c]reate, [r]e-enter path or [i]gnore? [cRi]: c
Directory '/home/pi/Documents/Grafana/Reports' successfully created.
Specify path where rendered images shall be stored (relative to templates folder) [./images]: /images
Directory '/home/pi/Documents/Grafana/templates/images does not exist: [c]reate, [r]e-enter path or [i]gnore? [cRi]: c
Directory '/home/pi/Documents/Grafana/templates/images' successfully created.
Specify report retention duration in hours [24]: 24
Configuration file successfully created.
Configuration file validated successfully.
Shall I create a demo report for your new configuration file? Please note that this report might contain confidential information, depending on the confidentiality of the information stored in your dashboard. [yN]: y
Evaluating dashboard 'ZqEcsJZgk' for building a demo report...done - 6 examples to go
Evaluating dashboard 'EJ6881Wgz' for building a demo report...done - 6 examples to go
For 6 reporter functionalities no appropriate examples could be found in the configured grafana instance.
DEMO template '/home/pi/Documents/Grafana/templates/demo_report.adoc' successfully created.

Now everything is setup properly. Create your reports as required in the templates folder and run the reporter either standalone with e.g. the following command:

   /usr/bin/ruby2.5 /usr/local/bin/ruby-grafana-reporter -t demo_report -o demo_report.pdf

or run it as a service using the following command:

   /usr/bin/ruby2.5 /usr/local/bin/ruby-grafana-reporter

Open 'http://localhost:8815/render?var-template=demo_report' in a webbrowser to test your configuration.

Created a new link. when pressed the browser jump into this page: http://localhost:3000/render?var-template=demo_report&from=now-7d&to=now

showing: "Page not found error 404"

divinity666 commented 2 years ago

Ok, sounds not so bad now :-)

For making it run, check the link. You need to call localhost:8815 instead of localhost:3000.

So the correct link, is as stated by the reporter: http://localhost:8815/render?var-template=demo_report&from=now-7d&to=now

Please note: Make sure, that calling the browser with localhost means, that your are opening the browser on the same machine, where the reporter is running. If you are running the browser from another machine, you'll have to replace localhost with the appropriate IP address and you need to make sure, that the IP and port can be accessed from the caller.

Does this work for you?

divinity666 commented 2 years ago

Closing because of missing feedback. Feel free to reopen, if the issue persists.