ovh / ovh/ovhcloud-cli

[Feature]: Add `vps stats` command

Open
#204 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
179
Forks
35
Avg merge
2d 10h
Merged PRs (30d)
7

Description

Is there an existing issue for this?
  • I have searched the existing issues
Product concerned

Add vps use or vps monitoring or vps stats command to show CPU / Memory / Traffic stats with support for today, last 24h, last 7 days, last month, last 12 months, similar to the web interface on a VPS.

GNU Plot output support would be amazing!


This feature request is because I did try to find a command or sub-command without any luck, so... I tried then to use your API but both the /vps/{serviceName}/use and /vps/{serviceName}/monitoring are deprecated and now deleted (since 2024).

I'm currently resorting to installing vnstat and sysstat on the instance and querying them directly over ssh.

Feature description

Add use or monitoring or stats sub-command on vps to show CPU / Memory / Traffic stats with support for today, last 24h, last 7 days, last month, last 12 months, similar to the web interface on a VPS.

GNU Plot output support would be amazing!

I envision something like:

$ ovhcloud vps stats vps-12345678
== vps-12345678 -- 2026-07-01 15:19:54 AEST ==
 15:19:54 up  5:12,  1 user,  load average: 0.00, 0.00, 0.00

== Memory (now) ==
               total        used        free      shared  buff/cache   available
Mem:           3.7Gi       438Mi       2.8Gi       3.7Mi       771Mi       3.3Gi
Swap:          2.0Gi          0B       2.0Gi

== Disk (now) ==
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        38G  4.4G   34G  12% /

== CPU last 24h (sar -u) ==
          CPU  %user  %nice  %system  %iowait  %steal  %idle
14:00:04  all  0.22   0.00   0.12     0.01     0.00    99.65
14:10:01  all  0.39   0.00   0.19     0.01     0.00    99.41
14:20:04  all  0.29   0.00   0.18     0.01     0.00    99.52
14:30:04  all  0.05   0.00   0.04     0.00     0.00    99.91
14:40:04  all  0.06   0.00   0.05     0.00     0.01    99.88
14:50:04  all  0.06   0.00   0.04     0.00     0.00    99.89
15:00:04  all  0.04   0.00   0.03     0.00     0.01    99.91
15:10:04  all  0.06   0.00   0.04     0.00     0.00    99.89
Average:  all  0.18   0.03   0.12     0.01     0.00    99.67

== Memory last 24h (sar -r) ==
          kbmemfree   kbavail     kbmemused  %memused  kbbuffers  kbcached   kbcommit   %commit  kbactive   kbinact    kbdirty
14:00:04  2944412     3493664     130436     3.33      42092      702876     736264     12.25    282156     528752     236
14:10:01  2941756     3491496     132436     3.39      42260      703200     738024     12.28    284420     528972     452
14:20:04  2935720     3485808     138160     3.53      42404      703388     732812     12.20    280812     529196     140
14:30:04  2940904     3491164     132788     3.39      42520      703448     735996     12.25    282520     529364     144
14:40:04  2937804     3488372     135568     3.47      42668      703612     732812     12.20    280964     529540     104
14:50:04  2946192     3497560     126388     3.23      42816      704264     732812     12.20    280992     530344     140
15:00:04  2940100     3491676     132264     3.38      42984      704300     732812     12.20    280992     530548     136
15:10:04  2932620     3484424     139524     3.57      43164      704344     732812     12.20    281008     530772     212
Average:  2979836.39  3502466.31  129894.39  3.32      32035.84   687821.69  518121.84  11.47    220022.24  542137.14  169.53

== Load last 24h (sar -q) ==
          runq-sz  plist-sz  ldavg-1  ldavg-5  ldavg-15  blocked
14:00:04  0        148       0.00     0.00     0.00      0
14:10:01  1        149       0.00     0.00     0.00      0
14:20:04  0        147       0.00     0.00     0.00      0
14:30:04  0        144       0.00     0.00     0.00      0
14:40:04  0        146       0.00     0.00     0.00      0
14:50:04  0        143       0.00     0.00     0.00      0
15:00:04  0        142       0.00     0.00     0.00      0
15:10:04  0        143       0.00     0.00     0.00      0
Average:  0.02     139.30    0.00     0.00     0.00      0.00

== Traffic -- last 24h hourly (ens3) ==

 ens3  /  hourly

         hour        rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
     2026-07-01
         13:00    474.46 KiB |  453.29 KiB |  927.75 KiB |    2.11 kbit/s
         14:00    371.87 KiB |  613.75 KiB |  985.61 KiB |    2.24 kbit/s
         15:00     84.33 KiB |  147.07 KiB |  231.41 KiB |    2.11 kbit/s
     ------------------------+-------------+-------------+---------------

== Traffic -- per day ==

 ens3  /  daily

          day        rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
     2026-07-01   930.66 KiB |    1.19 MiB |    2.09 MiB |    2.63 kbit/s
     ------------------------+-------------+-------------+---------------
      estimated     5.17 MiB |    6.74 MiB |   11.91 MiB |

Above stats are from sysstat showing last 8 readings + a (custom) average over the last 24 hours, as well as hourly/daily traffic averages from vnstat.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the existing vps command entry point and inspect how service actions are exposed. Review the deprecated /vps/{serviceName}/use and /vps/{serviceName}/monitoring endpoints and determine the supported data source and time ranges; done means a working stats subcommand with CPU, memory, and traffic output matching the requested periods, with plotting support if feasible.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, cloud, observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.