Problems with cmd script

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
boatrke1
Posts: 15
Joined: Fri Oct 13, 2006 4:29 pm

Problems with cmd script

Post by boatrke1 »

I'm attempting to create a script to graph Tivoli Storage Mangager stats.

I've created tsmcactidb.cmd file in order to query the TSM database from the cacti box:

Code: Select all

@echo off
dsmadmc.exe -id=*** -pa=*** -displaymode=list select pct_utilized from db | grep 'PCT_UTILIZED'| gawk '{print $2}'
The output is displayed only as an interger. dsmadmc.exe is the TSM admin command line interface.

Receiving the following error in the cacti log file:

Code: Select all

05/22/2007 03:15:15 PM - CACTID: Poller[0] Host[242] ERROR: Empty result [150.62.90.15]: 'c:/apache2/htdocs/cacti/scripts/baclient/tsmcactidb.cmd'
05/22/2007 03:15:15 PM - CACTID: Poller[0] Host[242] DS[3958] WARNING: Result from SCRIPT not valid. Partial Result: ...
05/22/2007 03:15:15 PM - CACTID: Poller[0] Host[242] DS[3958] SCRIPT: c:/apache2/htdocs/cacti/scripts/baclient/tsmcactidb.cmd, output: U
Removing the @echo off from the script returns the following in the Cacti log file:

Code: Select all

c:\cactid>dsmadmc....
Anyone have any ideas in order to resolve this issue?

Thanks
Kevin

Cacti Version 0.8.6j
Plugin Architecture 1.1
Poller Type Cactid v0.8.6i
Server Info Windows NT 5.2
Web Server Apache/2.0.55 (Win32) PHP/5.1.1
PHP Version 5.1.1
PHP Extensions bcmath, calendar, com_dotnet, ctype, date, ftp, iconv, odbc, pcre, session, libxml, standard, tokenizer, zlib, SimpleXML, dom, SPL, wddx, xml, apache2handler, mysql, snmp, sockets
MySQL Version 4.0.26-nt
RRDTool Version 1.2.12
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

1) whats the script print out when you manually run it?

2) try running the script with the cmd.php poller, does it work?

3) whats the path of in the data query you're using for the script?
boatrke1
Posts: 15
Joined: Fri Oct 13, 2006 4:29 pm

Post by boatrke1 »

1.
With @echo off on the first line of the script:

Code: Select all

C:\Apache2\htdocs\Cacti\scripts\baclient>tsmcactidb.cmd
40

C:\Apache2\htdocs\Cacti\scripts\baclient>
Without @echo off in the script:

Code: Select all

C:\Apache2\htdocs\Cacti\scripts\baclient>dsmadmc.exe -id=*** -pa=*** -displaymode=list select pct_utilized from db | grep 'PCT_UTILIZED' | gawk '{print $2}'
40

C:\Apache2\htdocs\Cacti\scripts\baclient>
2. I've tried the cmd.php poller. Do not receive any error messages in the log file. Graphs never update.

3. I'm using a Data Input Method - Script/Command
c:/apache2/htdocs/cacti/scripts/baclient/tsmcactidb.cmd
boatrke1
Posts: 15
Joined: Fri Oct 13, 2006 4:29 pm

Post by boatrke1 »

2. Here is the message in the log file using php.cmd
05/23/2007 01:15:18 PM - CMDPHP: Poller[0] Host[242] DS[3962] WARNING: Result from CMD not valid. Partial Result:
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Have you read through the documentation site on how to create scripts/templates for cacti? http://docs.cacti.net/node/224. It might give you some pointers on whats missing.
boatrke1
Posts: 15
Joined: Fri Oct 13, 2006 4:29 pm

Post by boatrke1 »

Yes, I've read through the documentation.

Think it might be an issue calling an .exe from the .cmd file?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

No, since the script appears to work fine when you run it. Verify the script works when you run it under the same account the cacti scheduled task runs as.

Also, try turning the logging level to debugging for a cycle and see what its trying to do with your cmd script.
boatrke1
Posts: 15
Joined: Fri Oct 13, 2006 4:29 pm

Post by boatrke1 »

I'm using the same account to run the script that is configured for the poller.

The only other items in the log file are:
05/24/2007 07:41:10 AM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\Apache2\htdocs\Cacti\rra\tivoli_sv_3962.rrd --template SV 1180006852:U
05/24/2007 07:41:10 AM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\Apache2\htdocs\Cacti\rra\tivoli_pct_utilized_3961.rrd --template PCT_UTILIZED 1180006852:U
05/24/2007 07:41:10 AM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\Apache2\htdocs\Cacti\rra\tivoli_dpu_3960.rrd --template DPU 1180006852:U
05/24/2007 07:41:10 AM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\Apache2\htdocs\Cacti\rra\tivoli_dpu_3959.rrd --template DPU 1180006852:U
05/24/2007 07:41:10 AM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\Apache2\htdocs\Cacti\rra\tivoli_pct_utilized_3958.rrd --template PCT_UTILIZED 1180006852:U
05/24/2007 07:41:10 AM - POLLER: Poller[0] CACTI2RRD: c:/rrdtool/rrdtool.exe update C:\Apache2\htdocs\Cacti\rra\tivoli_cpdr_3957.rrd --template output 1180006852:U
It does take ~1-2 seconds to return the result from the sript. Is there a timeout on how long the poller waits for results?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

I was actually meaning to look in the log file when cacti attempted to run the script and grab the results.

I believe there is a timeout, but don't believe its the problem.
boatrke1
Posts: 15
Joined: Fri Oct 13, 2006 4:29 pm

Post by boatrke1 »

Don't really see anything else in regards to the script or host in the debug log.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

post a screenshot of your data input method for this script and data template.
boatrke1
Posts: 15
Joined: Fri Oct 13, 2006 4:29 pm

Post by boatrke1 »

DIm and DT
Attachments
dim.jpg
dim.jpg (203.41 KiB) Viewed 3822 times
dt.jpg
dt.jpg (371.35 KiB) Viewed 3822 times
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

ah-HA! you specified an output field in the DIM, yet your script doesn't actually output PCT_UTILIZED. Thus, cacti doesn't find any data to collect.
boatrke1
Posts: 15
Joined: Fri Oct 13, 2006 4:29 pm

Post by boatrke1 »

ISSUE RESOLVED:

I had the script output "PCT_UTILIZED:<value>" and still didn't work. That's when I changed the script but didn't change the DIM.

I could manually run the script and receive a result. Evidently when the script ran with the poller it would return no result.

Adding a system variable of DSM_DIR pointing to the directory with the dmsadmc.exe file resolved the issue.

Thanks for your help BSOD
Attachments
screenshot.jpg
screenshot.jpg (214.3 KiB) Viewed 3571 times
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests