Hi,
have you already read this document?
https://checkmk.com/cms_devel_check_plugins.html
I suggest you first write a script that takes these 4 arguments as parameters and that returns 0 on success, 1 on warning, 2 on critical, else 3 (unknown).
You can use any programming language, but if you’re not sure then use python since most of the other plugins are written in it.