Energy management is key in prolonging the lifetime of an energy harvesting Internet of Things (IoT) device with rechargeable batteries. Such an IoT device is required to fulfill its main functionalities, i.e., information sensing and dissemination at an acceptable rate, while keeping the probability that the node first becomes non-operational, i.e., the battery level hits zero the first time within a given finite time horizon, below a desired level. Assuming a finite-state Continuous-Time Markov Chain (CTMC) model for the Energy Harvesting Process (EHP), we propose a risk-theoretic Markov fluid queue model for the computation of first battery outage probabilities in a given finite time horizon. The proposed model enables the performance evaluation of a wide spectrum of energy management policies including those with sensing rates depending on the instantaneous battery level and/or the state of the energy harvesting process. Moreover, an engineering methodology is proposed by which optimal threshold-based adaptive sensing policies are obtained that maximize the information sensing rate of the IoT device while meeting a Quality of Service (QoS) constraint given in terms of first battery outage probabilities. Numerical results are presented for the validation of the analytical model and also the proposed engineering methodology, using a two-state CTMC-based EHP.