You can take a look at skeleton subagent - src/agent/subagents/skeleton. It can be used as a template for creating your own subagent.
For restarting specific services - you do not need any development for this, it can be done via configuration. You can define actions in agent and call them either from event processing policy or via object tools.
For storing additional information on server, you can either create your own additional table in database, or use object's custom attributes. Anyway, you will need to write small server module to handle this.
Best regards,
Victor