Sorry, that code looks messy all on one line.
Same code, better looking. ;-)
Main Topics
Browse All TopicsHi All,
I've got a nagios check that logs into our RPC's and pulls the AMP status, its been working great. Today my boss asked if I can somehow get this information into mysql as well for him to parse through....
I got everything working fine, except if the database is down...the script throws and error and does not continue.
I've been trying to figure out how to make the script output the following whether the DB is up or down.
print "OK; The Bottom RPC Amp is@botamp\n";
exit 0; (or exit 1,2,3 - depending on the AMP value)
the die statement on line 20 seems to work well, except it throw a status 255 -- i cant figure out how to set the exit code to 0.
any thoughts....
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
ahhh ...thanks so much - I just could not figure out how to write that *; exit(0);); part.
works wonderfully ...
[root@poll1 dev]# ./rpcampbottom rpc1
OK; The Bottom RPC Amp is 13.6 Amps
[root@poll1 dev]# echo $?
0
[root@poller1 dev]# service mysqld stop
Stopping MySQL: [ OK ]
[root@poll1 dev]# ./rpcampbottom rpc1
OK; The Bottom RPC Amp is 13.5 Amps
[root@poll1 dev]# echo $?
0
[root@poll1 dev]#
Business Accounts
Answer for Membership
by: nemws1Posted on 2009-08-27 at 21:46:50ID: 25205010
Hmmm.. how about a code block? (Here named "LEAVENOW" - the name doesn't really matter, but it needs to be named in some way.)
There might be a way to use eval with a 'die' and then look at the return code, but I think this is easier (and probably a little bit more readable).
P.S. I hope that isn't actually your password for root.
Select allOpen in new window