Windows uptime statistics

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

royce
Cacti User
Posts: 79
Joined: Wed Dec 29, 2004 7:37 am
Location: Sweden

Post by royce »

Here is what happens ...

Code: Select all

11/23/2005 11:50:17 AM - CACTID: Poller[0] Host[297] DS[21064] SCRIPT: \path\win_uptime.cmd hostname 99.9900, output: cur_uptime:2906263
11/23/2005 11:50:17 AM - CACTID: Poller[0] DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (210
64,'','2005-11-23 11:50:01','cur_uptime:2906263')
11/23/2005 11:50:17 AM - CACTID: Poller[0] Host[297] DEBUG: The POPEN returned the following File Descriptor 9
Something seems to be wrong with the way it sends data.
wvr120364
Posts: 16
Joined: Tue May 06, 2003 7:48 am

Post by wvr120364 »

royce wrote:I've got the same problem - debugging cacti tells that cacti only sees some of the output vars...

Do the maintainer use cactid och php?
royce,

I'm using the php poller, maybe that is the problem. I tried earlier to use the cactid poller but suddenly there is no data collection at all.

Is there anybody were the scripts are working fine?

Wietze
royce
Cacti User
Posts: 79
Joined: Wed Dec 29, 2004 7:37 am
Location: Sweden

Post by royce »

fixed this.. seems to be another buffer-ouput-problem.

Bound my scripts through a executer-wrapper wich is a basic script that outputs the information in one buffer.

A shell script might look like this one - not that I've converted this to linux instead.

Code: Select all

#!/bin/sh
E=`/usr/share/cacti/scripts/uptime/win_uptime.sh $1 $2`

echo $E
exit 0
User avatar
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

same here

Post by proohu01 »

royce wrote:
chewy009 wrote:OK, so i installed this on my "production" cacti box and it seems like it's working. Why is the Required (SLA) showing up as 0.0000%? Will the rest of the graph items fill in over time or should they already be there? I rebooted this box yesterday, hence the 0.98 days of uptime. What do you think?
I've got the same problem - debugging cacti tells that cacti only sees some of the output vars...

Do the maintainer use cactid och php?
Same problem here. :cry:

When I run the CMD from the command prompt, I do get good results. All values are returned. But when cacti does it, it only shows "uptime since last reboot" in the graph.

Any ideas?
xphu
Posts: 12
Joined: Thu Jun 30, 2005 7:31 am
Location: Helsinki, Finland

Post by xphu »

Hi,

I got your nice uptime script working only locally in my Windows 2003 std Server where I am also runnig cacti.

I was not able to get it working with other Devices i.e. Windows Servers which are graphing with cacti.

Please see how the win_uptime.cmd is showing it up.

First with localhost which is working (returns good result) and after even a local host ip 127.0.0.1 does not return a correct result?

C:\Inetpub\wwwroot\scripts\uptime>win_uptime.cmd localhost 99.95
cur_uptime:3569 mean_days:1.59 tot_uptime:5856027 tot_blue:0 tot_downtime:194810
tot_reb:44 avail:96.7804 sla_avail:99.95

C:\Inetpub\wwwroot\scripts\uptime>win_uptime.cmd localhost 99.95
cur_uptime:3570 mean_days:1.59 tot_uptime:5856029 tot_blue:0 tot_downtime:194810
tot_reb:44 avail:96.7804 sla_avail:99.95

C:\Inetpub\wwwroot\scripts\uptime>win_uptime.cmd 172.16.10.251 99.95
tot_blue:1 tot_reb:1 sla_avail:99.95

C:\Inetpub\wwwroot\scripts\uptime>win_uptime.cmd 172.0.0.1 99.95
tot_blue:1 tot_reb:1 sla_avail:99.95

C:\Inetpub\wwwroot\scripts\uptime>

With not working graph I see tot-blue:1 tot-reb:1 sla-avail:99.95 nothing else?

What can be the problem. I cannot use fully qualified domain names for http url? I am not connecting to my cacti server form internet at all.

\xphu
|Cacti user since 0.8.4|
royce
Cacti User
Posts: 79
Joined: Wed Dec 29, 2004 7:37 am
Location: Sweden

