As anyone with Unix/Linux scripting experience/ Skills would know, it's easy to create a script for a Linux Agent. The Agent executes the script and returns STDIN. So the following script would return the result "GOOD":
echo "GOOD"
Have a look at the Linux Metric Types to get ideas. The following scripts extracts data from an Oracle database:
sqlplus -s ultimatum/ult123@orcl <
exec ultimatum.uptime_performance;
EOF
Start with a small script and expand it. Try testing it on the command line first. The only changes needed to port a script from the shell/command line to the agent are variables. The dollar sign in front of a variable has to be escaped with a backslash (\).
Eg.
awk '{ print $1 }'
should change to:
awk '{ print \$1 }'
Sample perl script:
perl -e '
my $eth="wlan0";
my $t1=`cat /sys/class/net/$eth/statistics/rx_bytes`; chomp($t1);
my $t2=`cat /sys/class/net/$eth/statistics/tx_bytes`; chomp($t2);
my $total = $t1 + $t2;
open(INF,"./net_$eth"); my @old =; close(INF);
my $old = $old[0]; if ($old eq "") { $old = $total; }
open(OUT,">./net_$eth"); print OUT $total; close(OUT);
my $used = ($total - $old) / 1048576;
if ($used < 0) { $used = 0; }
printf "%0.2f",$used;
'