Hi @Chua Liang Wei ,
Cyril has a point as always. You need to package the logic within a Lunux shell command and configure a Linux Two State Script Monitor in SCOM.
So the shell command will be run by the SCOM on your Linux agent and will get back the data to SCOM in the form of a property bag.
Here are two nice examples on how to achieve this:
SCOM 2012 – Linux Two-State Monitor With “Script In Script”
https://www.stefanroth.net/2012/10/21/scom-2012-linux-two-state-monitor-with-script-in-script/
and
OpsMgr 2012 UNIX/Linux Authoring Templates: Shell Command
http://operatingquadrant.com/2012/01/30/opsmgr-2012-unixlinux-authoring-templates-shell-command/
So, figure out the shell comand, configure the script monitor in SCOM and run it from there.
Hope this was helpful.
----------
(If the reply was helpful please don't forget to upvote or accept as answer, thank you)
Regards,
Stoyan