Exchange 2003 scripts from Windows Cacti

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

Moderators: Developers, Moderators

Post Reply
guanno
Posts: 38
Joined: Mon Aug 27, 2007 3:19 pm

Exchange database and Cacti

Post by guanno »

Thanks for the scripts they are great but for some reason
I cannot get the Exchange database script to return any information.
It gives a WMI access error yet all the other WMI scripts I try are fine?
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

Are other WMI scripts against this Exchange server working? I would recommend forcing a reload of the WMI, this has fixed almost every problem i have had with WMI scripts.

from a command line on the exchange box:

Code: Select all

wmiadap /f
once that is done, you will not see anything new on your screen, just stop and re-start the WMI service, and hopefully these scripts will work.

hope that helps

app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
guanno
Posts: 38
Joined: Mon Aug 27, 2007 3:19 pm

Exchange 2003 scripts

Post by guanno »

Thanks for the scripts!!
They work great except the DB script which has a hard coded server name causing it to fail.
The script is windows_exchangedb.pl
If you change
my @computers = ("SEMELEX02") ;
to
my @computers = @ARGV;
The script will work with host specified on the commandline.
Hope this helps others!
NetAdmin
Cacti User
Posts: 98
Joined: Wed Aug 30, 2006 8:45 pm

Post by NetAdmin »

Excellent Scripts!!!

Was wondering if the exchange database script/template could be modified so as to gather the actual database size. Any thoughts on how this could be done?

Thanks... :D
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

NetAdmin wrote:Excellent Scripts!!!

Was wondering if the exchange database script/template could be modified so as to gather the actual database size. Any thoughts on how this could be done?

Thanks... :D
Have a look at http://forums.cacti.net/viewtopic.php?p ... base#96705
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
NetAdmin
Cacti User
Posts: 98
Joined: Wed Aug 30, 2006 8:45 pm

Post by NetAdmin »

I did see this script already, but our server guys aren't thrilled about having to share out the MDBDATA directory in order for this to work. Didn't know if there was any other scripts out there that use WMI to gather the database size.

Thanks.
NetAdmin
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

I am not sure how it would handle the long path names, but have you tried using the default Admin shares? (i.e c$, e$ etc?) Since those shares already exist, if your Cacti user has the necessary permissions, you may be able to use those.

hope that helps

app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
edgonz
Posts: 19
Joined: Tue Sep 25, 2007 8:50 am

Post by edgonz »

Question from a first timer...and still learning the Cacti ways.

I was able to import the templates; I copied the .pl scripts to c:\inetpub\wwwroot\cacti\scripts

Here are my questions:
1. All the graphs for my exchange server (cpu, memory, hd capacity, etc) show information, except for these four. Is there something I've missed?

2. windows_exchangedb.pl - is this the only script where I need to hard code the exchange server name?

3. Do these scripts work on an Exchange 2003 SP2 server?

Thanks.
cactinoob
Posts: 4
Joined: Sun Oct 28, 2007 9:01 pm

Post by cactinoob »

Hi guys,

I am just wondering why my generated rrd code is faulty? If you check the code below, you will see that the "start" field is higher than the "end" field. In addition, my rrdtool seems to dislike CDEF:cdefe=a,1024,*. Any ideas?

Code: Select all

c:/rrdtool/rrdtool.exe graph - \
--imgformat=PNG \
--start=1193705198 \
--end=1193705197 \
--title="............... - Memory (Utilisation)" \
--rigid \
--base=1000 \
--height=250 \
--width=575 \
--alt-autoscale-max \
--lower-limit=0 \
COMMENT:"From 2007/10/30 11\:46\:38 To 2007/10/30 11\:46\:37\c" \
COMMENT:"  \n" \
--vertical-label="Memory" \
--slope-mode \
--font TITLE:12:C:/WINDOWS/Fonts/Arial.ttf \
--font AXIS:8:C:/WINDOWS/Fonts/Arial.ttf \
--font LEGEND:10:C:/WINDOWS/Fonts/Arial.ttf \
--font UNIT:8:C:/WINDOWS/Fonts/Arial.ttf \
CDEF:cdefe=a,1024,* \
AREA:#FF5F00:"Total Commit Limit"  \
GPRINT::LAST:"Current\:%8.2lf %s"  \
GPRINT::AVERAGE:"Average\:%8.2lf %s"  \
GPRINT::MAX:"Maximum\:%8.2lf %s\n"  \
AREA:cdefe#002A97:"Total Memory"  \
GPRINT:cdefe:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefe:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefe:MAX:"Maximum\:%8.2lf %s\n"  \
AREA:cdefe#7CB3F1:"Free Memory"  \
GPRINT:cdefe:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefe:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefe:MAX:"Maximum\:%8.2lf %s\n"  \
LINE2:#F5F800:"Committed Bytes"  \
GPRINT::LAST:"Current\:%8.2lf %s"  \
GPRINT::AVERAGE:"Average\:%8.2lf %s"  \
GPRINT::MAX:"Maximum\:%8.2lf %s\n"  \
AREA:#B90054:"Pool Paged Bytes"  \
GPRINT::LAST:"Current\:%8.2lf %s"  \
GPRINT::AVERAGE:"Average\:%8.2lf %s"  \
GPRINT::MAX:"Maximum\:%8.2lf %s\n"  \
AREA:#00FF00:"Pool NonPaged Bytes"  \
GPRINT::LAST:"Current\:%8.2lf %s"  \
GPRINT::AVERAGE:"Average\:%8.2lf %s"  \
GPRINT::MAX:"Maximum\:%8.2lf %s" 
Thanks heaps.
edgonz
Posts: 19
Joined: Tue Sep 25, 2007 8:50 am

