Orax SDI Cloud Reference

 
  1. Introduction
  2. Self-Management tools
  3. Communication and Content management
  4. Sales and Customer Engagement
  5. Service Desk
  6. Project Management
  7. Automation & Wide-Area-Monitoring
  8. Job Cards
  9. Education & B-2-B online training
  10. Billing and customer statements
  11. Inventory & Asset management
  12. Production management
  13. Human Resources and Payroll
  14. Procurement and Supply chain
  15. Ledgers & Accounting
  16. Reporting and Analytics
  17. Administration & configuration
    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