LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-02-2011, 02:59 AM   #1
tan.darell
LQ Newbie
 
Registered: May 2011
Posts: 6

Rep: Reputation: 0
Script execution failed. Input string was not in a correct format


Hi,

I have here a Network Monitoring tool that should monitor the Apache (httpd) 2.0 on CentOS 4.3, but I didn’t have any background in using linux, I tried CentOS 5.5 with Apache (httpd)2.2 and it works, but whenever I tried it on Centos 4.3, it doesn’t work at all, it has an error “Testing on node localhost.localdomain: failed with ‘Undefined’ status, Script execution failed. Input string was not in a correct format.”

Would appreciate very much if you would outline us what to do step by step to correct the issue. Forgive our limitations on Linux....We really need your assistance on this.
 
Old 05-02-2011, 03:14 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Hi and welcome to LinuxQuestions!

First the questions:
1. what is the Network Monitoring tool you've mentioned? Please be more specific.
2. what is the complete error message? If it is a shell script, it should mention the exact line of code where the error occurr.
3. if relevant, please post the content of the script using code tags for readability: http://www.linuxquestions.org/questi...do=bbcode#code. Thanks.
 
Old 05-02-2011, 03:40 AM   #3
tan.darell
LQ Newbie
 
Registered: May 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Hi,

1. The Network Monitoring tool is SolarWinds APM.
2. The complete error message is "Testing on node localhost.localdomain: failed with 'Undefined' status, Script execution failed. Input string was not in a correct format.
3. I think there's no problem with the script, because I already tested it on CentOS 5.5 and it works, only on older version of CentOS it doesn't work.

Here's a sample of the script that should be monitored by SolarWinds APM:


#!/usr/bin/perl
#
#
# Copyright ?? 1999-2008 SolarWinds, Inc. All Rights Reserved.
#
#
use LWP::UserAgent;

if (@ARGV[0] =~ /\bhelp\b/)
{
print "ServerKBytesPerRequest.pl StatusURL\n";
print "StatusURL - url to apache server status (ex. www.mysite.com/server-status ) \n";
exit 1;
}

# Get hostname and trim newline

$localhost = `hostname`;
$localhost =~ s/\s*$//g;
$hostname = shift || "localhost"; # $localhost

$url = "$hostname/server-status?auto&match=www&errors=0";
# Create a user agent object
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);

# Create a request
my $req = new HTTP::Request GET => "http://$url";
#print "http://$url\n";
$req->content_type("application/x-www-form-urlencoded");
$req->content("match=www&errors=0");

# Pass request to the user agent and get a response back
my $res = $ua->request($req);
my $val ="";
# Check the outcome of the response
if ($res->is_success) {
#print $res->content;
$content = $res->content;
while ( $content =~ /BytesPerReq:\s(\d*)/g ){
$val = sprintf("%.2f",$1 / 1024);
print "Message: Traffic at host \"$hostname\": $val\n";
print "Statistic: $val\n";
exit 0;
}
} else {
print "Message: unable access to $hostname\n";
print "Statistic: 0\n";
exit 1;
}
 
Old 05-03-2011, 11:56 PM   #4
tan.darell
LQ Newbie
 
Registered: May 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Hi,

I already solved the issue on this one, I add "localhost" on command line of the script, instead of perl ${script} alone, it becomes "perl ${script} localhost"...

Thanks to those who tried to help me....

Hope you could help me again on future problems....


Darell E. Tan
 
Old 05-04-2011, 08:32 AM   #5
tan.darell
LQ Newbie
 
Registered: May 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Hi,

After I resolved the issue, there's another one issue that arise, "Testing on node localhost: failed with 'Undefined' status, Invalid script return code: 9", does anyone out there can help me on my problem?

Monitoring tool: SolarWinds Application Performance Monitor
Version: 4.0.1

Linux OS: CentOS 4.3
Apache version: 2.0.52


Thanks in advance....

Darell
 
Old 05-04-2011, 07:25 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
Given that that kind of msg doesn't appear in the code you showed, I suspect there's more than one Perl prog involved. You'll have to dig a little deeper.
I also suggest you learn some Perl to save you time
http://perldoc.perl.org/
http://www.perlmonks.org/?node=Tutorials
 
Old 05-06-2011, 11:28 PM   #7
tan.darell
LQ Newbie
 
Registered: May 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Hi,

Do your think that the perl is the problem? can you help me on this? I urgently need this thing to work, I don't have more time to study the perl tutorial and I have zero knowledge on linux.


Thanks...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script: Delete lines til string found or until particular string. bhargav_crd Linux - General 3 12-21-2007 12:14 AM
Bash script to check the input string length fjkum Programming 3 06-30-2007 09:43 PM
execution of init failed srikanth.patil Linux - Software 1 12-29-2006 10:26 AM
cvs rtag: script execution failed: permission denied markpetit Linux - Software 0 05-25-2005 12:47 PM
unpacking of archive failed: cpio: read failed-input/output error rafc Linux - Newbie 0 04-21-2004 10:03 AM


All times are GMT -5. The time now is 02:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration