How can I pull current total monthly and personal monthly usage?

Started by Gavin

Hi,

I've got a USB screen setup on my system, is there an SQLite command you could share with me to Select the Total (up and down) use for all users for the current month (I have exclude local network turned on) and another command just for my up/down for the current month? That way I could pull the data and show it on the screen.

Can be just be a raw figure, I'm happy to convert the value into KB/MB/GB/etc as needed if that will make for a simpler SQL statement smile

Thanks very much.

Cheers
Gavin
SoftPerfect Support forum - Andrew avatar image

Re: How can I pull current total monthly and personal monthly usage?   30 December 2016, 21:21

This should give you the figures for the current month:
SELECT 
SUM(DATA_IN) AS DL, 
SUM(DATA_OUT) AS UL, 
SUM(DATA_IN + DATA_OUT) AS BOTH
FROM total_usage
WHERE 
date('1899-12-30', '+' || DAY || ' days')
BETWEEN
date('now', 'start of month')
AND
date('now', 'start of month', '+1 month', '-1 day')
You can add a filter for a specific user simply by adding a clause to WHERE, e.g.
AND USER_NAME = 'foobar'
Perfect! Thank you very much, exactly what I was after.
Now, to script the data to my USB screen!

Reply to this topic

Sometimes you can get the answer faster if you try the forum search and/or have a look at the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

 ********  ********  ********  ********  **     ** 
 **    **     **        **     **        **     ** 
     **       **        **     **        **     ** 
    **        **        **     ******    **     ** 
   **         **        **     **        **     ** 
   **         **        **     **        **     ** 
   **         **        **     **         *******  

Message: