View previous topic :: View next topic |
Author |
Message |
mpilz
Joined: 05 Sep 2003 Posts: 6
|
Posted: Thu Oct 06, 2005 4:29 am Post subject: connect HostMon with Cacti? |
|
|
Hello,
I have some questions about your software ks Advanced Host Monitor. Is it possible to connect HostMon with Cacti? I wants to gather information with Hostmon and display (charts and reports) with cact.
Kind regards
Marko Pilz |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12795 Location: USA
|
Posted: Thu Oct 06, 2005 3:35 pm Post subject: |
|
|
What is Cacti?
http://www.cacti.net/ ?
Can it retrieve data from ODBC datasource?
Regards
Alex |
|
Back to top |
|
|
mpilz
Joined: 05 Sep 2003 Posts: 6
|
Posted: Mon Oct 10, 2005 2:30 am Post subject: |
|
|
Hello.
Sorry i was offline.....
Yes i mean www.cacti.net.
Cacti bases on the RRDTool.
Marko |
|
Back to top |
|
|
jromariz
Joined: 03 Apr 2002 Posts: 264 Location: Brasil
|
Posted: Mon Oct 10, 2005 12:42 pm Post subject: |
|
|
Hi,
I´m using hostmon to gather information an update an RRD database and using CGI pages to display the RRD graphs.
The steps are:
1 - RMA installed on the target machine retrieves information about the test every x seconds;
2 - Another test is configured in HM to run an action every x seconds using another RMA (installed on the same machine where the RRD base is) and update RRD using "Execute external program" action.
3 - CGI page is used to build a dynamic page based on RRD base;
Simple and works great. I believe you can use something like this with Cacti.
Regards,
Jromariz. |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12795 Location: USA
|
Posted: Mon Oct 10, 2005 5:30 pm Post subject: |
|
|
As I see Cacti does not work with ODBC data sources (or may be I missed that option?). I think method that Jromariz is using its probably the only solution -update RRD files using "Execute external program" action.
Regards
Alex |
|
Back to top |
|
|
Antony Guest
|
Posted: Tue Oct 25, 2005 12:35 pm Post subject: |
|
|
jromariz wrote: | Hi,
I´m using hostmon to gather information an update an RRD database and using CGI pages to display the RRD graphs.
The steps are:
1 - RMA installed on the target machine retrieves information about the test every x seconds;
2 - Another test is configured in HM to run an action every x seconds using another RMA (installed on the same machine where the RRD base is) and update RRD using "Execute external program" action.
3 - CGI page is used to build a dynamic page based on RRD base;
Simple and works great. I believe you can use something like this with Cacti.
Regards,
Jromariz. |
Jromariz: can you please help me do the same? My email is hehe at freemail.gr
Thanks in advance |
|
Back to top |
|
|
jromariz
Joined: 03 Apr 2002 Posts: 264 Location: Brasil
|
Posted: Tue Oct 25, 2005 1:37 pm Post subject: |
|
|
Hi Antony,
Of courde I can help you.
Just send you an e-mail.
Regards,
Jromariz. |
|
Back to top |
|
|
mpilz
Joined: 05 Sep 2003 Posts: 6
|
Posted: Tue Nov 15, 2005 2:08 pm Post subject: |
|
|
really thx for the information.
i will test this next week.
marko |
|
Back to top |
|
|
fzaleta
Joined: 08 Nov 2005 Posts: 2 Location: Texas
|
Posted: Mon Nov 28, 2005 11:37 pm Post subject: Idea |
|
|
I love HM... I think it's one of the best tools to collect performance data for servers. The reporting falls a bit short of what I am looking for though. I had had the idea of somehow merging HM with cacti but found no way of easily doing it without mucking with php code. Besides, all I need is the graphs...
Here's an idea that I am currently toying with... How about using a custom html report to generate XML files that the RRDTool in cacti can use to generate graphs?
According to this other post, you can generate an XML formatted report:
http://www.ks-soft.net/cgi-bin/phpBB/viewtopic.php?t=1591&highlight=xml
Then using an external batch on a schedule task calling 'rrdtool restore' we can generate the rrd databases and the graphics. Maybe delete the xml file to conserve space.
http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/doc/rrdrestore.en.html
Right now this is entirely theoretical as I've not tried it. But it's a way to look at it. One of the drawbacks I see is the size of the XML files, let's say, for a test you that runs every 5 minutes for 365 days a year (12 tests x 24hrs x 365 days = >100,000 tests)! However, daily and monthly graphs are manageable.
What do you guys think? If anyone's tried something like this or has any comments, please post back. Thanks! |
|
Back to top |
|
|
Dag Ragnar Vikjord
Joined: 10 May 2006 Posts: 3 Location: Norway
|
Posted: Wed May 10, 2006 6:55 am Post subject: |
|
|
jromariz wrote: | Hi,
I´m using hostmon to gather information an update an RRD database and using CGI pages to display the RRD graphs.
The steps are:
1 - RMA installed on the target machine retrieves information about the test every x seconds;
2 - Another test is configured in HM to run an action every x seconds using another RMA (installed on the same machine where the RRD base is) and update RRD using "Execute external program" action.
3 - CGI page is used to build a dynamic page based on RRD base;
Simple and works great. I believe you can use something like this with Cacti.
Regards,
Jromariz. |
Hi Jromariz. can you please help me do the same to?
Thanks in advance! |
|
Back to top |
|
|
ironmike
Joined: 22 Jun 2003 Posts: 15
|
Posted: Wed May 10, 2006 11:01 am Post subject: |
|
|
Using hostmonitor/cacti is possible (I currently have this setup on a Windows 2003 server). It does take a bit of doing. Basically, you use the MySQL server to hold the hostmonitor data (same server that host the cacti data).
You will need to create a new catalog (I called mine hostmonitor, and created a hmlog table within it that had the fields that I cared about (DateTime, Testname, StatusID, Reply) in the MySQL DB.
Create a user that has access to this catalog (Right now, the user has all privileges except drop and grant)
You will need to create a (system) ODBC source for the mySQL database (using the user created above).
Here's the overview on how it's done
1) Go into hostmonitor, advanced logs. Set the logging sql based on the fields that you want, for example:
Insert into hmlog (cDateTime, TestName, StatusID, Reply) VALUES (Now(), '%Folder%\\%TestName%','%StatusID%','%Reply_Number%')
2) You will need to use a script query to access the data. Here's some sample code to get you going... I am no PHP guru, BTW...
Code: |
<?php
if ($argc < 2) {
Die("Please specify a Testname to query.");
}
$TestName=$argv[1];
$database="hostmonitor";
$username="myuser";
$password="mypassword";
mysql_connect("localhost",$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query = "Select avg(Reply) as AvgReply from hmlog WHERE cDateTime > DATE_SUB(NOW(), INTERVAL 5 MINUTE) AND Testname='".$TestName."'";
$qry_result=mysql_query($query);
mysql_close();
if (!$qry_result) {
die("MSSQL Error: ".mysql_error());
}
$myReply = mysql_Result($qry_result,0,"AvgReply");
if (strlen($myReply) < 1) {
print Trim("0");
}
else {
print trim($myReply);
}
?>
|
3) Set up a data input method to run the script. Call it "Get HostMon Data"
Input type is "Script/Command"
Input string is c:\php\php.exe c:\\cacti\scripts\hostmon.php <TestName>
Create an input field ("Testname" in my example). I created template and put in "hostname" (without quotes) in the special type code text box. If you are not creating templates, you may not need to do this...
Output field is set to some name (myResult, for example).
4) Add a Data source (no template need be selected). When you click on the "Create" button, you will see more choices in setting up the data source. You will need to choose the data input method as the one that we just atted in step 3 above.
5) Hit the "Create" button one more time after filling out the respective fields that you need and you will see a Custom data header that prompts you for the "Testname". This would be the full testname. Careful when naming the tests.
6) Click on the save button.
7) From there, you will need to create the graph under Graph management. I will not go into detail on this, as how to create (simple) graphs is documented in the manual/online/forum....
Some things that I found while doing this:
* When using the script server (not the script/query), spaces in the testname (from hostmonitor) are not a good thing. For example, "Yahoo Ping" is bad, but "YahooPing" is OK.
* The mySQL query browser is a good tool to use in debugging queries to "feed" to cacti (when you are not getting any results back from cacti and wondering what is going on...).
* I created a scheduled job to run a query every 30 minutes to delete record with a date/time older than 30 minutes:
Code: | C:\mysql\bin\mysql.exe --database=hostmonitor --password=sql4u --user=root --execute="Delete from hmlog WHERE DATE_SUB(NOW(), INTERVAL '30' MINUTE) >`hostmonitor`.`hmlog`.`cDateTime`;" |
This keeps the mySQL Db catalog for hostmonitor reasonable in size.
Hope this helps some people out.
Mike |
|
Back to top |
|
|
Dag Ragnar Vikjord
Joined: 10 May 2006 Posts: 3 Location: Norway
|
Posted: Wed May 10, 2006 12:43 pm Post subject: |
|
|
I will try it out!
Thanks! |
|
Back to top |
|
|
|