mirror of
https://github.com/Cacti/documentation.git
synced 2026-12-06 15:13:53 +09:00
docs: [1.2.x] refresh the front page, correct grammar and Markdown, and align plugin pages with their READMEs (#273)
* docs: [1.2.x] refresh the manual front page The front page opened with version notes before saying what Cacti is, used headings as sentences in the credits, and its table of contents listed seven sections while the page has ten. Open with a short description and a getting-started sequence, link the website and forums, give the credits real headings, and list every section in the table of contents in page order. Record Jeff Pasnak under In Memoriam with a link to the 1.2.31 release announcement. Correct label typos and wrap long entries with reference links. Existing section anchors are unchanged, and every page is still linked. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] fix typos, unrendered headings and forum links A check of every page linked from the front page found misspellings in eleven pages, three Mactrack headings written without a space after the hashes, which render as plain text, and two forum links still using http. Correct the spellings, add the missing space so the headings render, and point the forum links at https, where they already redirect. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] align the plugin pages with the plugin READMEs The supported plugins list and the Syslog and Mactrack pages had drifted from the README and INFO files in the plugin repositories. Update the descriptions that the READMEs contradict: Monitor's Thold requirement, the Router Configs transfer methods, the ReportIt release and Cacti versions, the WMI collection methods and its development status, and NUT support in Apcupsd. Add the Syslog requirements, the upgrade procedure, the dedicated database settings and the remote collector settings, and correct the database grant and a misplaced code fence. Add the Mactrack requirements and a short section on history partitioning and ignored ports that links to the README. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] correct grammar, spelling and broken Markdown A read of every page linked from the front page found grammar and spelling errors throughout, and Markdown that does not render as intended. Correct grammar, spelling, punctuation and product-name capitalization in 95 pages without changing headings, code blocks, link targets or the meaning of the text. Repair the Markdown defects: a code fence in the SSH tunnel how-to that never closed, malformed bold markers in the user management and device defaults pages, a release notes table with no blank line before it, split rows in the tree sorting table, and LDAP list items missing their markers. Correct three interface labels quoted with typos. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs: [1.2.x] correct statements that differ from the 1.2.x source Reviewers of the linked pages flagged statements that looked wrong. Each was compared with the Cacti 1.2.x source at 1523aa04b, and only those the source or the page itself settles are changed. Correct interface labels and option names (Index Count Changed, Permissive, Not Selected, Utilities, the BCC description, the gear icon for plugin install), the default Maximum Value of U for a new data source item, the sysDescr object name, the PHP floor wording in the requirements table, the Mactrack wildcard character and the snmptrapd -On option. Repair cross-references, example values that disagree with their commands, two table captions, a split list and several sentences with missing words. Statements the source does not settle are left as written. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
This commit is contained in:
1 parent
c53d1ac3a2
commit
741ad51355
100 files changed
+1574
-1467
No files matched your search
@@ -2,41 +2,39 @@
|
||||
|
||||
Goal of this HowTo will be to show the **principles of writing a Script Query**,
|
||||
including script, xml and all needed templates. Why should you create such a
|
||||
thing? Suppose, your target features some indexed readings, that are **not**
|
||||
thing? Suppose your target features some indexed readings that are **not**
|
||||
available via SNMP but by some other method (e.g. wget/cgi, ssh, NRPE, …).
|
||||
Writing a Script Data Queries works very much the same way as SNMP Data Queries.
|
||||
Writing Script Data Queries works very much the same way as SNMP Data Queries.
|
||||
But nevertheless, I'll take you through all of the steps now.
|
||||
|
||||
The example uses PHP. Why PHP? First, it's easier to copy stuff from already
|
||||
existing PHP scripts. Second, it would be possible to use cacti functions. It
|
||||
should be possible to imagine, how this works with other programming languages.
|
||||
existing PHP scripts. Second, it would be possible to use Cacti functions. It
|
||||
should be possible to imagine how this works with other programming languages.
|
||||
Strictly speaking, I'm not that PHP expert. So be patient with me.
|
||||
|
||||
Please pay attention. This HowTo will not explain how to write a **Script Server
|
||||
Data Query** (yes, there is such a thing!). It would not introduce that many
|
||||
changes. But this will be left to some other HowTo.
|
||||
|
||||
Personally, my primary goal was to use an example, that all users should be able
|
||||
Personally, my primary goal was to use an example that all users should be able
|
||||
to copy to execute each and every step on its own. Unfortunately, there seems to
|
||||
be no example, that is common enough and interesting at the same time. So I'm
|
||||
sorry to announce, that this HowTo will show “Interface Traffic Data Gathering”.
|
||||
be no example that is common enough and interesting at the same time. So I'm
|
||||
sorry to announce that this HowTo will show “Interface Traffic Data Gathering”.
|
||||
Yes, I know, this is not that new. And surely, it will not be as fast as pure
|
||||
SNMP. So, to my shame, I suppose that this will never make it into any
|
||||
production environment. But, again, this is not the primary goal.
|
||||
|
||||
Before starting the work, I feel encouraged to point out a drawback of this
|
||||
approach. Cacti will start a PHP instance, each time it has to fetch a value
|
||||
approach. Cacti will start a PHP instance each time it has to fetch a value
|
||||
from the target device. This is not that fast, obviously. And it will not
|
||||
prosper from the performance boost when switching over from cmd.php to Spine. Of
|
||||
course, even Spine will need to start php! And that's exactly, where the thingy
|
||||
course, even Spine will need to start PHP! And that's exactly where the thingy
|
||||
called **Script Server Data Query** drops in. But let's leave this for the next
|
||||
main chapter.
|
||||
|
||||
The code runs on Cacti 0.8.7 versions.
|
||||
|
||||
## Basic Script
|
||||
|
||||
The starting point will be some very basic php script. Put it into
|
||||
The starting point will be some very basic PHP script. Put it into
|
||||
`<path_cacti>/scripts/query_interface_traffic.php`. It will show interface
|
||||
indices only for the given target host. The script takes two parameters as
|
||||
input, the **hostname** of the target and the string **index**. You have to
|
||||
@@ -133,9 +131,9 @@ As you see, my `<target>` has 4 indices (interfaces).
|
||||
|
||||
### Discussion: function_reindex
|
||||
|
||||
You may wonder why this function drops in. Well, lets have a look at
|
||||
`cacti_snmp_walk`. This function is part of cacti itself and eases the use of
|
||||
SNMP. That's why I call it here. But unfortunately, it's output looks like
|
||||
You may wonder why this function drops in. Well, let's have a look at
|
||||
`cacti_snmp_walk`. This function is part of Cacti itself and eases the use of
|
||||
SNMP. That's why I call it here. But unfortunately, its output looks like
|
||||
|
||||
```php
|
||||
Array
|
||||
@@ -172,7 +170,7 @@ The values of interest are stored in `$return_arr[$i] = $arr[$i][“value”];`.
|
||||
|
||||
## XML File
|
||||
|
||||
This given, the first step will be the xml file defining how to access index
|
||||
This given, the first step will be the XML file defining how to access index
|
||||
values only. So change to your `<path_cacti>/resource/script_queries` directory
|
||||
and create a file named **ifTraffic.xml**. You may of course choose your own
|
||||
name.
|
||||
@@ -194,12 +192,12 @@ name.
|
||||
</interface>
|
||||
```
|
||||
|
||||
Lets talk about the header elements
|
||||
Let's talk about the header elements
|
||||
|
||||
| field | description |
|
||||
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| name | Short Name; chose your own one if you want |
|
||||
| script_path | Whole command to execute the script from cli. `path_php_binary`is a cacti builtin variable for`/the/full/path/to/php`. `path_cacti` in turn gives the path of the current cacti installation directory. |
|
||||
| name | Short Name; choose your own one if you want |
|
||||
| script_path | Whole command to execute the script from the CLI. `path_php_binary` is a Cacti builtin variable for `/the/full/path/to/php`. `path_cacti` in turn gives the path of the current Cacti installation directory. |
|
||||
| arg_prepend | All arguments passed to the script go here. There are some builtin variables, again. `host_hostname` represents the hostname of the device this query will be associated to. |
|
||||
| arg_index | The string given here will be passed just after all `<arg_prepend>` to the script for indexing requests. Up to now, this is the only method our script will answer to. |
|
||||
| fields | All fields will be defined in this section. Up to now, only the index field is defined |
|
||||
@@ -208,10 +206,10 @@ Lets talk about the header elements
|
||||
|
||||
| direction | Description |
|
||||
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| input | defines all fields that serve as a descriptive information to a specific table index. These values will not be graphed but may be printed in e.g.graph titles by means of `query\_<name>` |
|
||||
| input | defines all fields that serve as a descriptive information to a specific table index. These values will not be graphed but may be printed in e.g. graph titles by means of `query\_<name>` |
|
||||
| output | defines all fields that will yield a number that should be stored in some RRDfile |
|
||||
|
||||
Now save this file and lets turn to cacti to implement this one. First, go to
|
||||
Now save this file and let's turn to Cacti to implement this one. First, go to
|
||||
**Data Queries** to see
|
||||
|
||||

