- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script is producing garbage at end
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2011 07:43 AM
07-19-2011 07:43 AM
script is producing garbage at end
Hi all:
Using nagios 3.2.3 to monitor services. Trying to run a script for monitoring. Problem is that on HPUX 11.23 & 11.31 systems the script produces garbage output at the end. Example, here is the script
- #!/bin/ksh
- WAITIO=`sar -i 1 3 | tail -1 | awk '{print $4}'`
- CRIT=50
- echo "%waitio = $WAITIO | /=$WAITIO%;;$CRIT;0;100"
- exit 0
And the output
[nagios@nagserver ~]$ check_nrpe -H hostname -c 'check_HPwait'
- %waitio = 6 | /=6%;;50;0;100
- ��w���
See that garbage at the end? How do I prevent that from happening on the HP systems?
Many thanks!
- Tags:
- nagios
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2011 12:24 PM
07-19-2011 12:24 PM
Re: script is producing garbage at end
Hi Rick:
@Rick Garland wrote:
- ��w���
See that garbage at the end? How do I prevent that from happening on the HP systems?
It's not clear to me if this is a mangled representation on the new Forum or not. Could you show us what you have pasted into a code-block to prevent interpretation? Could you pipe your script's output into 'cat -etv' or 'od -tax2' please?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2011 12:32 PM
07-19-2011 12:32 PM
Re: script is producing garbage at end
i wonder if the problem isn't actually over on the nagios server. this line
%waitio = 6 | /=6%;;50;0;100
has a very nagios-look to it and running the bit of script by-hand on hpux doesn't produce any strange characters (at least for me). is 'waitio' a(nother) nagios script? are the spaces before/after the 1st equal sign problematic? or even all the spaces on that line?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2011 12:53 PM
07-19-2011 12:53 PM
Re: script is producing garbage at end
There should be no output after your last echo.
Unless that sar call is sending output to stderr?
Why don't you redirect your stdout and stderr for your script and see where the garbage goes?
your-script > stdout 2> stderr
Otherwise tusc is your friend.
- Tags:
- tusc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2011 07:53 AM
07-20-2011 07:53 AM
Re: script is producing garbage at end
[nagios@nagserver libexec]$ check_nrpe -H hostname -c 'check_HPwait' | cat -etv
%waitio = 2 | /=2%;;50;0;100^M$
$
M-(wM-}M-3M-^XwM-}M-3M-^X@^AM-_M-l@$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2011 08:03 AM
07-20-2011 08:03 AM
Re: script is producing garbage at end
Thank you all, you have provided some more ideas for me.
My suspicions are with the nrpe agent on the HPUX systems. I did download the source and compile on HP using the HP compiler.
I can run similar sar commands via nrpe to Linux systems without the funky output. And I can run the same command locally without the funky output.
I tried redirecting, no joy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2011 08:28 AM
07-20-2011 08:28 AM
Re: script is producing garbage at end
Hi (again) Rick:
I suppose we could band-aid the wound:
# check_nrpe -H hostname -c 'check_HPwait' | perl -pe 's/[^([:print:]|[:space:]]//g'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2011 10:25 AM
07-20-2011 10:25 AM
Re: script is producing garbage at end
>I did download the source and compile on HP using the HP compiler.
Then dust off your debugger and find that print at the end.
tusc could be used to see if that garbage is a separate write or part of a buffer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2011 07:11 AM
07-22-2011 07:11 AM
Re: script is producing garbage at end
Hi all:
I tried the band aid; perl, sed, tr - still there.
Interesting, I did find that if I nest the command in a conditional of some sort, ( if,then ) then the output is clean.
Example;
- !/bin/ksh
- CRIT=50
- WAITIO=`sar -i 1 3 | tail -1 | awk '{print $4}'`
- if [ "$WAITIO" -ge "$CRIT" ]
- then
- echo "%waitio = $WAITIO | /=$WAITIO%;;$CRIT;0;100"
- exit 2
- else
- echo "%waitio = $WAITIO | \=$WAITIO%;;$CRIT;0;100"
- fi
Run the command and pipe through 'cat -etv' and all that's left is a $ sign at the end of the output, the rest of the garbage is gone. Any idea why this might be?
tusc is definitely an option I should explore. And definitely one I should have in my toolbox.
Many Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2011 02:02 PM
07-22-2011 02:02 PM
Re: script is producing garbage at end
>I did find that if I nest the command in a conditional of some sort
The only difference is that exit. Do you cover both paths and both eliminate the garbage?
Make sure you print out the exit status of each run or change the one of the messages.