Skip to content
Advertisement

How do I extract data from df ~ onto my website?

I am creating a pie chart which shows how much disk space is available/used on my linux box. However, I am unsure how to parse the data onto a microservice url. Help will greatly be appreciated.

Here is what I have at the moment:

Router:

JavaScript

Controller:

JavaScript

Advertisement

Answer

You might try the approach below, we create a row object for each entry that the df command creates. Once you have this you should be able to create your pie chart from this:

JavaScript

The resulting JSON will look a bit like so :

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement