The concept of available energy in a stratified fluid is revisited from the point of view of non-canonical Hamiltonian systems. We show that the concept of available energy arises when we minimize the energy subject to the constraints associated with the existence of Lagrangian invariants. The non-canonical structure implies that there exists a class of dynamically equivalent Hamiltonians, related by a local (in phase space) gauge symmetry. A local diagnostic energy can be defined via the Hamiltonian density chosen imposing a specific gauge-fixing condition on the class of dynamically similar Hamiltonians. The gauge-fixing condition that we introduce selects a specific local diagnostic energy which is well suited to study the effect of diabatic processes on the evolution of the available energy. Non-inertial effects, which are notoriously elusive to capture within an energetic framework, are naturally included via conservation of potential vorticity. We apply the framework to stratified flows in inertial and non-inertial frames. For stratified Boussinesq flows, when the initial distribution of potential vorticity is even around the origin, our framework recovers the available potential energy introduced by Holliday & McIntyre (J. Fluid Mech., vol. 107, 1981, pp. 221–225), and as such, depends only on the mass distribution of the flow. In rotating flows, the isopycnals of the ground state are generally not flat, and the ground state may have kinetic energy. We finally demonstrate that flows in non-inertial frames characterized by a low Rossby number (
), the local diagnostic energy has, to lowest order in
, a universal character.