Orax SDI Cloud Reference

 
  1. Introduction
  2. Self-Management tools
  3. Communication and Content management
  4. Sales and Customer Relationship Management
  5. Services & Service level management
  6. Billing and customer statements
  7. Inventory & Asset management
  8. Production management
  9. Human Resources and Payroll
  10. Procurement and Supply chain
  11. Ledgers & Accounting
  12. Reporting and Analytics
  13. Administration & configuration
  14. Business Improvement
  15. Development and Process management
    Up    Previous    Next

Scripting for Linux Agents

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 < set head off feedback off serverout on
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;
'

 

    Up    Previous    Next