Recently, quantum metrology with multiplicative Hamiltonians has been proposed in the variational quantum algorithms, from which the estimation precision can be adaptively optimized via the variational circuits. For systems with general Hamiltonians, however, still lack these variational schemes. In this work, we introduce a quantum-circuit-based approach for studying quantum metrology with general Hamiltonians. We introduce the stochastic parameter-shift rule for the derivatives of the evolved quantum state under the parameterized gates in the circuit, whereby the quantum Fisher information can be obtained. Here the parameters are those we wish to estimate. We find that under the family of the parameterized gates, our scheme can be executed in universal quantum computers. Moreover, in the examples of the magnetic field estimation, we show the consistency between the results obtained from the stochastic parameter-shift rule and the exact results while the standard parameter-shift rule slightly deviates from the exact ones. Our work sheds new light for studying quantum metrology with general Hamiltonians using quantum circuit algorithms.