|
||||
@@ -226,12 +224,12 @@ and don't forget to choose **Get Script Data (Indexed)**. **Create** to see
|
||||

|
||||
|
||||
It has now **Successfully located XML file**. But this does not mean that there
|
||||
are no errors. So lets go on with that. Turn to the **Device** you want to query
|
||||
and add the new **Data Query** as shown:
|
||||
are no errors. So let's go on with that. Turn to the **Device** you want to
|
||||
query and add the new **Data Query** as shown:
|
||||
|
||||

|
||||
|
||||
**Index Count** was chosen on purpose as the **Re-Index Method** to tell cacti
|
||||
**Index Count** was chosen on purpose as the **Re-Index Method** to tell Cacti
|
||||
to re-index not only on reboot but each time the Index Count (e.g. number of
|
||||
interfaces) changed.
|
||||
When done, see the results as
|
||||
@@ -244,8 +242,8 @@ To see your script at work, select **Verbose Query** to see:
|
||||
|
||||
## Completing the Script
|
||||
|
||||
Now, lets improve our basic script. First, lets define all the variables (OIDs),
|
||||
this script should ask for.
|
||||
Now, let's improve our basic script. First, let's define all the variables
|
||||
(OIDs) this script should ask for.
|
||||
|
||||
```php
|
||||
<?php
|
||||
@@ -389,7 +387,7 @@ Last option is the **get** function
|
||||
$snmp_context, $snmp_port, $snmp_timeout, $snmp_retries, SNMP_POLLER));
|
||||
```
|
||||
|
||||
The rest of it is left unchanged. For sake of completeness, I repeat it here
|
||||
The rest of it is left unchanged. For the sake of completeness, I repeat it here
|
||||
|
||||
```php
|
||||
# -------------------------------------------------------------------------
|
||||
@@ -415,7 +413,7 @@ function reindex($arr) {
|
||||
```
|
||||
|
||||
You may want to copy all those fragments together and replace the basic script.
|
||||
Now, lets have a try using the command line. The “index” option was already
|
||||
Now, let's have a try using the command line. The “index” option was already
|
||||
shown, but is repeated here
|
||||
|
||||
```console
|
||||
@@ -451,7 +449,7 @@ Let's discuss the changes
|
||||
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| arg_prepend | some more parameters were added to provide all necessary values for the script. They are position-dependent. You may notice the strange tics I've added to e.g. host_snmp_username and host_snmp_password. If you're not using those SNMP V3 parameters, they must be quoted, else the script would fail because two parameters would be missing. |
|
||||
| arg_query | The string passed to the query to perform query requests is given here. So you may modify it to your liking (in this case, the script has to be modified accordingly). |
|
||||
| arg_get | Some as above for get requests |
|
||||
| arg_get | Same as above for get requests |
|
||||
| output_delimiter | The delimiter used for query requests to separate index and value |
|
||||
| index_order (optional) | Cacti will attempt to find the best field to index off of based on whether each row in the query is unique and non-null. If specified, Cacti will perform this check on the fields listed here in the order specified. Only input fields can be specified and multiple fields should be delimited with a colon. |
|
||||
| index_title_format (optional) | Specify the title format to use when representing an index to the user. Any input field name can be used as a variable if enclosed in pipes ( ). The variable `chosen_order_field` will be substituted with the field chosen by Cacti to index off of (see index_order above). Text constants are allowed as well |
|
||||
@@ -462,7 +460,7 @@ Let's discuss the changes
|
||||
| numeric | The indexes in this script query are to be sorted numerically (ie. 1,2,3,10,20,31) |
|
||||
| alphabetic | The indexes in this script query are to be sorted alphabetically (1,10,2,20,3,31) |
|
||||
|
||||
Now lets turn to the fields section:
|
||||
Now let's turn to the fields section:
|
||||
|
||||
```xml
|
||||
....
|
||||
@@ -531,12 +529,12 @@ Now lets turn to the fields section:
|
||||
```
|
||||
|
||||
These fields are related to the **OID** array of the script. **Attention**: The
|
||||
**query_name** strings must match the OID names **exactly!** Please notice, that
|
||||
**query_name** strings must match the OID names **exactly!** Please notice that
|
||||
all but the last two fields use **direction input**. All variables representing
|
||||
numeric values to be graphed must be defined as **direction output** instead.
|
||||
|
||||
Now, lets test the “query” option. The keyword “query” must be given along with
|
||||
the variable, that should be queried. The script now will scan all indices and
|
||||
Now, let's test the “query” option. The keyword “query” must be given along with
|
||||
the variable that should be queried. The script now will scan all indices and
|
||||
report the contents of the given variable as follows:
|
||||
|
||||
```console
|
||||
@@ -551,7 +549,7 @@ The output reports the index, followed by the chosen delimiter. Then, the
|
||||
content of the requested variable is printed
|
||||
|
||||
Last, the “get” option is shown. The keyword “get” is required, followed again
|
||||
by the variable (see above). Last needed option is the index, for which the
|
||||
by the variable (see above). Last needed option is the index for which the
|
||||
“get” should be performed. Contrary to the “query” option, only one index is
|
||||
scanned. So the index number is not required and will not be printed.
|
||||
|
||||
@@ -564,7 +562,7 @@ The output is not followed by a “newline”!
|
||||
|
||||
## See it at work
|
||||
|
||||
Lets return to the **Device** and perform a **Verbose Query** again. The result
|
||||
Let's return to the **Device** and perform a **Verbose Query** again. The result
|
||||
is as follows
|
||||
|
||||
```console
|
||||
@@ -619,7 +617,7 @@ is as follows
|
||||
```
|
||||
|
||||
Of course, snmp_username and snmp_user_password and more may differ from your
|
||||
installation defaults. Read it carefully, and you'll notice, that all XML
|
||||
installation defaults. Read it carefully, and you'll notice that all XML
|
||||
**fields** were scanned and the output shown. All? No, not all. The **direction
|
||||
output** fields are missing! But this is on purpose as those won't make sense as
|
||||
header fields but will be written to RRDfiles.
|
||||
@@ -649,7 +647,7 @@ overwrite all the data source and graph names.
|
||||
|
||||
Now, before you press the `Create` button also please proceed to the lower half
|
||||
of the form and complete the first RRDfile Data Source. Enter the **Internal
|
||||
Data Source Name**. You may select this name freely, though note your are
|
||||
Data Source Name**. You may select this name freely, though note you are
|
||||
limited to only 19 characters and spaces are not allowed. There's no need to
|
||||
match it to any of the XML field names. As the OID is a **COUNTER**, the **Data
|
||||
Source Type** must be selected appropriately. `Create`.
|
||||
@@ -667,7 +665,7 @@ save again and you're done.
|
||||
|
||||
## Create the Graph Template
|
||||
|
||||
Now, its time for the **Graph Template**. Select this menu item and **Add**.
|
||||
Now, it's time for the **Graph Template**. Select this menu item and **Add**.
|
||||
|
||||

|
||||
|
||||
@@ -698,14 +696,14 @@ and remove the newline by deselecting the checkbox
|
||||
|
||||

|
||||
|
||||
Now lets add the same data source again, but as a LINE1, MAXimum with a slightly
|
||||
changed color. Newline is checked this time
|
||||
Now let's add the same data source again, but as a LINE1, MAXimum with a
|
||||
slightly changed color. Newline is checked this time
|
||||
|
||||

|
||||
|
||||
Pooh. Now lets apply the same procedure for the **Outgoing Traffic**.
|
||||
Pooh. Now let's apply the same procedure for the **Outgoing Traffic**.
|
||||
Personally, I love those outgoing stuff to be presented on the negative y-axis.
|
||||
So we'll have to apply some CDEF magic to some items. Lets see
|
||||
So we'll have to apply some CDEF magic to some items. Let's see
|
||||
|
||||

|
||||
|
||||
@@ -727,22 +725,22 @@ newline
|
||||
|
||||

|
||||
|
||||
Hoping, you've got all those steps correctly, finally **Save** your work. Take a
|
||||
Hoping you've got all those steps correctly, finally **Save** your work. Take a
|
||||
cup of coffee to get your brains free again, kiss your wife, hug your children
|
||||
and/or pet your dog; sequence is arbitrary.
|
||||
|
||||
## Associate Graph Template with Data Query
|
||||
|
||||
Huh, that sound complicated. Why would it be necessary to do so? Let me explain:
|
||||
You remember the **Data Template**, do you? The names of the data source item
|
||||
was chosen arbitrary. The Graph Items were associated with those data source
|
||||
items, but those in turn were not related to anything in the XML file. Not
|
||||
related? Not yet! So, let's revisit the **Data Query**. Remember the lower part
|
||||
on **Associated Graph Templates**. Click **Add**
|
||||
Huh, that sounds complicated. Why would it be necessary to do so? Let me
|
||||
explain: You remember the **Data Template**, do you? The names of the data
|
||||
source items were chosen arbitrarily. The Graph Items were associated with those
|
||||
data source items, but those in turn were not related to anything in the XML
|
||||
file. Not related? Not yet! So, let's revisit the **Data Query**. Remember the
|
||||
lower part on **Associated Graph Templates**. Click **Add**
|
||||
|
||||

|
||||
|
||||
fill in a name for your choice and select the Graph Template that we have
|
||||
fill in a name of your choice and select the Graph Template that we have
|
||||
created in the last step.
|
||||
|
||||

|
||||
@@ -752,12 +750,12 @@ created in the last step.
|
||||

|
||||
|
||||
First, let's have a look at the upper half of the screen. The red box to the
|
||||
left show the **Internal Data Source Names** names taken from the **Data
|
||||
left shows the **Internal Data Source Names** taken from the **Data
|
||||
Template** that is associated with the **Graph template** we've just added. The
|
||||
red box to the middle has a dropdown for each data source item. The dropdown
|
||||
list contains all **output** fields taken from the XML file. In our case, there
|
||||
are only two of them. The red box to the right must be checked on each line, to
|
||||
make the association valid. Now, lets turn to the lower half of the screen,
|
||||
are only two of them. The red box to the right must be checked on each line to
|
||||
make the association valid. Now, let's turn to the lower half of the screen,
|
||||
denoted **Suggested Values**
|
||||
|
||||

|
||||
@@ -769,9 +767,9 @@ Click **Add**, one by one
|
||||

|
||||
|
||||
Notice the second **title** I've added here. If more than one entry is present,
|
||||
they are applied from top to bottom, until a match is found. Match means, that
|
||||
they are applied from top to bottom, until a match is found. Match means that
|
||||
all variables present are filled. Of course, you may add more than one variable
|
||||
taken from the XML file. But pay attention, that not all devices will fill all
|
||||
taken from the XML file. But pay attention that not all devices will fill all
|
||||
those variables. So my router does, sigh. You may use all **input** variables
|
||||
listed in the XML file. A `<variable>` may be listed as `|query_<variable>|`,
|
||||
e.g. for ifalias write `|query_ifalias|` and so forth.
|
||||
@@ -792,7 +790,7 @@ Don't worry about the first two entries; they are home-made.
|
||||
|
||||
## Creating the Images
|
||||
|
||||
Now, let's return to the **Device**, that we've already have used for this Data
|
||||
Now, let's return to the **Device** that we've already used for this Data
|
||||
Query. **Create Graphs for this Device**
|
||||
|
||||

|
||||
|
||||
Reference in new issue
Block a user