  We constrain gas and dark matter (DM) parameters of galaxy groups and
clusters, by comparing X-ray scaling relations to theoretical expectations,
obtained assuming that the gas is in hydrostatic equilibrium with the DM and
follows a polytropic relation. We vary four parameters: the gas polytropic
index Gamma, its temperature at large radii T_xi, the DM logarithmic slope at
large radii zeta and its concentration c_vir. When comparing the model to the
observed mass-temperature (M-T) relation of local clusters, our results are
independent of both T_xi and c_vir. We thus obtain constraints on Gamma, by
fixing the DM profile, and on zeta, by fixing the gas profile. For an NFW DM
profile, we find that 6/5<Gamma<13/10, which is consistent with numerical
simulations and observations of individual clusters. Taking 6/5<Gamma<13/10
allows the DM profile to be slightly steeper than the NFW profile at large
radii. Upon including local groups, we constrain the mass-dependence of Gamma
and the value of T_xi. Interestingly, with Gamma=6/5 and zeta=-3, we reproduce
the observed steepening/breaking of the M-T relation at low M, if 10^6
K<T_xi<10^7 K, consistent with simulations and observations of the warm-hot
intergalactic medium. When extrapolated to high redshift z, the model with a
constant Gamma reproduces the expected self-similar behaviour. We also account
for the observed, non-self-similar relations provided by some high-z clusters,
as they provide constraints on the evolution of Gamma. Comparing our model to
the observed luminosity-temperature relation, we discriminate between different
M-c_vir relations: a weak dependence of c_vir on M is currently preferred by
data. This simple theoretical model accounts for much of the complexity of
recent, improved X-ray scaling relations, provided that we allow for a mild
dependence of Gamma on M or for T_xi consistent with intercluster values.
[abridged]
