Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support
It is currently Sat Apr 19, 2014 4:24 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 61 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: Windows uptime statistics
PostPosted: Tue Nov 22, 2005 8:21 am 
Offline

Joined: Tue May 06, 2003 7:48 am
Posts: 16
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:
Image

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


Attachments:
File comment: Uptime scripts and programmes
uptime.zip [213.76 KiB]
Downloaded 8869 times
Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 8:42 am 
Offline
Cacti User

Joined: Thu Oct 14, 2004 4:14 pm
Posts: 97
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 8:42 am 
Offline
Cacti User

Joined: Thu Dec 09, 2004 1:51 pm
Posts: 112
Location: Austria
WOW, I'm really impressed!

_________________
Thomas Rupp


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 8:56 am 
Offline

Joined: Tue May 06, 2003 7:48 am
Posts: 16
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 1:03 pm 
Offline

Joined: Wed Jun 15, 2005 1:18 pm
Posts: 38
Location: Washington State, USA
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 1:25 pm 
Offline

Joined: Tue May 06, 2003 7:48 am
Posts: 16
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.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 1:41 pm 
Offline

Joined: Wed Jun 15, 2005 1:18 pm
Posts: 38
Location: Washington State, USA
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??


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 1:47 pm 
Offline

Joined: Tue May 06, 2003 7:48 am
Posts: 16
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 2:11 pm 
Offline

Joined: Wed Jun 15, 2005 1:18 pm
Posts: 38
Location: Washington State, USA
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?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 2:24 pm 
Offline

Joined: Tue May 06, 2003 7:48 am
Posts: 16
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 2:38 pm 
Offline

Joined: Wed Jun 15, 2005 1:18 pm
Posts: 38
Location: Washington State, USA
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. :(


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 4:27 pm 
Offline

Joined: Wed Jun 15, 2005 1:18 pm
Posts: 38
Location: Washington State, USA
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?


Attachments:
graph.jpg
graph.jpg [ 55.59 KiB | Viewed 87500 times ]
Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 5:28 am 
Offline
Cacti User
User avatar

Joined: Wed Jan 14, 2004 3:23 am
Posts: 256
Location: Germany
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 5:32 am 
Offline
Cacti User

Joined: Wed Dec 29, 2004 7:37 am
Posts: 79
Location: Sweden
that's because this script is designed for Windows-cacti boxen.

However, I just finished porting this to Linux +NRPE_NT...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 5:49 am 
Offline
Cacti User

Joined: Wed Dec 29, 2004 7:37 am
Posts: 79
Location: Sweden
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 61 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group