It took me a bit of research to learn it wasn’t a memory issue. So I’d like to propose the Administration page display “real” or “available” memory instead of Linux memory in the admin_main_view.php file.
Nice fixes. I see you have included Andy in your message text but he does not seem to be included in this PM.
Submitted a file change proposal via Github is not difficult. The easiest way is just to edit the file directly on github: Editing files - GitHub Docs
Please, could you do this to submit a pull-request since there it’s easy for me to change the wrong bit etc. Github is amazingly useful, it’s well worth trying to get acquainted with it.
Mosquitto version in Emoncms admin will be super useful, this has been a recent topic since a mosquitto update broke the emonPi implementation: Mosquitto not starting after emonSD update & upgrade. It would be great if users could easily see which version their running.
And it includes Andy so I think he is part of this PM.
Thanks for the github link, I’ll read thru it!
In a post many month ago you had mentioned the emonPi updates come from the stable version of emoncms. So I normally watch and review the stable version. But I noticed there are four Branches so I wasn’t sure what Branch to modify.
I also looked at a few other repositories and did not see a branch named stable and became confused about the overall process for repositories.
Wops, your right. Sorry @Andy_Taylor, I didn’t spot you!
Correct, emonPi pull from stable however all changes should be made to master then I can review and eventually when stable and tested release periodically into stable which usually includes an Emoncms version number bump.
There is only a stable branch on emoncms core. The emonPi pull from the master branch on the other repos e.g dashboard etc. Ideally we should have a stable branch on all repos, however, the core is the most actively developed and has the greatest chance of breaking stuff if a bug gets committed!
I’ve been deliberately not joining this thread, because if I just solved your problem, you wouldn’t have tried @Jon - it’s great to see you having a go and sharing back to the community, don’t give in.
My Pi is currently spread all over my desk (been working on another Pi related project this week) - I’ll stick it back together and see if we can’t get this going for you…
Jon - your version code for Mosquitto was very good - I pretty much used that exactly in the pull request just submitted, it needed wrapping up in PHP - but I used pretty much exactly what you submitted as the basis for the code (you should be able to see my PR on GitHub here: Update admin_main_view.php by AndyTaylorTweet · Pull Request #578 · emoncms/emoncms · GitHub - feel free to take a look.
Also your suggestions about the RAM use are spot on, rather than show RAM used with buffers / cache and without buffers / cache, I believe its more use to all of us to only show the figure without buffers / cache included, since that is what we’re all actually interested in, so I just modified the current graph rather than adding a new one.
Glyn - PR submitted for the changes, due to the use of Grep etc the mosquito versioning is going to be limited to Linux / unix hosts, so there is some detection wrapped around that, Windows hosts will get the old N/A and linux hosts will get the version pulled so long as the binary is where its expected to be (that is also tested).
but I cannot figure out the checkout and pull for your code (still learning!)
It was fun figuring out the Memory side and I did learn. But the exec command with the mosquitto -h command was giving me fits!
I created a small PHP file and tried any and all exec commands I could find but I kept getting errors like this:
PHP Parse error: syntax error, unexpected '(' in /home/pi/data/myApps/mqttver.php on line 4
PHP Notice: Array to string conversion in /home/pi/data/myApps/mqttver.php on line 6
PHP Parse error: syntax error, unexpected ';' in /home/pi/data/myApps/mqttver.php on line 6
sh: 1: mosquitto -h | grep -oP '(?<=mosquitto\sversion\s)[0-9.]+(?=\s*.build)': not found
PHP Parse error: syntax error, unexpected 'echo' (T_ECHO) in /home/pi/data/myApps/mqttver.php on line 5
sh: 1: /usr/sbin/mosquitto -h: not found
(no need to explain any of my errors I just included them as an example)
Your issues with executing your command line relate to the use of quotes.
in PHP to run something on the command line and return the results you will use “exec”.
Something like <?php exec ('whoami'); ?> would return the user running the command on the command line.
so since you already have quotes in your command, you would need to “escape” those quotes in order for them to be passed to the command line rather than PHP interpreting them.
Depending on how much programming you have ever done, this will either make complete sense, or you will be left with a feeling of “what the hell does this mean”.
If you are at the latter of those, do a little googling, and then ask any questions you have.