Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Windows uptime statistics
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
wvr120364



Joined: 06 May 2003
Posts: 16

PostPosted: Tue Nov 22, 2005 8:21 am    Post subject: Windows uptime statistics Reply with quote

Hi,

After searching this forum for a Windows uptime script I found this thread that gave me enough information to go on and build a script based on my needs. The solution from Thomas Rupp in message:http://forums.cacti.net/viewtopic.php?t=6998 did the trick.

Here is a preview of the graph that it produces:


Installation instructions:
1.- Download uptime.zip and save it to a local folder.
2.- Extract the file to a subdirectory \uptime.
3.- Copy its contents to, exept the two XML-files, to a new directory \uptime under the <path to cacti>\scripts drectory. The data-template assumes <path to cacti>\scripts\uptime.
4.- Go to this new dir. and edit win_uptime.cmd. Find the three set variables and change them to your needs.

Code:
set htmlfile=d:\<path to cacti>\cacti\log\uptime_%1.html
set htmladdr=http://www.your.domain/cacti/log/uptime_%1.html
set script_path=d:\<path to cacti>\cacti\scripts\uptime\

5.- import the data_template and graph_template trough console -> Import templates.
6.- If you have placed the scripts and programmes in another place you have to edit the Data Input Methods [edit: Windows uptime].
Code:
<path_cacti>/scripts/uptime/win_uptime.cmd <hostname> <sla_avail>
to your needs.
7.- After that you can create a new graph for your device. The hostname is already taken and you will be asked to give the required avalability. Default is 99.9900%.
8. Wait for two or three pollings and the results will show up.

Remarks:
1,- This script counts and evaluate the readings of eventnumber 6005 in the eventlog. If the eventlog is reset, the script starts at zero, but gives you the history.
2.- Maybe there is an easier way to collect the data, please feel free to alter and post your solution here.
3.- This is my first atempt to create a solution in this way. I hope it all works for you. Tested on cacti: 8.6.g.

Wietze Visscher



uptime.zip
 Description:
Uptime scripts and programmes

Download
 Filename:  uptime.zip
 Filesize:  213.76 KB
 Downloaded:  4419 Time(s)

Back to top
tman
Cacti User


Joined: 14 Oct 2004
Posts: 89

PostPosted: Tue Nov 22, 2005 8:42 am    Post subject: Reply with quote

Sounds cool. Was this created under 0.8.6g by any chance? I'm still running 0.8.6f at the moment, and get a 'Hash version does not exist' when trying to import the templates.

Cheers
Back to top
Thomas
Cacti User


Joined: 09 Dec 2004
Posts: 112
Location: Austria

PostPosted: Tue Nov 22, 2005 8:42 am    Post subject: Reply with quote

WOW, I'm really impressed!
Back to top
wvr120364



Joined: 06 May 2003
Posts: 16

PostPosted: Tue Nov 22, 2005 8:56 am    Post subject: Reply with quote

tman wrote:
Sounds cool. Was this created under 0.8.6g by any chance? I'm still running 0.8.6f at the moment, and get a 'Hash version does not exist' when trying to import the templates.

Cheers


tman,

It is for verion 8.6g. I don't know how to downgrade it to a lower version. Maybe some other can help you.

Wietze
Back to top
chewy009



Joined: 15 Jun 2005
Posts: 38
Location: Washington State, USA

PostPosted: Tue Nov 22, 2005 1:03 pm    Post subject: Reply with quote

The install went fine but I get the following error in the cacti log everytime it runs.

11/22/2005 10:00:06 AM - CACTID: Poller[0] Host[1] ERROR: Empty result [127.0.0.1]: 'C:/Apache2/htdocs/cacti/scripts/uptime/win_uptime.cmd 127.0.0.1 99.9900'

It is giving me this error on multiple machines. Also, the RRD file is not updating either.
Back to top
wvr120364



Joined: 06 May 2003
Posts: 16

PostPosted: Tue Nov 22, 2005 1:25 pm    Post subject: Reply with quote

chewy009 wrote:
The install went fine but I get the following error in the cacti log everytime it runs.

11/22/2005 10:00:06 AM - CACTID: Poller[0] Host[1] ERROR: Empty result [127.0.0.1]: 'C:/Apache2/htdocs/cacti/scripts/uptime/win_uptime.cmd 127.0.0.1 99.9900'

It is giving me this error on multiple machines. Also, the RRD file is not updating either.

chewy009,

Try a different hostname, like localhost or ip-adress. I will test it also.

I set up a new device 'Test' with Ip 127.0.0.1 and after two cycles I get a nice graph with the first results. I don't have a clue what is going wrong with your configuration. Try also if you can run the script from the command-line, like:
Code:
d:\<path to cacti>\scripts\uptime> win_uptime.cmd 127.0.0.1 99.9900

If you get any readings, maybe the configuration of the set parameters in win_uptime.cmd are not correct. Please post the results.

Wietze


Last edited by wvr120364 on Tue Nov 22, 2005 1:42 pm; edited 1 time in total
Back to top
chewy009



Joined: 15 Jun 2005
Posts: 38
Location: Washington State, USA

PostPosted: Tue Nov 22, 2005 1:41 pm    Post subject: Reply with quote

RRD still not updating trying what you suggested.

One other question on the line below

set htmladdr=http://www.your.domain/cacti/log/uptime_%1.html

Does www.your.domain = server name that cacti is installed on??
Back to top
wvr120364



Joined: 06 May 2003
Posts: 16

PostPosted: Tue Nov 22, 2005 1:47 pm    Post subject: Reply with quote

chewy009 wrote:
RRD still not updating trying what you suggested.

One other question on the line below

set htmladdr=http://www.your.domain/cacti/log/uptime_%1.html

Does www.your.domain = server name that cacti is installed on??


chewy009,
I edited my last post. Please read it.
www.your.domain = webadress of your cacti-dir where you can find your cacti from the internet. Like: http://www.microsoft.com/cacti.
Wietze
Back to top
chewy009



Joined: 15 Jun 2005
Posts: 38
Location: Washington State, USA

PostPosted: Tue Nov 22, 2005 2:11 pm    Post subject: Reply with quote

OK, so here is what I've found. Running it from the command line gives me back useful information.

C:\Apache2\htdocs\cacti\scripts\uptime>win_uptime.cmd 10.10.10.40 99.9900
cur_uptime:75909 mean_days:13.44 tot_uptime:45293769 tot_blue:0 tot_downtime:6542 tot_reb:39 avail:99.9856 sla_avail:99.9900

C:\Apache2\htdocs\cacti\scripts\uptime>win_uptime.cmd 10.10.10.40 99.9900
cur_uptime:76368 mean_days:13.44 tot_uptime:45294229 tot_blue:0 tot_downtime:6542 tot_reb:39 avail:99.9856 sla_avail:99.9900

C:\Apache2\htdocs\cacti\scripts\uptime>win_uptime.cmd 10.10.10.24 99.9900
cur_uptime:5762460 mean_days:9.63 tot_uptime:21617767 tot_blue:0 tot_downtime:6870 tot_reb:26 avail:
99.9682 sla_avail:99.9900

C:\Apache2\htdocs\cacti\scripts\uptime>win_uptime.cmd 10.10.10.22 99.9900
cur_uptime:1037248 mean_days:7.01 tot_uptime:1816226 tot_blue:0 tot_downtime:318 tot_reb:3 avail:99.9825 sla_avail:99.9900

C:\Apache2\htdocs\cacti\scripts\uptime>win_uptime.cmd 10.10.10.15 99.9900
cur_uptime:384849 mean_days:22.86 tot_uptime:51343968 tot_blue:0 tot_downtime:3423 tot_reb:26 avail:
99.9933 sla_avail:99.9900

Here is how I configured the set lines in the win_uptime.cmd file

set htmlfile=c:\apache2\htdocs\cacti\log\uptime_%1.html
set htmladdr=http://server.test.net/cacti/log/uptime_%1.html
set script_path=c:\apache2\htdocs\cacti\scripts\uptime\

Is there supposed to be a logfile in the C:\apache2\htdocs\cacti\log directory other than cacti.log?
Back to top
wvr120364



Joined: 06 May 2003
Posts: 16

PostPosted: Tue Nov 22, 2005 2:24 pm    Post subject: Reply with quote

chewy009,

The readings looking good, it's what it should be doing.
In win_uptime.cmd comment out the last line
Code:
rem erase %htmlfile%

Run win_uptime.cmd from the command-line. Point your browser to
Code:
http://server.test.net/cacti/log/uptime_10.10.10.40.html
and see if you can actualy see a page. If that is the fact, and the page is filled with data everything should be working and I am out of any options.

Wietze
Back to top
chewy009



Joined: 15 Jun 2005
Posts: 38
Location: Washington State, USA

PostPosted: Tue Nov 22, 2005 2:38 pm    Post subject: Reply with quote

doing what you said, everything shows up properly, including going to that url you indicated in your previous post. However, it still shows nothing in the graph. When I look at the data source and turn on debug mode this is what I get.

Data Source Debug

c:/rrdtool/rrdtool.exe create \
C:/Apache2/htdocs/cacti/rra/netmgr_sla_avail_64.rrd \
--step 300 \
DS:sla_avail:GAUGE:600:0:100 \
DS:mean_days:GAUGE:600:0:U \
DS:avail:GAUGE:600:0:100 \
DS:tot_blue:GAUGE:600:0:U \
DS:tot_reb:GAUGE:600:0:U \
DS:tot_downtime:GAUGE:600:0:U \
DS:tot_uptime:GAUGE:600:0:U \
DS:cur_uptime:GAUGE:600:0:U \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MIN:0.5:1:600 \
RRA:MIN:0.5:6:700 \
RRA:MIN:0.5:24:775 \
RRA:MIN:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
RRA:LAST:0.5:1:600 \
RRA:LAST:0.5:6:700 \
RRA:LAST:0.5:24:775 \
RRA:LAST:0.5:288:797 \

I don't get why it works from the CMD line but not from within Cacti.
Back to top
chewy009



Joined: 15 Jun 2005
Posts: 38
Location: Washington State, USA

PostPosted: Tue Nov 22, 2005 4:27 pm    Post subject: Reply with quote

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?


graph.jpg
 Description:
 Filesize:  55.59 KB
 Viewed:  43615 Time(s)

graph.jpg


Back to top
Pumpi
Cacti User


Joined: 14 Jan 2004
Posts: 256
Location: Germany

PostPosted: Wed Nov 23, 2005 5:28 am    Post subject: Reply with quote

wvr120364,

very interessting script !

I have two questions:

Can I poll with this script Windows Servers from my Cacti Server running on Suse Linux ?

If yes I get following error:

sh: line 1: /srv/www/htdocs/cacti/scripts/uptime/win_uptime.cmd: Permission denied
Back to top
royce
Cacti User


Joined: 29 Dec 2004
Posts: 79
Location: Sweden

PostPosted: Wed Nov 23, 2005 5:32 am    Post subject: Reply with quote

that's because this script is designed for Windows-cacti boxen.

However, I just finished porting this to Linux +NRPE_NT...
Back to top
royce
Cacti User


Joined: 29 Dec 2004
Posts: 79
Location: Sweden

PostPosted: Wed Nov 23, 2005 5:49 am    Post subject: Reply with quote

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?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 



Powered by phpBB © 2001, 2005 phpBB Group