Check canister storage size programmatically

Is there any way to check the total canister storage size in Motoko?

I think you can get that by calling the canister_status method of the IC management canister. That method should return a record with memory_size as a field.

You can access that canister in Motoko using actor "aaaaa-aa", I believe.