Post by royce »

wvr120364 wrote:
royce wrote:I've got the same problem - debugging cacti tells that cacti only sees some of the output vars...

Do the maintainer use cactid och php?
royce,

I'm using the php poller, maybe that is the problem. I tried earlier to use the cactid poller but suddenly there is no data collection at all.

Is there anybody were the scripts are working fine?

Wietze

Script works with cacti here now. Solution was to create that wrapper script and use that instead. read my erlier porst.

I use cactid.
User avatar
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

RE: royce

Post by proohu01 »

I see youre post on the wrapper but I don't get it. How does this work on a windows server?

Should this wrapper replace any files? Could you explain how this helps?
royce
Cacti User
Posts: 79
Joined: Wed Dec 29, 2004 7:37 am
Location: Sweden

Re: RE: royce

Post by royce »

proohu01 wrote:I see youre post on the wrapper but I don't get it. How does this work on a windows server?

Should this wrapper replace any files? Could you explain how this helps?
The reason cacti does'nt read all input fields from the script (win_uptime.cmd) is that, AFAIK, the output is buffered in sections instead of a whole string.

So my solution was tell cacti call another script which basically call the original script and echo the output at one time.
xphu
Posts: 12
Joined: Thu Jun 30, 2005 7:31 am
Location: Helsinki, Finland

uptime.exe

Post by xphu »

Hi,

I think I found the solution for my earlier post.

http://support.microsoft.com/kb/q232243/

So I need to set up correct user privileges for my cacti network.

\xphu
|Cacti user since 0.8.4|
User avatar
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

It is working....

Post by proohu01 »

It's working now.

The only thing I did was to change the poller from cactid to cmd.php. Somehow the CMD.PHP works better for this script.
chewy009
Posts: 38
Joined: Wed Jun 15, 2005 1:18 pm
Location: Washington State, USA

Re: RE: royce

Post by chewy009 »

royce wrote:
proohu01 wrote:I see youre post on the wrapper but I don't get it. How does this work on a windows server?

Should this wrapper replace any files? Could you explain how this helps?
The reason cacti does'nt read all input fields from the script (win_uptime.cmd) is that, AFAIK, the output is buffered in sections instead of a whole string.

So my solution was tell cacti call another script which basically call the original script and echo the output at one time.
Royce,
Not to be completely dumb here, but can give me a step-by-step on what you did. I don't fully understand what you mean here. :oops: Is there a file you can post? I have to use cactid due to the number of graphs I have. Thx.
User avatar
magoo95
Posts: 18
Joined: Tue Nov 15, 2005 9:39 am
Location: Paris, FRANCE

Post by magoo95 »

This is the script you can use under windows to call the original win_uptime.cmd script.

this new script must be declared in the "data input method" in place of win_uptime:

@echo off
set templog=C:\bvra\cacti\scripts\uptime\tempo_%1.log
call C:/bvra/cacti/scripts/uptime/win_uptime.cmd %1 %2 > %templog%
type %templog%
del C:\bvra\cacti\scripts\uptime\tempo_%1.log

and it works fine now:
Attachments
uptimewin.JPG
uptimewin.JPG (61.26 KiB) Viewed 16898 times
fishgod
Posts: 8
Joined: Wed Nov 30, 2005 6:41 pm
Location: Anchorage, Alaska

Post by fishgod »

I am having permission issues. If I run the script as a domain admin I get data. If I let system run it from the cacti poller I get no data. One of the notes on the install for win2003 was to not use a domain account becauce of issues. They suggest using the local system account. Anyone have any ideas on which direction I should go.

Michael
User avatar
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

This might help...

Post by proohu01 »

I used a domain account and placed that account into the local administrators group on the remote servers. That way the account should have the right permissions to query WMI from a remote host.

Use that domain account to schedule the poller. The problem you may see with that is that the poller pops up many time when logged on to the cacti server with that same account. I suggest you us an account that you would not normally use when you logon to the server.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

If you read my faq, I recently created one on how to properly set up WMI so a normal user can query a remote computer.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest