Windows uptime statistics
Moderators: Developers, Moderators
Also after the same thing, would love to get uptime statics running on my install of cacti which is running on Ubuntu. If anyone can help, that would be fantastic. Running version 0.8.6h.arjanv wrote:Is it possible te use this script on linux to poll Windows Servers?
Does anyone have a quick how-to?
/edit: On my continued search, Hobbit Monitoring looks like it might be a goer as it plugs into cacti. Anyone had any experience with it.... good / not good ???
http://www.hobbitmon.com/
Linux Port
Hi is there a linux version for the uptime script?
The xml files import fine, just the scripts woun't run...
Thanks
Neil
The xml files import fine, just the scripts woun't run...
Thanks
Neil
-
- Posts: 15
- Joined: Tue Apr 08, 2008 8:33 am
same here..ABX wrote:When I run win_uptime.cmd from command prompt I get an error.
c:\>win_uptime.cmd loclhost 99.95
Couldn't get it! at d:\something\cacti\scripts\uptime\win_uptime.pl line 20.
sla_avail:99.95
someone got this solved?
i've checked line 20, its
my $content = LWP::Simple::get($httpaddr) or die "Couldn't get it!";
i have serious no clue how to fix..
-
- Cacti User
- Posts: 99
- Joined: Sat Feb 28, 2004 10:16 pm
- Location: Melbourne, Australia
- Contact:
linux -> Windows WMI
hi.
You guys running Linux. Be sure to remove any ^M 's in the perl scripts supplied.
Someone asked for my linux-script I use to get info. As I said before I use NRPe to connect to a Windows server and from there, to any windows server within that Active directory.
Please note. You have to configure the NRPE commands on the Windows server in order to do what you like.
Here's my script i use for that.
So. The flow goes like this:
Cacti server (Linux)
Windows NRPE (Windows)
Other Windows servers (AD)
Linux runs the script configured (above) wich runs check_nrpe. Check_nrpe sends "win32_uptime1" to my Windows server, it also includes the IP address of the AD server cacti wants to poll. Then check_nrpe runs the windows script at the windows server and collects the WMI data from the AD server, and returns the output to Cacti.
Next, I use a quick and dirty solution to fix the buffered-output problem. I run the win_update.sh through a script that just echo's all output up front. (Because cactid/php want it that way..) anyway. Dirty dirty.
Hope this helps someone.
You guys running Linux. Be sure to remove any ^M 's in the perl scripts supplied.
Code: Select all
$ dos2unix win_cur_uptime.pl
$ dos2unix win_uptime.pl
Someone asked for my linux-script I use to get info. As I said before I use NRPe to connect to a Windows server and from there, to any windows server within that Active directory.
Please note. You have to configure the NRPE commands on the Windows server in order to do what you like.
Here's my script i use for that.
Code: Select all
!/bin/sh
log="/cacti path/cacti/log/uptime_$1.log"
txt="/cacti path/cacti/log/uptime_$1.txt"
gawk=/usr/bin/gawk
htmlfile=/your cacti path here/cacti/log/uptime_$1.html
htmladdr=http://your cacti server here/cacti/log/uptime_$1.html
script_path=/your cacti path here/scripts/uptime
$gawk -f $script_path/gawk_head.txt $log > $htmlfile
echo "000000 Uptime Report for: \\\\$1" > $log
/your cacti path here/cacti/scripts/check_nrpe -H <NRPE windows server> -c win32_uptime1 -a "$1" > $txt
/your cacti path here/cacti/scripts/check_nrpe -H <NRPE windows server> -c win32_uptime2 -a "$1" | tr '@' '\n' >> $log
gawk -f $script_path/gawk_main.txt $log >> $htmlfile
gawk -f $script_path/gawk_tail.txt $log >> $htmlfile
perl $script_path/win_cur_uptime.pl $txt
perl $script_path/win_uptime.pl $htmladdr
echo sla_avail:$2
rm $log
rm $txt
rm $htmlfile
Cacti server (Linux)
Windows NRPE (Windows)
Other Windows servers (AD)
Linux runs the script configured (above) wich runs check_nrpe. Check_nrpe sends "win32_uptime1" to my Windows server, it also includes the IP address of the AD server cacti wants to poll. Then check_nrpe runs the windows script at the windows server and collects the WMI data from the AD server, and returns the output to Cacti.
Next, I use a quick and dirty solution to fix the buffered-output problem. I run the win_update.sh through a script that just echo's all output up front. (Because cactid/php want it that way..) anyway. Dirty dirty.
Code: Select all
#!/bin/sh
E=`/usr/share/cacti/scripts/uptime/win_uptime.sh $1 $2`
echo $E
-
- Posts: 1
- Joined: Tue Nov 11, 2008 1:53 am
Re: Windows uptime statistics
hello !
thanks for you supporting the Templates for windows uptime , but I can't catch the data , when I import it sucessfully , so I want to make sure weather it's suitable for cacti from linux or not ?
PS : my cacti set on linux , not windows platform , tks !
thanks for you supporting the Templates for windows uptime , but I can't catch the data , when I import it sucessfully , so I want to make sure weather it's suitable for cacti from linux or not ?
PS : my cacti set on linux , not windows platform , tks !
Re: Windows uptime statistics
Hi.Hyperion.Jiang wrote:hello !
thanks for you supporting the Templates for windows uptime , but I can't catch the data , when I import it sucessfully , so I want to make sure weather it's suitable for cacti from linux or not ?
PS : my cacti set on linux , not windows platform , tks !
If you are used to Linux, you are used to find ways to get your stuff running. Linux is like UNIX, and UNIX teaches one to read and understand.
My previous post was written to folks that runs linux and knows how to read and understand a simple shell script and instructions. What you do with it is up to you. If you feel this is to less plug and play, don't bother.
Thanks
Chris
Yes, when you edit win_uptime.cmd make sure the following line is the intranet URL to your Cacti. I am using SSL so I had edit accordingly.malibumaniac wrote:someone got this solved?
i've checked line 20, its
my $content = LWP::Simple::get($httpaddr) or die "Couldn't get it!";
i have serious no clue how to fix..
Code: Select all
set htmladdr=https://servername/log/uptime_%1.html
Help got graph but now data
I get no data can someone help?
@echo off
set log=.\uptime_%1.log
set txt=.\uptime_%1.txt
set htmlfile=d:C:\Cacti_Install\Apache2\htdocs\cacti\log\uptime_%1.html
set htmladdr=http://my_ip_address_4_cacti/cacti/log/uptime_%1.html
set script_path=d:\C:\Cacti_Install\Apache2\htdocs\cacti\scripts\uptime\
%script_path%gawk -f %script_path%gawk_head.txt %log% > %htmlfile%
echo 000000 Uptime Report for: \\%1 > %log%
%script_path%uptime.exe %1 > %txt%
%script_path%Uptime.exe /s %1 | %script_path%nl -nrz | %script_path%grep "Uptime Report for:\|Since \|System Availability:\|Total Uptime:\|Total Downtime:\|Total Reboots:\|Mean Time Between Reboots:\|Total Bluescreens:" | %script_path%gawk "{gsub(/Since/,\" Since:\"); print}" | %script_path%sort -k 2,2 -k 1,1r | %script_path%uniq --skip-chars=8 --check-chars=30 | %script_path%sort >> %log%
%script_path%gawk -f %script_path%gawk_main.txt %log% >> %htmlfile%
%script_path%gawk -f %script_path%gawk_tail.txt %log% >> %htmlfile%
perl.exe %script_path%win_cur_uptime.pl %txt%
perl.exe %script_path%win_uptime.pl %htmladdr%
echo sla_avail:%2
rem erase temp files
erase %log%
erase %txt%
erase %htmlfile%
i get the graph but no data.
debug
RRDTool Command:
C:/Cacti_Install/rrdtool/rrdtool.exe graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="WDoffice54-2 -Uz - Windows Uptime Statistics" \
--base=1000 \
--height=175 \
--width=650 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Percentage (%) or days" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":sla_avail:AVERAGE \
DEF:b="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":avail:AVERAGE \
DEF:c="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":tot_uptime:AVERAGE \
DEF:d="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":cur_uptime:AVERAGE \
DEF:e="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":tot_downtime:AVERAGE \
DEF:f="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":tot_reb:AVERAGE \
DEF:g="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":mean_days:AVERAGE \
DEF:h="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":tot_blue:AVERAGE \
CDEF:cdeff=c,e,-,60,/,60,/,24,/ \
CDEF:cdefba=c,60,/,60,/,24,/ \
CDEF:cdefbc=c,c,/,100,* \
CDEF:cdefbf=d,60,/,60,/,24,/ \
CDEF:cdefbh=d,c,/,100,* \
CDEF:cdefca=e,60,/,60,/,24,/ \
CDEF:cdefcc=e,c,/,100,* \
CDEF:cdefdb=g,24,*,60,*,60,*,c,/,100,* \
CDEF:cdefdi=100,a,-,100,/,c,*,60,/,60,/,24,/ \
CDEF:cdefdj=100,a,- \
CDEF:cdefea=e,100,a,-,100,/,/,c,-,60,/,60,/,24,/ \
COMMENT:"Availability\:\n" \
LINE1:a#F51D30FF:"Required (SLA)\:" \
GPRINTLAST:" %6.4lf%%\n" \
LINE1:b#00CF00FF:"Current as of eventlog\:" \
GPRINTLAST:" %6.4lf%%" \
GPRINT:cdeff:LAST:"(%8.2lf day(s))" \
GPRINTAVERAGE:"Avg\:%6.4lf%%" \
GPRINTMAX:" Max\:%6.4lf%%\n" \
COMMENT:" \n" \
COMMENT:"Uptime and downtime\:\n" \
LINE1:cdefba#A150AAFF:"Total uptime (eventlog)\:" \
GPRINT:cdefba:LAST:" %8.2lf day(s)" \
GPRINT:cdefbc:LAST:"(%6.2lf%%)" \
GPRINT:cdefba:AVERAGE:" Avg\:%8.2lf day(s)" \
GPRINT:cdefba:MAX:"Max\:%8.2lf day(s)\n" \
AREA:cdefbf#FF7D00FF:"Uptime since last reboot\:" \
GPRINT:cdefbf:LAST:" %8.2lf day(s)" \
GPRINT:cdefbh:LAST:"(%6.4lf%%)" \
GPRINT:cdefbf:AVERAGE:" Avg\:%8.2lf day(s)" \
GPRINT:cdefbf:MAX:"Max\:%8.2lf day(s)\n" \
LINE1:cdefca#FAFD9EFF:"Total downtime (eventlog)\:" \
GPRINT:cdefca:LAST:"%8.4lf day(s)" \
GPRINT:cdefcc:LAST:"(%6.4lf%%)" \
GPRINT:cdefca:AVERAGE:" Avg\:%8.4lf day(s)" \
GPRINT:cdefca:MAX:"Max\:%8.4lf day(s)\n" \
COMMENT:" \n" \
COMMENT:"Reboot information\:\n" \
LINE1:f#837C04FF:"Total reboots (eventlog)\:" \
GPRINT:f:LAST:" %8.0lf\n" \
LINE1:g#00004DFF:"Mean time between reboots\:" \
GPRINT:g:LAST:"%8.2lf day(s)" \
GPRINT:cdefdb:LAST:"(%6.4lf%%)" \
GPRINT:g:AVERAGE:" Avg\:%8.2lf day(s)" \
GPRINT:g:MAX:"Max\:%8.2lf day(s)\n" \
LINE1:h#002A97FF:"Total blue screens\:" \
GPRINT:h:LAST:" %8.0lf\n" \
COMMENT:" \n" \
COMMENT:"Summary\:\n" \
GPRINT:cdefdi:LAST:" Allowed current downtime (SLA)\:%8.4lf day(s)" \
GPRINT:cdefdj:LAST:"(%6.4lf%%)\n" \
GPRINT:cdefea:LAST:"Days to reach required SLA availability\:%8.2lf day(s)\n"
RRDTool Says:
OK
@echo off
set log=.\uptime_%1.log
set txt=.\uptime_%1.txt
set htmlfile=d:C:\Cacti_Install\Apache2\htdocs\cacti\log\uptime_%1.html
set htmladdr=http://my_ip_address_4_cacti/cacti/log/uptime_%1.html
set script_path=d:\C:\Cacti_Install\Apache2\htdocs\cacti\scripts\uptime\
%script_path%gawk -f %script_path%gawk_head.txt %log% > %htmlfile%
echo 000000 Uptime Report for: \\%1 > %log%
%script_path%uptime.exe %1 > %txt%
%script_path%Uptime.exe /s %1 | %script_path%nl -nrz | %script_path%grep "Uptime Report for:\|Since \|System Availability:\|Total Uptime:\|Total Downtime:\|Total Reboots:\|Mean Time Between Reboots:\|Total Bluescreens:" | %script_path%gawk "{gsub(/Since/,\" Since:\"); print}" | %script_path%sort -k 2,2 -k 1,1r | %script_path%uniq --skip-chars=8 --check-chars=30 | %script_path%sort >> %log%
%script_path%gawk -f %script_path%gawk_main.txt %log% >> %htmlfile%
%script_path%gawk -f %script_path%gawk_tail.txt %log% >> %htmlfile%
perl.exe %script_path%win_cur_uptime.pl %txt%
perl.exe %script_path%win_uptime.pl %htmladdr%
echo sla_avail:%2
rem erase temp files
erase %log%
erase %txt%
erase %htmlfile%
i get the graph but no data.
debug
RRDTool Command:
C:/Cacti_Install/rrdtool/rrdtool.exe graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="WDoffice54-2 -Uz - Windows Uptime Statistics" \
--base=1000 \
--height=175 \
--width=650 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Percentage (%) or days" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":sla_avail:AVERAGE \
DEF:b="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":avail:AVERAGE \
DEF:c="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":tot_uptime:AVERAGE \
DEF:d="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":cur_uptime:AVERAGE \
DEF:e="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":tot_downtime:AVERAGE \
DEF:f="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":tot_reb:AVERAGE \
DEF:g="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":mean_days:AVERAGE \
DEF:h="C\:/Cacti_Install/Apache2/htdocs/cacti/rra/wdoffice54-2_-uz_sla_avail_850.rrd":tot_blue:AVERAGE \
CDEF:cdeff=c,e,-,60,/,60,/,24,/ \
CDEF:cdefba=c,60,/,60,/,24,/ \
CDEF:cdefbc=c,c,/,100,* \
CDEF:cdefbf=d,60,/,60,/,24,/ \
CDEF:cdefbh=d,c,/,100,* \
CDEF:cdefca=e,60,/,60,/,24,/ \
CDEF:cdefcc=e,c,/,100,* \
CDEF:cdefdb=g,24,*,60,*,60,*,c,/,100,* \
CDEF:cdefdi=100,a,-,100,/,c,*,60,/,60,/,24,/ \
CDEF:cdefdj=100,a,- \
CDEF:cdefea=e,100,a,-,100,/,/,c,-,60,/,60,/,24,/ \
COMMENT:"Availability\:\n" \
LINE1:a#F51D30FF:"Required (SLA)\:" \
GPRINTLAST:" %6.4lf%%\n" \
LINE1:b#00CF00FF:"Current as of eventlog\:" \
GPRINTLAST:" %6.4lf%%" \
GPRINT:cdeff:LAST:"(%8.2lf day(s))" \
GPRINTAVERAGE:"Avg\:%6.4lf%%" \
GPRINTMAX:" Max\:%6.4lf%%\n" \
COMMENT:" \n" \
COMMENT:"Uptime and downtime\:\n" \
LINE1:cdefba#A150AAFF:"Total uptime (eventlog)\:" \
GPRINT:cdefba:LAST:" %8.2lf day(s)" \
GPRINT:cdefbc:LAST:"(%6.2lf%%)" \
GPRINT:cdefba:AVERAGE:" Avg\:%8.2lf day(s)" \
GPRINT:cdefba:MAX:"Max\:%8.2lf day(s)\n" \
AREA:cdefbf#FF7D00FF:"Uptime since last reboot\:" \
GPRINT:cdefbf:LAST:" %8.2lf day(s)" \
GPRINT:cdefbh:LAST:"(%6.4lf%%)" \
GPRINT:cdefbf:AVERAGE:" Avg\:%8.2lf day(s)" \
GPRINT:cdefbf:MAX:"Max\:%8.2lf day(s)\n" \
LINE1:cdefca#FAFD9EFF:"Total downtime (eventlog)\:" \
GPRINT:cdefca:LAST:"%8.4lf day(s)" \
GPRINT:cdefcc:LAST:"(%6.4lf%%)" \
GPRINT:cdefca:AVERAGE:" Avg\:%8.4lf day(s)" \
GPRINT:cdefca:MAX:"Max\:%8.4lf day(s)\n" \
COMMENT:" \n" \
COMMENT:"Reboot information\:\n" \
LINE1:f#837C04FF:"Total reboots (eventlog)\:" \
GPRINT:f:LAST:" %8.0lf\n" \
LINE1:g#00004DFF:"Mean time between reboots\:" \
GPRINT:g:LAST:"%8.2lf day(s)" \
GPRINT:cdefdb:LAST:"(%6.4lf%%)" \
GPRINT:g:AVERAGE:" Avg\:%8.2lf day(s)" \
GPRINT:g:MAX:"Max\:%8.2lf day(s)\n" \
LINE1:h#002A97FF:"Total blue screens\:" \
GPRINT:h:LAST:" %8.0lf\n" \
COMMENT:" \n" \
COMMENT:"Summary\:\n" \
GPRINT:cdefdi:LAST:" Allowed current downtime (SLA)\:%8.4lf day(s)" \
GPRINT:cdefdj:LAST:"(%6.4lf%%)\n" \
GPRINT:cdefea:LAST:"Days to reach required SLA availability\:%8.2lf day(s)\n"
RRDTool Says:
OK
- Attachments
-
- graph_image.jpg (62.49 KiB) Viewed 7963 times
Hi All,
Script wouldn't run on my w2003sR2 x64 box (locally), turned out that the perl executable couldn't be found. Not mentioned in the starting post, but pretty obvious that its needed when reading win_uptime.cmd.
Added a var to win_uptime.cmd (after "set script_path="):
set perl_path=C:\strawberry\perl\bin\
and changed the perl.exe lines to:
%perl_path%perl.exe %script_path%win_cur_uptime.pl %txt%
%perl_path%perl.exe %script_path%win_uptime.pl %htmladdr%
Script wouldn't run on my w2003sR2 x64 box (locally), turned out that the perl executable couldn't be found. Not mentioned in the starting post, but pretty obvious that its needed when reading win_uptime.cmd.
Added a var to win_uptime.cmd (after "set script_path="):
set perl_path=C:\strawberry\perl\bin\
and changed the perl.exe lines to:
%perl_path%perl.exe %script_path%win_cur_uptime.pl %txt%
%perl_path%perl.exe %script_path%win_uptime.pl %htmladdr%
Re: linux -> Windows WMI
Ok i have NRPE running now on a AD server but using the following command on my CentOS install:royce wrote:Please note. You have to configure the NRPE commands on the Windows server in order to do what you like.
Code: Select all
[root@localhost uptime]# /usr/lib/nagios/plugins/check_nrpe -H 192.168.1.235 -c win32_uptime1 -a "192.168.253.236"
Code: Select all
NRPE: Command 'win32_uptime1' not defined
Thanks!
¬¬ZeRoY¬¬
Who is online
Users browsing this forum: No registered users and 4 guests