d3noob / PiMetric

Monitoring system for infrastructure and services
5 stars 1 forks source link

i'v got a 502 bad gateway #1

Open stepdes opened 4 years ago

stepdes commented 4 years ago

installation goes fine, but at the end i got this:

Setting Hostname... adding the crontab lines sudo: unable to resolve host raspberrypi: No address associated with hostname no crontab for pi sudo: unable to resolve host raspberrypi: No address associated with hostname ############################ All finished. Rebooting. ############################ sudo: unable to resolve host raspberrypi: No address associated with hostname

d3noob commented 4 years ago

Okay, that seems unusual. almost as if it couldn't load the cron job. That's a bit frustrating happening right at the end. For the sake of getting going you should be able to run the commands in the terminal manually;

(sudo crontab -u pi -l ; echo "* * * * * cd /srv/PiMetric/monitoring && python3 monitoring.py") | crontab -u pi -
(sudo crontab -u pi -l ; echo "5 0 * * * cd /srv/PiMetric/monitoring && python3 db-manage.py") | crontab -u pi -

Then reboot.

Other than that All I can think of is that either there was something random happening that will never happen again (in other words try again from fresh) or that there was something associated with a later version of raspbian. This was initially tested with 'stretch' so if you're using 'buster' it might behave differently (I'm just not sure on that one sorry).

stepdes commented 4 years ago

Hi, thanks for your response, tried the commands without succes. i'm running on Buster so maybe that's the reason, when i look at the install log file, i see this: 2019-12-17 17:09:38 : SQLite install started Reading package lists... Building dependency tree... Reading state information... E: Unable to locate package php7.0-sqlite3 E: Couldn't find any package by glob 'php7.0-sqlite3' E: Couldn't find any package by regex 'php7.0-sqlite3'

Maybe this could help you Regards Stephan

d3noob commented 4 years ago

Thanks Stephan. Are you able to test with a copy of Jessie? I'm wondering if being specific about the version of SQLite means that I've caused a conflict.

stepdes commented 4 years ago

Hmm no, not for the moment. I’m on buster and there is already some monitoring software running on it. Maybe when i find the time i could test it on an older pi2. Regards

luisbarreto commented 4 years ago

Hi @stepdes

I understand that this might come a little late, but here we go. Just tried PiMetric and also got the same nginx 502 bad gateway error message. Investigating the logs and the installation script I figured out what need to be changed for PiMetric to work on a Raspbian Buster (as of May 2020). Just change the lines below in the installation script and run it again. This will install sqlite correctly and pass the correct PHP sock to fastcgi.

So edit the setup-pimetric-full.sh and change the lines:

from: apt-get install sqlite3 php7.0-sqlite3 -y &>> $LOGFILE 2>&1 to: apt-get install sqlite3 php-sqlite3 -y &>> $LOGFILE 2>&1

and also from: fastcgi_pass unix:/var/run/php/php7.0-fpm.sock to fastcgi_pass unix:/var/run/php/php7.3-fpm.sock

Re-run the script and after reboot point yout browser to http://pimetric.local/read.php or http://pimetric.local/main.php

@d3noob thanks for sharing your project. I just found it and I am exploring its potential :-)

HTH

d3noob commented 4 years ago

Many thanks @luisbarreto!

Thats awesome.

While I don't want to put you off continuing looking into PiMetric, I think when I started writing it I didn't realise that I was essentially reinventing the wheel. I have only recently begun experimenting with Prometheus and Grafana to carry out a similar job and I cannot speak highly enough of them.

If you're keen to try them out on a Raspberry Pi have a look through the installation instructions here.

Regards and thanks again.

luisbarreto commented 4 years ago

This area also interests me and in fact, when I found PiMetrics I was searching, reading and learning about the Telegraf, InfluxDB, Chronograf and Kapacitor (TICK) ecossistem.

@d3noob thanks for pointing your most recent developments in this area :-) I will definitly read your newest work with Prometheus and Grafana. Thanks :-)

krouter commented 3 years ago

@d3noob since I can't run telegraf on pi zero w, what would you recommend as a light weight alternative that can still feed into influxdb running on a separate pi 4?

d3noob commented 3 years ago

Sorry, I don'y have any experience there. I would only be google searching and guessing :-(.