Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Tue Jun 18, 2019 12:25 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 61 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject:
PostPosted: Wed Jun 13, 2007 7:21 am 
Offline

Joined: Thu Dec 09, 2004 1:48 pm
Posts: 13
I wan't to monitor several Windows 2003 servers from my Centos Cacti server.

Is it possible te use this script on linux to poll Windows Servers?
Does anyone have a quick how-to?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 21, 2007 10:06 pm 
Offline

Joined: Tue Nov 15, 2005 10:56 pm
Posts: 10
arjanv wrote:
Is it possible te use this script on linux to poll Windows Servers?
Does anyone have a quick how-to?


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.

/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/


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 12, 2007 3:53 am 
Offline
Cacti User

Joined: Thu Mar 01, 2007 5:55 am
Posts: 68
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


Top
 Profile  
 
 Post subject: Linux Port
PostPosted: Wed Oct 24, 2007 5:31 pm 
Offline

Joined: Wed Oct 24, 2007 5:30 pm
Posts: 1
Hi is there a linux version for the uptime script?

The xml files import fine, just the scripts woun't run...

Thanks
Neil


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 10, 2008 5:29 am 
Offline

Joined: Tue Apr 08, 2008 8:33 am
Posts: 15
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


same here..

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..


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 12, 2008 6:55 pm 
Offline
Cacti User

Joined: Sat Feb 28, 2004 10:16 pm
Posts: 99
Location: Melbourne, Australia
I'm the same on this one. From what I can gather the Perl script is trying access the web address specified in the win_uptime.cmd script.

_________________
Dominic Ryan
www.iis-aid.com


Top
 Profile  
 
 Post subject: linux -> Windows WMI
PostPosted: Tue Oct 14, 2008 7:08 am 
Offline
Cacti User

Joined: Wed Dec 29, 2004 7:37 am
Posts: 79
Location: Sweden
hi.

You guys running Linux. Be sure to remove any ^M 's in the perl scripts supplied.

Code:
$ 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:
!/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


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.

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

echo $E


Hope this helps someone.


Top
 Profile  
 
 Post subject: Re: Windows uptime statistics
PostPosted: Tue Nov 11, 2008 2:12 am 
Offline

Joined: Tue Nov 11, 2008 1:53 am
Posts: 1
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 !


Top
 Profile  
 
 Post subject: Re: Windows uptime statistics
PostPosted: Tue Nov 11, 2008 2:58 am 
Offline
Cacti User

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


Hi.
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 03, 2009 4:30 am 
Offline

Joined: Tue Mar 03, 2009 4:25 am
Posts: 4
Brashquido wrote:
I'm the same on this one. From what I can gather the Perl script is trying access the web address specified in the win_uptime.cmd script.


It is a permissions error. You need to put a chmod 644 if you are using linux, or a setattrib on windows.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 27, 2009 4:33 am 
Offline

Joined: Wed Mar 18, 2009 7:43 am
Posts: 7
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..


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.

Code:
set htmladdr=https://servername/log/uptime_%1.html


For those people who are not getting any values in their graphs, the solution is to make sure that the user account running the cacti poller scheduled task is recognised by each machine you are gathering the uptime stats for (I added the same local user to each machine, but a domain account may work).


Top
 Profile  
 
 Post subject: Help got graph but now data
PostPosted: Thu Nov 12, 2009 3:10 pm 
Offline

Joined: Wed Sep 02, 2009 4:45 pm
Posts: 37
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)\:" \
GPRINT:a:LAST:" %6.4lf%%\n" \
LINE1:b#00CF00FF:"Current as of eventlog\:" \
GPRINT:b:LAST:" %6.4lf%%" \
GPRINT:cdeff:LAST:"(%8.2lf day(s))" \
GPRINT:b:AVERAGE:"Avg\:%6.4lf%%" \
GPRINT:b:MAX:" 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
graph_image.jpg [ 62.49 KiB | Viewed 6854 times ]
Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 17, 2009 1:38 pm 
Offline

Joined: Wed Sep 02, 2009 4:45 pm
Posts: 37
good news with some reading and posting i finally got it 80% working. im getting the graph, the html file, log file, and SLA line in the graph but thats it.
when i click on the html file i get all the info i wish to see on the graph.


Attachments:
graph_image.jpg
graph_image.jpg [ 74.52 KiB | Viewed 6789 times ]
Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 29, 2010 4:11 am 
Offline

Joined: Thu Mar 25, 2010 8:27 am
Posts: 5
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%


Top
 Profile  
 
 Post subject: Re: linux -> Windows WMI
PostPosted: Wed Apr 07, 2010 9:53 am 
Offline

Joined: Wed Jan 25, 2006 8:27 am
Posts: 25
royce wrote:
Please note. You have to configure the NRPE commands on the Windows server in order to do what you like.


Ok i have NRPE running now on a AD server but using the following command on my CentOS install:

Code:
[[email protected] uptime]# /usr/lib/nagios/plugins/check_nrpe -H 192.168.1.235 -c win32_uptime1 -a "192.168.253.236"


I get this:

Code:
NRPE: Command 'win32_uptime1' not defined


I see i have to setup the win32_uptime1 command in the nrpe.cfg but how?

Thanks!

_________________
¬¬ZeRoY¬¬


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

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 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