EPA agent – any platform any release
This is not a APM issue. The plugin is running as a stateful plugin and the 15 second interval is controlled in the plugin code itself not by the EP agent via the delayinseconds setting as would be the case for stateless plugins. The problem is not the way that the script is run but in the way python outputs data. It maintains it’s data in a buffer and for performance reasons will only flush the buffer to stdout when it is full. Therefore if the buffer is not filled every 15 seconds the data may not be sent.
To ensure the data is sent for each cycle you need to flush the output buffers using sys.stdout.flush() as shown in the below artificial example
print "<metric type=\"IntAverage\" name=\"MYSCRIPTPY1|VirtualMachine|Process|ME:Cpu Usage %\" value=\"55\" />"
if __name__ == "__main__":