Giving back to the community...(I hope)

Post by edgonz »

First, thank you for these templates!!

So, after getting these templates working on my system; I decided to write some detailed instructions on how to get them to work properly.

**********************************
**********************************

This document assumes the following:
a. Exchange 2003 SP1 or SP2 is used
b. Cacti is installed on Windows 2003 Server
c. Cacti is being served by Windows’ IIS
d. Cacti is fully operational



Preparing Cacti server and Exchange server(s)

1. Make sure that your CACTI server and you Exchange server(s) have WMI SNMP Provider installed.
a. These can be installed by going to Add/ Remove Programs and click on Add/Remove Windows Components. Select Management and Monitoring Tools and then check WMI SNMP Provider.

2. Create a domain user (doesn’t have to be a domain administrator). For this sample, we’ll use CactiUser.
a. Note: You can use the same user account that runs the Cacti scheduled poller task for steps 2, 3 and 4.

3. Make CactiUser a local administrator on your Exchange server(s).

4. Go to your Exchange server(s) and run WMI Management Console by typing: wmimgmt.msc - in the RUN command window.
a. Right click on WMI Control object
b. Click on Properties menu option
c. Click on Security tab
d. Click on Security button
e. Now, click on Add button and add CactiUser account
i. Assign: Execute Methods, Enable Account and Remote Enable permissions for our CactiUser account
f. Click OK and exit the WMI Management Console

5. At this time, we’re still on the Exchange server(s), open a command prompt and run: wmiadap /f
a. You may also want to restart the WMI service

6. You will need to install PERL on your Cacti server as this will be needed to run the scripts that will collect performance data from your Exchange server(s).

7. At this point your Exchange server(s) and Cacti server are ready for the next step – setting up Cacti and the templates.



Cacti and … scripts, templates and data templates


1. After downloading all the related files from the forums.
a. Rename scripts extension from ScriptName.pl.tx to – ScriptName.pl
b. Copy these .pl scripts to the scripts folder in your Cacti installation.
i. In my personal case, these files were copied to: C:\Inetpub\wwwroot\cacti\scripts

c. Next, import all the templates into Cacti by using the Import Templates from Cacti’s Console.

2. Next, we’re going to change the path of the Data Input Methods.
a. In Cacti’s Console, click on Data Input Methods.
b. If your import step was done properly, you should see all your Windows Exchange (…) templates. Click on the first Windows Exchange (…) template.
c. We’re going to update (for all five templates) the Input String field to reflect your configuration path.
i. In my case this pointed to the following: c:/perl/bin/perl.exe c:/inetpub/wwwroot/cacti/scripts/windows_exchangedb.pl <hostname>
ii. Yes, that’s all on one line. And yes, use forward slashes.
iii. You’re going to give the full path to perl.exe, and the full path where those .pl scripts reside. Don’t worry about the <hostname> portion, leave it alone.

3. At this point, your templates will be fully setup and ready to be assigned to your Exchange server(s).



Troubleshooting


1. Manually run the scripts from the Cacti server.
a. All five scripts should run fine from a command line from your Cacti server. If you don’t get any results or if you get some WMI error messages, then review the steps from: Preparing Cacti server and Exchange server(s)
b. It is very important the user that runs the poller scheduled task has permissions to run those scripts against your Exchange server(s)
2. Also, some of these WMI calls are only valid on Windows 2003.
3. The scripts have already been updated, so there is no need to change them for this to work.
4. As always, if nothing else works:
a. Set logging to DEBUG
b. And ask questions in these forums :)
Attachments
WMI security settings.
WMI security settings.
WMI_Console.JPG (65.33 KiB) Viewed 10166 times
Copy all scripts to the proper folder path.
Copy all scripts to the proper folder path.
Copy_Scripts.JPG (44.16 KiB) Viewed 10166 times
Adjusting PATH to execute Perl scripts.
Adjusting PATH to execute Perl scripts.
Data_Input_Methods.JPG (50.41 KiB) Viewed 10166 times
Troubleshooting from a command prompt from your CACTI server.
Troubleshooting from a command prompt from your CACTI server.
Troubleshoot.JPG (48.92 KiB) Viewed 10166 times
hassan1
Posts: 15
Joined: Mon Feb 12, 2007 11:55 am

can not run windows_exchangemessages.pl on linux

Post by hassan1 »

I tried to run your script manually on my Suse enterprise 10 (cacti server) but I get following error

/usr/bin/perl windows_exchangemessages.pl
Can't locate Win32/OLE.pm in @INC (@INC contains: /usr/lib/perl5/5.8.8/i586-linux-thread-multi /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/i586-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i586-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl .) at windows_exchangemessages.pl line 2.
BEGIN failed--compilation aborted at windows_exchangemessages.pl line 2


The above means the ‘Win32::OLE’ perl module is missing. When I tried to install the module

I get the following error

ERROR from evaluation of /root/.cpan/build/libwin32-0.28/Process/Makefile.PL: Undefined subroutine &Win32::IsWinNT called at ./Makefile.PL line 7.
Warning: No success on command[/usr/bin/perl Makefile.PL]

It seem your perl script is on designed only to run of window but I am running my Cacti on Suse linux 10


How can I make your script and template run on cacti server which is a Linux server


Can you help? Please
sadamu0614
Posts: 4
Joined: Mon Nov 19, 2007 10:46 pm

No more Datas after updating to 0.8.7

Post by sadamu0614 »

Hi!

After upgrading from 0.8.6j to 0.8.7 without patches almost works fine but:

My Exchange Message-Plugin won't return data or no valid data !
11/19/2007 10:21:06 AM - SYSTEM STATS: Time:30.8883 Method:spine Processes:2 Threads:4 Hosts:22 HostsPerProcess:11 DataSources:329 RRDsProcessed:171
11/19/2007 10:21:00 AM - CACTID: Poller[0] Host[8] DS[145] WARNING: Result from SCRIPT not valid. Partial Result: ...
11/19/2007 10:21:00 AM - CACTID: Poller[0] Host[8] ERROR: Empty result [SERVER]: 'perl c:/snmp/cacti/scripts/windows_exchangemessages.pl SERVER'
11/19/2007 10:16:06 AM - SYSTEM STATS: Time:31.3818 Method:spine Processes:2 Threads:4 Hosts:22 HostsPerProcess:11 DataSources:329 RRDsProcessed:171
11/19/2007 10:16:00 AM - CACTID: Poller[0] Host[8] DS[145] WARNING: Result from SCRIPT not valid. Partial Result: ...
11/19/2007 10:16:00 AM - CACTID: Poller[0] Host[8] ERROR: Empty result [SERVER]: 'perl c:/snmp/cacti/scripts/windows_exchangemessages.pl SERVER'
The Script will return data !
C:\SNMP\cacti\scripts>windows_exchangemessages.pl SERVER
MB_MsgsSubmitted:1019 MB_MsgsDelivered:10922 MB_MsgsSent:969 SMTP_MsgBytesReceiv
ed:1182731631 SMTP_MsgBytesSent:1229405806 SMTP_MsgsDelivered:10194 SMTP_MsgsRec
eived:64088 SMTP_MsgsSent:20351
Data Source Debugging
Data Source Debug
c:/snmp/cacti/rrdtool.exe create \
C:/SNMP/cacti/rra/SERVER_smtp_msgbytesreceiv_145.rrd \
--step 300 \
DS:SMTP_MsgsSent:COUNTER:600:0:U \
DS:MB_MsgsDelivered:COUNTER:600:0:U \
DS:SMTP_MsgsDelivered:COUNTER:600:0:U \
DS:SMTP_MsgsReceived:COUNTER:600:0:U \
DS:SMTP_MsgBytesSent:COUNTER:600:0:U \
DS:MB_MsgsSubmitted:COUNTER:600:0:U \
DS:SMTP_MsgBytesReceiv:COUNTER:600:0:U \
DS:MB_MsgsSent:COUNTER: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 \
Any Ideas ?
Maybe I have just not found the already existing answer for this problem ! :-)
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

On your Exchange server, try the following

1. From a Command Prompt, type wmiadap /f
2. Stop and restart the WMI services
3. Test the script again

You should also include the full path to the PERL binary. For example, "PERL...." becomes "C:\perl\bin\perl.exe...."

Hope this helps.
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
sadamu0614
Posts: 4
Joined: Mon Nov 19, 2007 10:46 pm

Post by sadamu0614 »

Thx !

Same Problem !
11/19/2007 12:31:16 PM - SYSTEM STATS: Time:43.8722 Method:spine Processes:2 Threads:4 Hosts:22 HostsPerProcess:11 DataSources:329 RRDsProcessed:171
11/19/2007 12:30:56 PM - CACTID: Poller[0] Host[8] DS[145] WARNING: Result from SCRIPT not valid. Partial Result: ...
11/19/2007 12:30:56 PM - CACTID: Poller[0] Host[8] ERROR: Empty result [SERVER]: 'C:\SNMP\Perl\bin\perl.exe c:/snmp/cacti/scripts/windows_exchangemessages.pl SERVER'
Like told above: I GET data from the Script !!!
And it has already worked 2-3 months still now (update to 0.8.7)

Any other ideas?
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

Yes - does the account you are using in CACTI for the scheduled task have access to WMI ?
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests