Help w/Solaris script.

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
Stiletto
Posts: 14
Joined: Sat Sep 13, 2003 5:16 pm

Help w/Solaris script.

Post by Stiletto »

I am using the Nagios Check_nt client to remotely check Win2k servers. I am using the following script to get memory usage %:

#!/usr/bin/perl

$response = `/usr/local/cacti/scripts/check_nt -H $ARGV[0] -p 1248 -v MEMUSE`;
chomp $response;
($used) = ($response =~ /used: \d+.\d+ Mb \((\d+)\%\) /);

print "$used\n";

This script works fine from the command line but when I run cmd.php the output: is always blank. It has to have something to do with this line:

($used) = ($response =~ /used: \d+.\d+ Mb \((\d+)\%\) /);

which strips the response. Why would this line cause Cacti to not see the response at all?? Any help would be greatly appreciated. Using Solaris 9.

-stiletto
waxling
Posts: 4
Joined: Sat Jun 26, 2004 10:27 pm

Post by waxling »

one word...

environment (specifically your command line has one, cron have the same environment as you). If so, its not a solaris problem.

(check ldd of /usr/local/cacti/scripts/check_nt and see what it is linked to, then "man crle")
Stiletto
Posts: 14
Joined: Sat Sep 13, 2003 5:16 pm

Post by Stiletto »

Thanks for the message.

# ldd check_nt
libnsl.so.1 => /usr/lib/libnsl.so.1
libsocket.so.1 => /usr/lib/libsocket.so.1
libresolv.so.2 => /usr/lib/libresolv.so.2
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
libmp.so.2 => /usr/lib/libmp.so.2
/usr/platform/SUNW,Sun-Blade-1000/lib/libc_psr.so.1


I'm not totally familiar with Solaris...so how do I check the "ldd" of cron and set them to this?

-stiletto
Miaowl

Post by Miaowl »

You could just add the missing LD_LIBRARY_PATH to your environment through perl. For example, to get a perl script that uses SNMP to run via cron, I use:

$ENV{LD_LIBRARY_PATH}="/usr/local/ssl/lib/";

This works a charm for me.


Miaowl.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests