Hi all,
I've got a small perl script which queries a mysql db for user count on our irc servers.
The output of the script is flexible:
a) servername:usercount
b) servername1:usercount1 servername2:usercount2 ....
I'm still learning the ropes in Cacti, so my question is which data input method is the best when I want to achieve the following:
- roughly 20 servers to monitor
- each server in its own graph
- one graph with the sum of all servers
- minimize sql queries
- flexible system to add new servers / delete old ones
I read the docu about the data input method and a basic setup is working fine. I couldnt quite figure out the "Script query" and "Script server" concept with respect to my task. Is there a better method than to run the same script 20 times (output version a) for all the different servers?
Thanks for an input or guide,
Entity
Choosing the best data input method
Moderators: Developers, Moderators
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
I would write you script so that you can use it with Data Queries. This will allow for easy single graph creation. Concerning totals, well 2 routes for that, you can have your script present to total as a "host" or index value, or you can manually create and maintain the total graph. I suggest that you have the script do it.
For an example of data query and output and function, check out the "unix host disk" one.
For an example of data query and output and function, check out the "unix host disk" one.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
Thanks for the input rony.
I tried to understand the data query for "Unix - Get Mounted Partitions". I have to admint I didn't understand it
Trying to make it work from my localhost device is the first thing I didn't manage. Cacti tells me the following:
In Management -> Devices:
2) Unix - Get Mounted Partitions Success [0 Items, 0 Rows]
In New Graphs:
This data query returned 0 rows, perhaps there was a problem executing this data query. You can run this data query in debug mode to get more information.
The verbose mode shows this:
+ Running data query [6].
+ Found type = '4 '[script query].
+ Found data query XML file at '/home/mindpage/cacti/resource/script_queries/unix_disk.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'perl /home/mindpage/cacti/scripts/query_unix_partitions.pl index'
+ Executing script query 'perl /home/mindpage/cacti/scripts/query_unix_partitions.pl query device'
+ Executing script query 'perl /home/mindpage/cacti/scripts/query_unix_partitions.pl query mount'
+ Found data query XML file at '/home/mindpage/cacti/resource/script_queries/unix_disk.xml'
+ Found data query XML file at '/home/mindpage/cacti/resource/script_queries/unix_disk.xml'
+ Found data query XML file at '/home/mindpage/cacti/resource/script_queries/unix_disk.xml'
When I execute the scripts manually I get:
# perl /home/mindpage/cacti/scripts/query_unix_partitions.pl index
/dev/hda2
# perl /home/mindpage/cacti/scripts/query_unix_partitions.pl query device
/dev/hda2:/dev/hda2
# perl /home/mindpage/cacti/scripts/query_unix_partitions.pl query mount
/dev/hda2:/
Hope you can help me a bit to get the whole thing running. Thanks in advance.
Edit:
Running Cacti 0.86g with all patches applied and also exchanged the scripts from here: http://forums.cacti.net/viewtopic.php?t=9352
I tried to understand the data query for "Unix - Get Mounted Partitions". I have to admint I didn't understand it
Trying to make it work from my localhost device is the first thing I didn't manage. Cacti tells me the following:
In Management -> Devices:
2) Unix - Get Mounted Partitions Success [0 Items, 0 Rows]
In New Graphs:
This data query returned 0 rows, perhaps there was a problem executing this data query. You can run this data query in debug mode to get more information.
The verbose mode shows this:
+ Running data query [6].
+ Found type = '4 '[script query].
+ Found data query XML file at '/home/mindpage/cacti/resource/script_queries/unix_disk.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'perl /home/mindpage/cacti/scripts/query_unix_partitions.pl index'
+ Executing script query 'perl /home/mindpage/cacti/scripts/query_unix_partitions.pl query device'
+ Executing script query 'perl /home/mindpage/cacti/scripts/query_unix_partitions.pl query mount'
+ Found data query XML file at '/home/mindpage/cacti/resource/script_queries/unix_disk.xml'
+ Found data query XML file at '/home/mindpage/cacti/resource/script_queries/unix_disk.xml'
+ Found data query XML file at '/home/mindpage/cacti/resource/script_queries/unix_disk.xml'
When I execute the scripts manually I get:
# perl /home/mindpage/cacti/scripts/query_unix_partitions.pl index
/dev/hda2
# perl /home/mindpage/cacti/scripts/query_unix_partitions.pl query device
/dev/hda2:/dev/hda2
# perl /home/mindpage/cacti/scripts/query_unix_partitions.pl query mount
/dev/hda2:/
Hope you can help me a bit to get the whole thing running. Thanks in advance.
Edit:
Running Cacti 0.86g with all patches applied and also exchanged the scripts from here: http://forums.cacti.net/viewtopic.php?t=9352
Who is online
Users browsing this forum: No registered users and 2 guests