Create a prometheus exporter for freebsd

Freebsd create statistics as a command-line application which writes statistics in prometheus format.

The output of the program on the commandline looks like this,
HTTP/1.1 200 OK
Connection: close
Content-Length: 407302
Content-Type: text/plain; version=0.0.4

sysctl_kern_osrevision 199506
sysctl_kern_maxvnodes 213575
sysctl_kern_maxproc 13508
sysctl_kern_maxfiles 259846
sysctl_kern_argmax 524288

9000 other measurements

How do I write a full blown web-listening prometheus exporter for this ?
It should be possible with little code, but how ?

The man page suggests inetd, and the utility seems to add HTTP response headers. U think the way this is supposed to work is that you add it as a TCP service in inetd. When Prometheus connects, it sends the HTTP request, but that is ignored – the “exporter” blindly responds with the headers and content.