The Mobile Agent technology has already shown its advantages, but at the same time has already remarked new problems currently limiting its diffusion in commercial environments. A key issue is to control the operations that foreign mobile agents are authorized to perform on hosting execution environments. It is necessary not only to rule the MA access to resources but also to control resource usage of admitted agents at execution time, for instance to protect against possible denial-of-service attacks. The paper presents a solution framework for the on-line monitoring and control of Java-based MA platforms. In particular, it describes the design and implementation of MAPI, an on-line monitoring component that we have integrated within the SOMA system. The paper shows how to use MAPI as the building block of a distributed monitoring tool that gives application- and kernel-level information about the state of mobile agents and their resource usage, thus enabling the enforcement of manag...