gwia.pl cannot got output(CLOSED)

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
mickkylai
Posts: 3
Joined: Wed Sep 13, 2006 12:48 am

gwia.pl cannot got output(CLOSED)

Post by mickkylai »

I have just create a data input method using scripts/command gwia.pl

#!/usr/bin/perl

my $hostname = $ARGV[0];

chomp $hostname;

if ($hostname eq '') {
$hostname = "localhost";
}

$output = `/usr/bin/snmpget -v1 -c public $hostname .1.3.6.1.4.1.23.2.70.1.6.0`;
$output =~ /SNMPv2-SMI::enterprises.23.2.70.1.6.0 = Counter32: (.*)/;
print "BytesIn:".$1." ";

$output = `/usr/bin/snmpget -v1 -c public $hostname .1.3.6.1.4.1.23.2.70.1.5.0`;
$output =~ /SNMPv2-SMI::enterprises.23.2.70.1.5.0 = Counter32: (.*)/;
print "BytesOut:".$1." ";

$output = `/usr/bin/snmpget -v1 -c public $hostname .1.3.6.1.4.1.23.2.70.1.57.0`;
$output =~ /SNMPv2-SMI::enterprises.23.2.70.1.57.0 = Counter32: (.*)/;
print "smtpdMsgsIn:".$1." ";

$output = `/usr/bin/snmpget -v1 -c public $hostname .1.3.6.1.4.1.23.2.70.1.58.0`;
$output =~ /SNMPv2-SMI::enterprises.23.2.70.1.58.0 = Counter32: (.*)/;
print "smtpdMsgsOut:".$1;


but when I turn on debug only output as : BytesIn: BytesOut: smtpdMsgsIn: smtpdMsgsOut:
no any value return from the scripts.

Data Input Methods [edit: gwia_msg]

Name
Enter a meaningful name for this data input method.
Input Type
Choose what type of data input method this is. SNMP SNMP Query Script/Command Script Query Script - Script Server (PHP) Script Query - Script Server
Input String
The data that is sent to the script, which includes the complete path to the script and input sources in <> brackets.


Input Fields Add

Name Field Order Friendly Name
host 1 hostname


Output Fields Add

Name Field Order Friendly Name Update RRA
BytesIn 0 (Not In Use) gwiaStatBytesIn Selected
BytesOut 0 (Not In Use) gwiaStatBytesOut Selected
smtpdMsgsIn 0 (Not In Use) gwiasmtpdMsgsIn Selected
smtpdMsgsOut 0 (Not In Use) gwiasmtpdMsgsOut Selected




scripts running output from shell as below:
BytesIn:807028478 BytesOut:748434728 smtpdMsgsIn:4942 smtpdMsgsOut:2192

please help me.

Thank very much.
Last edited by mickkylai on Thu Sep 14, 2006 1:06 am, edited 1 time in total.
mickkylai
Posts: 3
Joined: Wed Sep 13, 2006 12:48 am

gwia.pl scripts get not output value

Post by mickkylai »

It MUST BE the scripts error when I only print output in scripts it's OK.

but how can I change the scripts to work property?

Thks!
mickkylai
Posts: 3
Joined: Wed Sep 13, 2006 12:48 am

gwia.pl cannot get output value(CLOSED)

Post by mickkylai »

I update my scripts and NOW it running OK.

#!/usr/bin/perl

my $hostname = $ARGV[0];
$SNMP_GET_CMD = "snmpget -v1 -c public -Ovq";
chomp $hostname;

if ($hostname eq '') {
$hostname = "localhost";
}

$output1 = `$SNMP_GET_CMD $hostname .1.3.6.1.4.1.23.2.70.1.6.0`;
chomp($output1);
$output2 = `$SNMP_GET_CMD $hostname .1.3.6.1.4.1.23.2.70.1.5.0`;
chomp($output2);
$output3 = `$SNMP_GET_CMD $hostname .1.3.6.1.4.1.23.2.70.1.57.0`;
chomp($output3);
$output4 = `$SNMP_GET_CMD $hostname .1.3.6.1.4.1.23.2.70.1.58.0`;
chomp($output4);
print "BytesIn:".$output1." BytesOut:".$output2." smtpdMsgsIn:".$output3." smtpdMsgsOut:".$output4;
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests