This is part of a larger script. I am having issues with running the child process and splitting the results.
Here is a script that works:
# Set the snmp community string password.
$Comstr = "communitystring";
# Set the server name to query.
$server = "servername";
#Change to the directory the program is in:
chdir "/usr/bin" or die "Cannot chdir /usr/bin: $!";
print "$server\n";
# the $variable doesn't seem to be set.
$variable = system "snmpgetnext", "-v1", "-c", $Comstr, "-O", "Qv", $server, "system.sysUpTime";
#take the variable from above and do a split.
@fields = split /:/,$variable;
## @fields prints a Zero
print "@fields\n";
## $vairiable prints a Zero
print "$variable\n";
#this is what i want the output to look like!!!
@fields2 = split /:/,"13:13:56:52.50";
print "@fields2\n";
Now I've started another script doing the same thing with the Net::SNMP but if the script hits a server that doesn't respond it stops.
thanks for any help.
Here is a script that works:
# Set the snmp community string password.
$Comstr = "communitystring";
# Set the server name to query.
$server = "servername";
#Change to the directory the program is in:
chdir "/usr/bin" or die "Cannot chdir /usr/bin: $!";
print "$server\n";
# the $variable doesn't seem to be set.
$variable = system "snmpgetnext", "-v1", "-c", $Comstr, "-O", "Qv", $server, "system.sysUpTime";
#take the variable from above and do a split.
@fields = split /:/,$variable;
## @fields prints a Zero
print "@fields\n";
## $vairiable prints a Zero
print "$variable\n";
#this is what i want the output to look like!!!
@fields2 = split /:/,"13:13:56:52.50";
print "@fields2\n";
Now I've started another script doing the same thing with the Net::SNMP but if the script hits a server that doesn't respond it stops.
thanks for any help.