Initial revision
git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti/trunk/cacti@2 860744bd-22fc-0310-8c96-e9fe5004b5ca
No files matched your search
@@ -0,0 +1,280 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@@ -0,0 +1 @@
|
||||
Please view "docs/README" and "docs/INSTALL.htm" for more information.
|
||||
@@ -0,0 +1,147 @@
|
||||
<?
|
||||
|
||||
$section = "Add/Edit Graphs"; include ('include/auth.php');
|
||||
include_once ("include/database.php");
|
||||
|
||||
$heirarchy = db_fetch_assoc("SELECT *,graph_viewing.Title HTitle,rrd_graph.Title GTitle, graph_viewing.ID VID
|
||||
FROM graph_viewing
|
||||
LEFT JOIN rrd_graph ON graph_viewing.GraphID = rrd_graph.ID
|
||||
WHERE OrderKey LIKE '$search_key%' ORDER BY OrderKey");
|
||||
|
||||
/*
|
||||
for ($i = (sizeof($heirarchy) - 1); $i > 0; --$i) {
|
||||
$leaf = $heirarchy[$i];
|
||||
$tier = tree_tier($leaf[OrderKey], 2);
|
||||
|
||||
if ($tier > 1) {
|
||||
$parent_key = str_pad(substr($leaf[OrderKey],0,(($tier - 1) * 2) ),60,'0',STR_PAD_RIGHT);
|
||||
|
||||
if ($leaf[GraphID] && (! isset($counted_graphs[$parent_key]))) {
|
||||
++$num_children[$parent_key];
|
||||
++$counted_graphs[$parent_key];
|
||||
}
|
||||
|
||||
if (!$leaf[GraphID]) {
|
||||
++$num_children[$parent_key];
|
||||
++$num_children[$parent_key];
|
||||
}
|
||||
}
|
||||
|
||||
if ($tier > $max_tier) { $max_tier = $tier; }
|
||||
}
|
||||
*/
|
||||
|
||||
if (sizeof($heirarchy) > 0) {
|
||||
foreach ($heirarchy as $leaf) {
|
||||
$no_children = 0;
|
||||
|
||||
if (sizeof($hide) > 0) {
|
||||
foreach (array_keys($hide) as $key_root) {
|
||||
if (preg_match("/^$key_root/",$leaf[OrderKey])) {
|
||||
if (preg_match("/^".$key_root."00/",$leaf[OrderKey])) {
|
||||
$no_children = 1;
|
||||
}else{
|
||||
$skip_entry = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($skip_entry) {
|
||||
$skip_entry = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
$tier = tree_tier($leaf[OrderKey], 2);
|
||||
//$current_leaf_type = $leaf[GraphID] ? "graph" : "heading";
|
||||
|
||||
//if ($current_leaf_type == 'heading') {
|
||||
|
||||
//if ($heading_ct > 0) {
|
||||
// if ($graph_ct % 2 != 0) { print "</tr>\n"; }
|
||||
// print "</table></td>\n";
|
||||
//}
|
||||
$pix = $tier * 20;
|
||||
$indent = "<img src=\"images/gray_line.gif\" width=\"$pix\" height=\"1\" align=\"middle\"> ";
|
||||
|
||||
if ($leaf[GraphID] == "0") {
|
||||
print $indent . $leaf[HTitle] . "<br>";
|
||||
}else{
|
||||
print $indent . $leaf[Title] . "<br>";
|
||||
}
|
||||
//$colspan = (($max_tier - $tier) * 2);
|
||||
//$rowspan = $num_children[$leaf[OrderKey]];
|
||||
# print "Children for $leaf[HTitle] = '".$num_children[$leaf[OrderKey]]."'<BR>\n";
|
||||
//print "<tr>\n";
|
||||
//if ($options[$current_leaf_type."s_show_children"]) {
|
||||
// if ($options[use_expand_contract]) {
|
||||
//if ($hide[preg_replace("/0+$/","",$leaf[OrderKey])] == 1) {
|
||||
// $other_status = '0';
|
||||
// $ec_icon = 'show';
|
||||
//} else {
|
||||
// $other_status = '1';
|
||||
// $ec_icon = 'hide';
|
||||
// ++$heading_ct;
|
||||
//}
|
||||
//print "<td bgcolor=\"$colors[panel]\" align=\"center\" width=\"1\"><a
|
||||
// href='$PHP_SELF?action=tree&tree_id=$tree_id&start_branch=$start_branch&hide=$other_status&branch_id=$leaf[VID]'><img
|
||||
// src='images/$ec_icon.gif' border='0'></a></td>\n";
|
||||
|
||||
// } else {
|
||||
//print "<td bgcolor=\"$colors[panel]\" width=\"1\">$indent</td>\n";
|
||||
// }
|
||||
///} else {
|
||||
// print "<td bgcolor=\"$colors[panel]\" width=\"1\">$indent</td>\n";
|
||||
//}
|
||||
//print "<td bgcolor=\"$colors[panel]\" colspan=$colspan NOWRAP><strong><a
|
||||
// href='?tree_id=$tree_id&start_branch=$leaf[OrderKey]'>$leaf[HTitle]</a></strong></td>\n";
|
||||
//print "</tr>";
|
||||
//if ($num_children[$leaf[OrderKey]] > 0 && ! $no_children) {
|
||||
// print "<tr>\n<td bgcolor=\"$colors[panel]\" width=\"1%\" rowspan=$rowspan> </td>
|
||||
// <td colspan=$colspan><table border=0><tr>\n";
|
||||
//}
|
||||
//$graph_ct = 0;
|
||||
// } else {
|
||||
//++$graph_ct;
|
||||
//switch ($array_settings["hierarchical"]["viewtype"]) {
|
||||
// case "1":
|
||||
// print "<td><a href='graph.php?graphid=$leaf[GraphID]&rraid=all'><img align='middle'
|
||||
// src='graph_image.php?graphid=$leaf[GraphID]&rraid=$leaf[RRAID]&graph_start=-".$array_settings["preview"]["timespan"].'&graph_height='.
|
||||
// $array_settings["preview"]["height"].'&graph_width='.$array_settings["preview"]["width"] ."&graph_nolegend=true' border='0' alt='$leaf[Title]'></a><td>\n";
|
||||
// break;
|
||||
//case "2":
|
||||
// print "<td><a href='graph.php?graphid=$leaf[GraphID]&rraid=all'>$leaf[GTitle]</a></td>";
|
||||
// break;
|
||||
//}
|
||||
//if ($graph_ct % 2 == 0) { print "</tr><tr>\n"; }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
## This function decides what 'tier' a given id is on based on the characters per tier.
|
||||
## For example: Called with ('1000','1'), it would return '1'.
|
||||
## Called with ('1010','1'), it would return '3'.
|
||||
## Called with ('1010','2'), it would return '2'.
|
||||
##
|
||||
## Note: 'tier' is determined from left to right.
|
||||
function tree_tier($id,$chars_per_tier) {
|
||||
$root_test = str_pad('',$chars_per_tier,'0');
|
||||
|
||||
if (preg_match("/^$root_test/",$id)) {
|
||||
$tier = 0;
|
||||
}else{
|
||||
$tier = (strlen($id)/$chars_per_tier);
|
||||
|
||||
for($ct = -$chars_per_tier; abs($ct) < strlen($id); $ct -= $chars_per_tier) {
|
||||
if (substr($id,$ct,$chars_per_tier) == "00") {
|
||||
$tier = (strlen($id)/$chars_per_tier)-(abs($ct)/$chars_per_tier) ;
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return($tier);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? $section = "Console Access"; include ('include/auth.php');
|
||||
# include ('include/config.php');
|
||||
# include ("include/database.php");
|
||||
include_once ("include/top_header.php"); ?>
|
||||
|
||||
<table width="97%">
|
||||
<tr>
|
||||
<td bgcolor="#<?print $colors[dark_bar];?>" colspan="2">
|
||||
<strong><font size="+0">About raXnet's cacti (Version <?print $config[cacti_version];?>)</font></strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p>raXnet's cacti, the complete rrdtool frontend was written by Ian Berry. This
|
||||
product took many long hours of PHP and SQL design, so I hope you find it very
|
||||
useful.</p>
|
||||
|
||||
<p><strong>Thanks</strong><br>
|
||||
- A very special thanks to <a href="http://ee-staff.ethz.ch/~oetiker/">Tobi Oetiker</a>,
|
||||
the creator of <a href="http://www.mrtg.org/">rrdtool</a> and the very popular
|
||||
<a href="http://www.mrtg.org">MRTG</a>.<br>
|
||||
- Brady Alleman, creator of NetMRG and
|
||||
<a href="http://www.treehousetechnologies.net">Treehouse Technolgies</a> for questions and ideas. Just
|
||||
as a note, NetMRG is a complete Network Monitering solution also written in PHP/MySQL. His
|
||||
product also makes use of rrdtool's graphing capabilites, I encourage you to check it out.<br>
|
||||
- <a href="http://www.globalunderground.co.uk/">Cluboxed</a>, the creator of the popular Global
|
||||
Underground compilations for hours of listening enjoyment.</p>
|
||||
|
||||
<p><strong>Ways to Contact Ian</strong><br>
|
||||
<a href="mailto:iberry@raxnet.net">iberry@raxnet.net</a><br>
|
||||
<a href="mailto:rax@kuhncom.net">rax@kuhncom.net</a><br></p>
|
||||
|
||||
<strong><a href="http://www.raxnet.net/">raXnet home</a></strong><br>
|
||||
</td>
|
||||
<td>
|
||||
<img src="images/cacti.png" width="52" height="385" border="0" alt="">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?include_once ("include/bottom_footer.php");?>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? include ("include/database.php");
|
||||
include ("include/config.php");
|
||||
|
||||
/* SESSION DATA */
|
||||
session_start();
|
||||
|
||||
$userid = $HTTP_SESSION_VARS["user_id"];
|
||||
$user = db_fetch_row("select * from auth_users where id=$userid",$cnn_id);
|
||||
|
||||
$ip = trim(getenv("REMOTE_ADDR"));
|
||||
//$username = mysql_result($res_id_user, 0, "username");
|
||||
|
||||
switch ($action) {
|
||||
case 'changepassword':
|
||||
if (($password == $confirm) && ($password != "")) {
|
||||
mysql_query("insert into auth_log (username,success,ip) values(\"$user[Username]\",3,\"$ip\")",$cnn_id);
|
||||
mysql_query("update auth_users set mustchangepassword=\"\",password=PASSWORD(\"$password\") where id=$userid",$cnn_id);
|
||||
|
||||
$HTTP_SESSION_VARS['change_password'] = 0;
|
||||
|
||||
header("Location: $ref");
|
||||
exit;
|
||||
}else{
|
||||
$badpassword = true;
|
||||
}
|
||||
|
||||
break;
|
||||
} ?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Login to cacti</title>
|
||||
<STYLE TYPE="text/css">
|
||||
<!--
|
||||
BODY, TABLE, TR, TD {font-family: "Verdana, Arial, Helvetica, sans-serif"; font-size: 12px;}
|
||||
A {text-decoration: none;}
|
||||
A:active { text-decoration: none;}
|
||||
A:hover {text-decoration: underline; color: #333333;}
|
||||
A:visited {color: Blue;}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post" action="<?print $HTTP_SERVER_VARS["SCRIPT_NAME"];?>">
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td colspan="2"><img src="images/auth_login.gif" border="0" alt=""></td>
|
||||
</tr>
|
||||
<?if ($badpassword == true) {?>
|
||||
<tr height="10"></tr>
|
||||
<tr>
|
||||
<td colspan="2"><font color="#FF0000"><strong>Your passwords do not match, please retype:</strong></font></td>
|
||||
</tr><?}?>
|
||||
<tr height="10"></tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<strong><font color="#FF0000">*** Forced Password Change ***</font></strong><br><br>
|
||||
Please enter a new password for cacti:
|
||||
</td>
|
||||
</tr>
|
||||
<tr height="10"></tr>
|
||||
<tr>
|
||||
<td>Password:</td>
|
||||
<td><input type="password" name="password" size="40"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Confirm:</td>
|
||||
<td><input type="password" name="confirm" size="40"></td>
|
||||
</tr>
|
||||
<tr height="10"></tr>
|
||||
<tr>
|
||||
<td><input type="submit" value="Save"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="action" value="changepassword">
|
||||
<input type="hidden" name="ref" value="<?print $ref;?>">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,161 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? session_start();
|
||||
|
||||
include ("include/config.php");
|
||||
include_once ("include/functions.php");
|
||||
|
||||
if ($action=="login"){
|
||||
include_once ("include/database.php");
|
||||
|
||||
$user = db_fetch_row("select * from auth_users where Username=\"$username\" and Password = PASSWORD(\"$password\")");
|
||||
$ip = trim(getenv("REMOTE_ADDR"));
|
||||
|
||||
if (sizeof($user) == 0) {
|
||||
$badpassword = true;
|
||||
}
|
||||
|
||||
if ($badpassword != true) {
|
||||
/* do hostnmame matching */
|
||||
$res_id_host = db_fetch_assoc("select Hostname,Type from auth_hosts where userid=$user[ID] order by type");
|
||||
|
||||
if (sizeof($res_id_host) > 0) {
|
||||
foreach ($res_id_host as $host) {
|
||||
switch ($host[Type]) {
|
||||
case "1":
|
||||
if ($done != true) {
|
||||
if ($host[Hostname] == $ip) {
|
||||
$deny = true; $done = true;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case "2":
|
||||
if ($done != true) {
|
||||
if ($host[Hostname] == $ip) {
|
||||
$deny = false; $done = true;
|
||||
}else{
|
||||
$deny = true;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if the user is denied because of a hostname; log it and exit */
|
||||
if ($deny==true) {
|
||||
$res_id = db_execute("insert into auth_log (username,success,ip) values(\"$username\",2,\"$ip\")");
|
||||
include_once ("$current_path/noauth.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($badpassword != true) {
|
||||
$ref = getenv("HTTP_REFERER");
|
||||
db_execute("insert into auth_log (username,success,ip) values(\"$username\",1,\"$ip\")");
|
||||
|
||||
$user_id = $user[ID];
|
||||
$user_hash = $user[Password];
|
||||
|
||||
session_register("user_id");
|
||||
session_register("user_hash");
|
||||
|
||||
if ($user[MustChangePassword] == "on") {
|
||||
/* set this cookie to force a password change */
|
||||
//header ("Set-Cookie: changepassword=1; path=/;");
|
||||
$change_password = 1;
|
||||
session_register("change_password");
|
||||
}
|
||||
|
||||
/* ok, at the point the user has been sucessfully authenticated; so we must
|
||||
decide what to do next */
|
||||
switch ($user[LoginOpts]) {
|
||||
case '1': /* referer */
|
||||
header("Location: $ref"); break;
|
||||
case '2': /* default console page */
|
||||
header("Location: index.php"); break;
|
||||
case '3': /* default graph page */
|
||||
header("Location: graph_view.php?action=tree"); break;
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
} ?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Login to cacti</title>
|
||||
<STYLE TYPE="text/css">
|
||||
<!--
|
||||
BODY, TABLE, TR, TD {font-family: "Verdana, Arial, Helvetica, sans-serif"; font-size: 12px;}
|
||||
A {text-decoration: none;}
|
||||
A:active { text-decoration: none;}
|
||||
A:hover {text-decoration: underline; color: #333333;}
|
||||
A:visited {color: Blue;}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<? /* apparently IIS 5/4 have a bug (Q176113) where setting a cookie and calling the header via
|
||||
'Location' does not work. This seems to fix the bug for me at least... */ ?>
|
||||
<form method="post" action="<?print $HTTP_SERVER_VARS["SCRIPT_NAME"];?>">
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td colspan="2"><img src="images/auth_login.gif" border="0" alt=""></td>
|
||||
</tr>
|
||||
<?if ($badpassword==true) {
|
||||
db_execute("insert into auth_log (username,success,ip) values(\"$username\",0,\"$ip\")");?>
|
||||
<tr height="10"></tr>
|
||||
<tr>
|
||||
<td colspan="2"><font color="#FF0000"><strong>Invalid User Name/Password Please Retype:</strong></font></td>
|
||||
</tr><?}?>
|
||||
<tr height="10"></tr>
|
||||
<tr>
|
||||
<td colspan="2">Please enter your cacti user name and password below:</td>
|
||||
</tr>
|
||||
<tr height="10"></tr>
|
||||
<tr>
|
||||
<td>User Name:</td>
|
||||
<td>
|
||||
<?if ($conf_drop_down_user_list==true) {?>
|
||||
<select name="username">
|
||||
<? CreateList($cnn_id,"select username from auth_users","username","username", ""); ?>
|
||||
</select>
|
||||
<?}else{?>
|
||||
<input type="text" name="username" size="40"><?}?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Password:</td>
|
||||
<td><input type="password" name="password" size="40"></td>
|
||||
</tr>
|
||||
<tr height="10"></tr>
|
||||
<tr>
|
||||
<td><input type="submit" value="Login"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="action" value="login">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? session_start();
|
||||
include ("include/config.php"); ?>
|
||||
<html>
|
||||
<head>
|
||||
<title>cacti - Access Denied</title>
|
||||
<STYLE TYPE="text/css">
|
||||
<!--
|
||||
BODY, TABLE, TR, TD {font-family: "Verdana, Arial, Helvetica, sans-serif"; font-size: 12px;}
|
||||
A {text-decoration: none;}
|
||||
A:active { text-decoration: none;}
|
||||
A:hover {text-decoration: underline; color: #333333;}
|
||||
A:visited {color: Blue;}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td colspan="2"><img src="images/auth_deny.gif" border="0" alt=""></td>
|
||||
</tr>
|
||||
<tr height="10"></tr>
|
||||
<tr>
|
||||
<td colspan="2">You are not permitted to access this section of cacti.
|
||||
If you feel that you need access to this particular section, please contact the webmaster.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,130 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - 2/8/2002 - Dave Neitz, Sprint E|Solutionns |
|
||||
| Added 3 new CDEF special types to the CDEF drop down list box: |
|
||||
| |
|
||||
| Type Description |
|
||||
| ---- ----------- |
|
||||
| 3 Staggered Total of Data Sources on a Graph |
|
||||
| 4 Average of All Data Sources on a Graph |
|
||||
| 5 Staggered Average of Data Sources on a Graph |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
$section = "Add/Edit Data Sources";
|
||||
include ('include/auth.php');
|
||||
header("Cache-control: no-cache");
|
||||
include_once ('include/form.php');
|
||||
|
||||
if (isset($form[action])) { $action = $form[action]; } else { $action = $args[action]; }
|
||||
if (isset($form[ID])) { $id = $form[ID]; } else { $id = $args[id]; }
|
||||
|
||||
switch ($action) {
|
||||
case 'save':
|
||||
$sql_id = db_execute("replace into rrd_ds_cdef (id,name,type) values ($id,\"$form[Name]\",$form[Type])");
|
||||
|
||||
header ("Location: cdef.php");
|
||||
break;
|
||||
case 'remove':
|
||||
if (($config["remove_verification"]["value"] == "on") && ($confirm != "yes")) {
|
||||
include_once ('include/top_header.php');
|
||||
DrawConfirmForm("Are You Sure?", "Are you sure you want to delete this CDEF?", $current_script_name, "?action=remove&id=$id");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (($config["remove_verification"]["value"] == "") || ($confirm == "yes")) {
|
||||
db_execute("delete from rrd_ds_cdef where id=$id");
|
||||
db_execute("delete from rrd_ds_cdef_item where cdefid=$id");
|
||||
}
|
||||
|
||||
header ("Location: cdef.php");
|
||||
break;
|
||||
case 'edit':
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
if ($id != "") {
|
||||
$row = db_fetch_assoc("select * from rrd_ds_cdef where id=$id");
|
||||
$cdef = $row[0];
|
||||
}
|
||||
|
||||
DrawFormHeader("rrdtool Data Source Configuration","",false);
|
||||
|
||||
DrawFormItem("Name","The name of this CDEF function, only used for internal purposes.");
|
||||
DrawFormItemTextBox("Name",$cdef[Name],"","");
|
||||
|
||||
DrawFormItem("CDEF Type","Always select \"Normal\", unless you want to create a special CDEF.");
|
||||
DrawFormItemDropDownCustomHeader("Type");
|
||||
DrawFormItemDropDownCustomItem("Type","1","Normal",$cdef[Type]);
|
||||
DrawFormItemDropDownCustomItem("Type","2","Total of All Data Sources on a Graph",$cdef[Type]);
|
||||
DrawFormItemDropDownCustomItem("Type","3","Staggered Total of Data Sources on a Graph",$cdef[Type]);
|
||||
DrawFormItemDropDownCustomItem("Type","4","Average of All Data Sources on a Graph",$cdef[Type]);
|
||||
DrawFormItemDropDownCustomItem("Type","5","Staggered Average of Data Sources on a Graph",$cdef[Type]);
|
||||
DrawFormItemDropDownCustomFooter();
|
||||
|
||||
DrawFormSaveButton();
|
||||
DrawFormItemHiddenIDField("ID",$id);
|
||||
DrawFormFooter();
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
default:
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
DrawMatrixTableBegin("97%");
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderTop("Current CDEF Functions",$colors[dark_bar],"","2");
|
||||
DrawMatrixHeaderAdd($colors[dark_bar],"","cdef.php?action=edit");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderItem("Name",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Edit CDEF",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
$rows = db_fetch_assoc("select * from rrd_ds_cdef", $cnn_id);
|
||||
$numrows = sizeof($rows);
|
||||
|
||||
foreach ($rows as $cdef) {
|
||||
++$i;
|
||||
DrawMatrixRowAlternateColorBegin($colors[alternate],$colors[light],$i);
|
||||
DrawMatrixLoopItem($cdef[Name],html_boolean($config["vis_main_column_bold"]["value"]),"cdef.php?action=edit&id=$cdef[ID]");
|
||||
|
||||
if ($cdef[Type] == "1") { /* normal cdef */
|
||||
$matrix_url = "cdef_items.php?id=$cdef[ID]";
|
||||
}else{
|
||||
$matrix_url = "";
|
||||
}
|
||||
|
||||
DrawMatrixLoopItem("Edit Current CDEF",false,$matrix_url);
|
||||
DrawMatrixLoopItemAction("Remove",$colors[panel],"",false,"cdef.php?action=remove&id=$cdef[ID]");
|
||||
DrawMatrixRowEnd();
|
||||
}
|
||||
|
||||
DrawMatrixTableEnd();
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
} ?>
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? $section = "Add/Edit Data Sources"; include ('include/auth.php');
|
||||
header("Cache-control: no-cache");
|
||||
include_once ('include/form.php');
|
||||
|
||||
if ($form[action]) { $action = $form[action]; } else { $action = $args[action]; }
|
||||
if ($form[ID]) { $id = $form[ID]; } else { $id = $args[id]; }
|
||||
if ($form[GID]) { $gid = $form[GID]; } else { $gid = $args[id]; }
|
||||
|
||||
switch ($action) {
|
||||
case 'save':
|
||||
include_once ('include/functions.php');
|
||||
|
||||
$max_sequence = GetSequence($id, "sequence", "rrd_ds_cdef_item", "cdefid", $gid);
|
||||
|
||||
$sql_id = db_execute("replace into rrd_ds_cdef_item (id,dsid,cdefid,custom,currentds,
|
||||
cdeffunctionid,type,sequence) values ($id,$form[DSID],$gid,\"$form[Custom]\",\"$form[CurrentDS]\",
|
||||
$form[CDEFFunctionID],\"$form[Type]\",$max_sequence])");
|
||||
|
||||
header ("Location: cdef_items.php?id=$gid");
|
||||
break;
|
||||
case 'remove':
|
||||
db_execute("delete from rrd_ds_cdef_item where id=$id");
|
||||
|
||||
header ("Location: cdef_items.php?id=$gid");
|
||||
break;
|
||||
case 'movedown':
|
||||
include_once ('include/functions.php');
|
||||
|
||||
$next_item = GetNextItem("rrd_ds_cdef_item","sequence",$id,"cdefid",$gid);
|
||||
|
||||
$myid = db_fetch_cell("select id from rrd_ds_cdef_item where sequence=$next_item and cdefid=$gid");
|
||||
$myseq = db_fetch_cell("select sequence from rrd_ds_cdef_item where id=$id");
|
||||
db_execute("update rrd_ds_cdef_item set sequence=$next_item where id=$id");
|
||||
db_execute("update rrd_ds_cdef_item set sequence=$myseq where id=$myid");
|
||||
|
||||
header ("Location: cdef_items.php?id=$gid");
|
||||
break;
|
||||
case 'moveup':
|
||||
include_once ('include/functions.php');
|
||||
|
||||
$last_item = GetLastItem($cnn_id,"rrd_ds_cdef_item","sequence",$id,"cdefid",$gid);
|
||||
|
||||
$myid = db_fetch_cell("select id from rrd_ds_cdef_item where sequence=$last_item and cdefid=$gid");
|
||||
$myseq = db_fetch_cell("select sequence from rrd_ds_cdef_item where id=$id");
|
||||
db_execute("update rrd_ds_cdef_item set sequence=$last_item where id=$id");
|
||||
db_execute("update rrd_ds_cdef_item set sequence=$myseq where id=$myid");
|
||||
|
||||
header ("Location: cdef_items.php?id=$gid");
|
||||
break;
|
||||
case 'edit':
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
if ($id != "") {
|
||||
$tmp = db_fetch_assoc("select * from rrd_ds_cdef_item where id=$id");
|
||||
$ds = $tmp[0];
|
||||
unset($tmp);
|
||||
}
|
||||
|
||||
DrawFormHeader("rrdtool CDEF Configuration","",false);
|
||||
|
||||
DrawFormItem("Data Source","Add a data source to this CDEF.");
|
||||
DrawFormItemRadioButton("type",$ds[Type], "Data Source", "Add a Data Source.","Data Source");
|
||||
DrawFormItemDropdownFromSQL("DSID",db_fetch_assoc("select * from rrd_ds where isparent=0 order by name"),
|
||||
"Name","ID",$ds[DSID],"None","");
|
||||
DrawFormItemCheckBox("CurrentDS",$ds[CurrentDS],"Use the current data source being used on the
|
||||
graph instead of a preset one.","");
|
||||
|
||||
DrawFormItem("CDEF Function","Add a CDEF function to this CDEF.");
|
||||
DrawFormItemRadioButton("type", $sql_id, "CDEF Function", "Add a CDEF Function.","Data Source");
|
||||
DrawFormItemDropdownFromSQL("CDEFFunctionID",db_fetch_assoc("select * from def_cdef order by name"),
|
||||
"Name","ID",$ds[CDEFID],"","");
|
||||
|
||||
DrawFormItem("Custom Entry","Add a custom entry to this CDEF.");
|
||||
DrawFormItemRadioButton("Type", $ds[Type], "Custom Entry", "Add a Custom Entry.","Data Source");
|
||||
DrawFormItemTextBox("Custom",$ds[Custom],"","");
|
||||
|
||||
DrawFormSaveButton();
|
||||
DrawFormItemHiddenIDField("ID",$id);
|
||||
DrawFormItemHiddenIDField("GID",$gid);
|
||||
DrawFormFooter();
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
default:
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
DrawMatrixTableBegin("97%");
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderTop("Current Data Sources",$colors[dark_bar],"","4");
|
||||
DrawMatrixHeaderAdd($colors[dark_bar],"","cdef_items.php?action=edit&gid=$id");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderItem("Item",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Type",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Item Value",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Sequence",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
$sql = "select ds.name as DSName, cf.name as CFName, c.ID, c.Type, c.Custom
|
||||
from rrd_ds_cdef_item c left join def_cdef cf on cf.id=c.cdeffunctionid left
|
||||
join rrd_ds ds on ds.id=c.dsid where c.cdefid=$id order by c.sequence";
|
||||
$ds_list = db_fetch_assoc($sql);
|
||||
$numrows = sizeof($ds_list);
|
||||
|
||||
if ($numrows > 0) {
|
||||
foreach ($ds_list as $ds) {
|
||||
++$i;
|
||||
DrawMatrixRowAlternateColorBegin($colors[alternate],$colors[light],$i);
|
||||
DrawMatrixLoopItem("Item #$i",html_boolean($config["vis_main_column_bold"]["value"]),"cdef_items.php?action=edit&gid=$id&id=$ds[ID]");
|
||||
DrawMatrixLoopItem($ds[Type],false,"");
|
||||
|
||||
switch ($ds[Type]) {
|
||||
case 'Data Source':
|
||||
$matrix_title = $ds[DSName];
|
||||
break;
|
||||
case 'CDEF Function':
|
||||
$matrix_title = $ds[CFName];
|
||||
break;
|
||||
case 'Custom Entry':
|
||||
$matrix_title = $ds[Custom];
|
||||
break;
|
||||
}
|
||||
|
||||
DrawMatrixLoopItem($matrix_title,false,"");
|
||||
DrawMatrixLoopItem("[<a href=\"cdef_items.php?action=movedown&id=$ds[ID]&gid=$id\">Down</a>], [<a href=\"cdef_items.php?action=moveup&id=$ds[ID]&gid=$id\">Up</a>]",false,"");
|
||||
DrawMatrixLoopItemAction("Remove",$colors[panel],"",false,"cdef_items.php?action=remove&gid=$id&id=$ds[ID]");
|
||||
DrawMatrixRowEnd();
|
||||
}
|
||||
}
|
||||
DrawMatrixTableEnd();
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
} ?>
|
||||
@@ -0,0 +1,193 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? include ("include/database.php");
|
||||
include ('include/config.php');
|
||||
include_once ("include/rrd_functions.php");
|
||||
include_once ("include/functions.php");
|
||||
|
||||
$sql_id = mysql_query("select d.id, d.name, d.srcid,
|
||||
s.formatstrin, s.formatstrout, s.id as sid, s.type
|
||||
from rrd_ds d
|
||||
left join src s
|
||||
on d.srcid=s.id
|
||||
where d.active=\"on\"
|
||||
and d.subdsid=0",$cnn_id);
|
||||
$rows = mysql_num_rows($sql_id); $i = 0;
|
||||
|
||||
while ($i < $rows) {
|
||||
/* make the input string */
|
||||
$sql_id_field = mysql_query("select d.fieldid, d.dsid, d.value,
|
||||
f.srcid, f.dataname
|
||||
from src_data d
|
||||
left join src_fields f
|
||||
on d.fieldid=f.id
|
||||
where d.dsid=" . mysql_result($sql_id, $i, "id") . "
|
||||
and f.srcid=" . mysql_result($sql_id, $i, "srcid"),$cnn_id);
|
||||
$rows_field = mysql_num_rows($sql_id_field); $i_field = 0;
|
||||
|
||||
$str = mysql_result($sql_id, $i, "formatstrin");
|
||||
$str_out = mysql_result($sql_id, $i, "formatstrout");
|
||||
|
||||
/* find the delimeter in the output string */
|
||||
$delimeter = strpos($str_out,">");
|
||||
$delimeter = substr($str_out,$delimeter+1,1);
|
||||
|
||||
/* there are two ways to gather data within cacti. we either spawn a new
|
||||
process and get data from that or call an internal function and get data
|
||||
there. the second option is new (0.6.5) which allows things such as internal
|
||||
snmp support without the need to spawn any processes. */
|
||||
|
||||
if (mysql_result($sql_id, $i, "type") == "") {
|
||||
/* we ARE going to spawn a process */
|
||||
while ($i_field < $rows_field) {
|
||||
$str = ereg_replace("<" . mysql_result($sql_id_field, $i_field, "dataname") . ">", mysql_result($sql_id_field, $i_field, "value"),$str);
|
||||
|
||||
$i_field++;
|
||||
}
|
||||
|
||||
$str = ereg_replace("<path_cacti>", $path_cacti,$str);
|
||||
$str = ereg_replace("<path_snmpget>", $config["path_snmpget"]["value"],$str);
|
||||
$str = ereg_replace("<path_php_binary>", $config["path_php_binary"]["value"],$str);
|
||||
|
||||
/* take output string and parse it on the delimiter */
|
||||
$out_data_array = ParseDelimitedLine(`$str`,$delimeter);
|
||||
//print "\nDEBUG: CMD: " . `$str` . "\n";
|
||||
}else{
|
||||
/* we ARE NOT going to spawn a process */
|
||||
switch (mysql_result($sql_id, $i, "type")) {
|
||||
case 'snmp':
|
||||
include_once ("include/snmp_functions.php");
|
||||
|
||||
$out_data_array = ParseDelimitedLine(internal_snmp_query(mysql_result($sql_id, $i, "id"), mysql_result($sql_id, $i, "srcid"), "snmp"), $delimeter);
|
||||
break;
|
||||
case 'snmp_net':
|
||||
include_once ("include/snmp_functions.php");
|
||||
|
||||
$out_data_array = ParseDelimitedLine(internal_snmp_query(mysql_result($sql_id, $i, "id"), mysql_result($sql_id, $i, "srcid"), "snmp_net"), $delimeter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* find out if this DS has multiple outputs */
|
||||
$sql_id_multi = mysql_query("select id from rrd_ds where subdsid=" . mysql_result($sql_id, $i, "id"), $cnn_id);
|
||||
|
||||
if (mysql_num_rows($sql_id_multi) == 0) {
|
||||
$multi_data_source = false;
|
||||
}else{
|
||||
$multi_data_source = true;
|
||||
}
|
||||
|
||||
/* make the output string */
|
||||
$out_array = ParseDelimitedLine($str_out, $delimeter);
|
||||
|
||||
$o = 0;
|
||||
while ($o < count($out_array)) {
|
||||
if (mysql_result($sql_id, $i, "srcid") == 0) {
|
||||
LogData("ERROR: Data Source: '" . mysql_result($sql_id, $i, "name") . "' does not " .
|
||||
"have a data input source assigned to it. No data will be gathered; if cacti " .
|
||||
"does not gather data for this data source please deactivate it.");
|
||||
}else{
|
||||
/* remove all < and > characters from the output array */
|
||||
$out_array[$o] = ereg_replace("[<]|[>]", "" ,$out_array[$o]);
|
||||
|
||||
/* UPDATE: in previous versions, we would parse the output string to see what
|
||||
output vars are in use. This is sort of hacked, since it has the potential to
|
||||
break. Instead we are going to get the same data from the database, plus this
|
||||
saves us having to call ParseDelimitedLine() one extra time */
|
||||
if ($multi_data_source == true) {
|
||||
$sql_id_fields = mysql_query("select
|
||||
f.id,
|
||||
d.id as dsid
|
||||
from src_fields f left join rrd_ds d on f.id=d.subfieldid
|
||||
where f.dataname=\"$out_array[$o]\"
|
||||
and f.srcid=" . mysql_result($sql_id, $i, "srcid") . "
|
||||
and d.subdsid=" . mysql_result($sql_id, $i, "id") . "
|
||||
and f.inputoutput=\"out\"", $cnn_id);
|
||||
}else{
|
||||
$sql_id_fields = mysql_query("select
|
||||
id
|
||||
from src_fields
|
||||
where dataname=\"$out_array[$o]\"
|
||||
and srcid=" . mysql_result($sql_id, $i, "srcid") . "
|
||||
and inputoutput=\"out\"", $cnn_id);
|
||||
}
|
||||
|
||||
/* get the current data source id depending on whether this is a multi-ds
|
||||
or not */
|
||||
if ($multi_data_source == true) {
|
||||
$current_data_source_id = mysql_result($sql_id_fields, 0, "dsid");
|
||||
}else{
|
||||
$current_data_source_id = mysql_result($sql_id, $i, "id");
|
||||
}
|
||||
|
||||
//print "DEBUG: DS: $current_data_source_id, FIELD: $out_array[$o]=$out_data_array[$o]\n";
|
||||
|
||||
$sql_id_data = mysql_query("select id from src_data
|
||||
where fieldid=" . mysql_result($sql_id_fields, 0, "id") . "
|
||||
and dsid=$current_data_source_id",$cnn_id);
|
||||
|
||||
if (mysql_num_rows($sql_id_data) == 0) {
|
||||
$new_data_id = 0;
|
||||
}else{
|
||||
$new_data_id = mysql_result($sql_id_data, 0, "id");
|
||||
}
|
||||
|
||||
$sql_id_field_save = mysql_query("replace into src_data (id,fieldid,dsid,value)
|
||||
values($new_data_id," . mysql_result($sql_id_fields, 0, "id") . ",
|
||||
$current_data_source_id,\"$out_data_array[$o]\")",$cnn_id);
|
||||
}
|
||||
|
||||
$o++;
|
||||
}
|
||||
|
||||
/* call cacti's functions; no not print source */
|
||||
rrdtool_function_create(mysql_result($sql_id, $i, "id"), false);
|
||||
|
||||
/* only update data if we are gathering data for this data source */
|
||||
if (mysql_result($sql_id, $i, "srcid") != 0) {
|
||||
rrdtool_function_update(mysql_result($sql_id, $i, "id"), $multi_data_source, false);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
/* dump static images/html file if user wants it */
|
||||
if ($config["path_html_export"]["value"] != "") {
|
||||
if ($config["path_html_export_skip"]["value"] == "1") {
|
||||
include("export.php");
|
||||
}else{
|
||||
if ($config["path_html_export_skip"]["value"] == $config["path_html_export_ctr"]["value"]) {
|
||||
mysql_query("update settings set value=1 where name=\"path_html_export_ctr\"", $cnn_id);
|
||||
include("export.php");
|
||||
}else{
|
||||
if ($config["path_html_export_ctr"]["value"] == "") {
|
||||
mysql_query("update settings set value=1 where name=\"path_html_export_ctr\"", $cnn_id);
|
||||
}else{
|
||||
mysql_query("update settings set value=" . ($config["path_html_export_ctr"]["value"] + 1) . " where name=\"path_html_export_ctr\"", $cnn_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,96 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
$section = "Add/Edit Graphs";
|
||||
include ('include/auth.php');
|
||||
header("Cache-control: no-cache");
|
||||
include_once ('include/form.php');
|
||||
|
||||
if (isset($form[action])) { $action = $form[action]; } else { $action = $args[action]; }
|
||||
if (isset($form[ID])) { $id = $form[ID]; } else { $id = $args[id]; }
|
||||
|
||||
switch ($action) {
|
||||
case 'save':
|
||||
$sql_id = db_execute("replace into def_colors (id,hex) values ($id,\"$form[Hex]\")");
|
||||
|
||||
header ("Location: color.php");
|
||||
break;
|
||||
case 'remove':
|
||||
db_execute("delete from def_colors where id=$id");
|
||||
|
||||
header ("Location: color.php");
|
||||
break;
|
||||
case 'edit':
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
if ($id != "") {
|
||||
$color = db_fetch_row("select * from def_colors where id=$id");
|
||||
}
|
||||
|
||||
DrawFormHeader("rrdtool Colors Configuration","",false);
|
||||
|
||||
DrawFormItem("Hex Value","The hex value for this color; valid range: 000000-FFFFFF.");
|
||||
DrawFormItemTextBox("Hex",$color[Hex],"","");
|
||||
|
||||
DrawFormSaveButton();
|
||||
DrawFormItemHiddenIDField("ID",$id);
|
||||
DrawFormFooter();
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
default:
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
DrawMatrixTableBegin("97%");
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderTop("Defined rrdtool Colors",$colors[dark_bar],"","2");
|
||||
DrawMatrixHeaderAdd($colors[dark_bar],"","color.php?action=edit");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderItem("Hex Value",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Color",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
$color_list = db_fetch_assoc("select * from def_colors order by hex");
|
||||
$rows = sizeof($color_list);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $rows) {
|
||||
$color = $color_list[$i];
|
||||
DrawMatrixRowAlternateColorBegin($colors[alternate],$colors[light],$i);
|
||||
DrawMatrixLoopItem("$color[Hex]",html_boolean($config["vis_main_column_bold"]["value"]),"color.php?action=edit&id=$color[ID]");
|
||||
DrawMatrixCustom("<td bgcolor=\"#$color[Hex]\" width=\"1%\"> </td>");
|
||||
DrawMatrixLoopItemAction("Remove",$colors[panel],"",false,"color.php?action=remove&id=$color[ID]");
|
||||
DrawMatrixRowEnd();
|
||||
$i++;
|
||||
}
|
||||
|
||||
DrawMatrixTableEnd();
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
} ?>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
$section = "Data Input";
|
||||
include ('include/auth.php');
|
||||
include_once ('include/form.php');
|
||||
include_once ("include/functions.php");
|
||||
include_once ("include/top_header.php");
|
||||
|
||||
DrawMatrixTableBegin("97%");
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderTop("Processes to Start for Data Gathering",$colors[dark_bar],"","1");
|
||||
DrawMatrixHeaderTop("<div align=\"center\"><a href=\"cron.php?action=output\">Show Output</a></div>",$colors[dark_bar],"","1");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
$ds_list = db_fetch_assoc("select ID from rrd_ds where active=\"on\" and subdsid=0");
|
||||
if (sizeof($ds_list) > 0) {
|
||||
foreach ($ds_list as $ds) {
|
||||
$str = GetCronPath($ds[ID]);
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixLoopItem($str,false,"");
|
||||
|
||||
if ($action == "output") {
|
||||
$matrix_name = `$str`;
|
||||
} else {
|
||||
$matrix_name = "";
|
||||
}
|
||||
|
||||
DrawMatrixLoopItemAction($matrix_name,$colors[panel],$colors[panel_text],false,"");
|
||||
DrawMatrixRowEnd();
|
||||
}
|
||||
}
|
||||
|
||||
DrawMatrixTableEnd();
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,187 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
$section = "Data Input";
|
||||
include ('include/auth.php');
|
||||
header("Cache-control: no-cache");
|
||||
include_once ('include/form.php');
|
||||
|
||||
if (isset($form[action])) { $action = $form[action]; } else { $action = $args[action]; }
|
||||
if (isset($form[ID])) { $id = $form[ID]; } else { $id = $args[id]; }
|
||||
|
||||
switch ($action) {
|
||||
case 'save':
|
||||
$sql_id = db_execute("replace into src (id,name,formatstrin,formatstrout,type) values
|
||||
($id,\"$form[Name]\",\"$form[FormatStriIn]\",\"$form[FormatStrOut]\",\"$form[Type]\")");
|
||||
|
||||
/* if new save, then return to edit page so user can add data fields... */
|
||||
if ($id == 0) {
|
||||
header("Location: data.php?action=edit&id=" .db_fetch_cell("select LAST_INSERT_ID()"));
|
||||
exit;
|
||||
}else{
|
||||
header("Location: data.php"); exit;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'remove':
|
||||
if (($config["remove_verification"]["value"] == "on") && ($confirm != "yes")) {
|
||||
include_once ('include/top_header.php');
|
||||
DrawConfirmForm("Are You Sure?", "Are you sure you want to delete this data input source?", $current_script_name, "?action=remove&id=$id");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (($config["remove_verification"]["value"] == "") || ($confirm == "yes")) {
|
||||
$id_list = db_fetch_assoc("select d.ID from src s left join src_fields f on s.id=f.srcid left join src_data d on f.id=d.fieldid where s.id=$id");
|
||||
|
||||
if (sizeof($id_list) > 0) {
|
||||
foreach ($id_list as $myid) {
|
||||
db_execute("delete from src_data where id=$myid");
|
||||
}
|
||||
}
|
||||
|
||||
db_execute("delete from src_fields where srcid=$id");
|
||||
db_execute("delete from src where id=$id");
|
||||
}
|
||||
|
||||
header ("Location: data.php");
|
||||
break;
|
||||
case 'edit':
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
if ($id != "") {
|
||||
$src = db_fetch_row("select * from src where id=$id");
|
||||
}
|
||||
|
||||
DrawFormHeader("Data Input Source Configuration","",false);
|
||||
|
||||
DrawFormItem("Name","The name of this data source; only used by the front end.");
|
||||
DrawFormItemTextBox("Name",$src[Name],"","");
|
||||
|
||||
DrawFormItem("Input String","The data that in sent; which includes the filename and input sources in <> brackets.");
|
||||
DrawFormItemTextBox("FormatStrIn",$src[FormatStrIn],"","");
|
||||
|
||||
DrawFormItem("Output String","The data that is returned from the input program; defined as <> brackets.");
|
||||
DrawFormItemTextBox("FormatStrOut",$src[FormatStrOut],"","");
|
||||
|
||||
DrawFormSaveButton();
|
||||
DrawFormItemHiddenIDField("ID",$id);
|
||||
DrawFormItemHiddenTextBox("action","save","");
|
||||
DrawFormItemHiddenTextBox("Type",$src[Type],"");
|
||||
DrawMatrixCustom("</form>");
|
||||
|
||||
/* fields */
|
||||
if ($id != "") {
|
||||
DrawMatrixTableBegin("97%");
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderTop("Current Data Input Source Fields",$colors[dark_bar],"","4");
|
||||
DrawMatrixHeaderAdd($colors[dark_bar],"","data_fields.php?action=edit&fid=$id");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderItem("Name",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Data Name",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Input/Output",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Update RRA",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
$fields = db_fetch_assoc("select * from src_fields where srcid=$id order by name");
|
||||
if (sizeof($fields) > 0) {
|
||||
foreach ($fields as $field) {
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
switch ($field[InputOutput]) {
|
||||
case 'in':
|
||||
$inputoutput = "Input";
|
||||
break;
|
||||
case 'out':
|
||||
$inputoutput = "Output";
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($field[UpdateRRA]) {
|
||||
case '':
|
||||
$updaterra = "No";
|
||||
break;
|
||||
case 'on':
|
||||
$updaterra = "<font color=\"#FF0000\">Yes</font>";
|
||||
break;
|
||||
}
|
||||
|
||||
DrawMatrixLoopItem($field[Name],html_boolean($config["vis_main_column_bold"]["value"]),"data_fields.php?action=edit&id=$field[ID]&fid=$id");
|
||||
DrawMatrixLoopItem($field[DataName],false,"");
|
||||
DrawMatrixLoopItem($inputoutput,false,"");
|
||||
DrawMatrixLoopItem($updaterra,false,"");
|
||||
|
||||
DrawMatrixLoopItemAction("Remove",$colors[panel],"",false,"data_fields.php?action=remove&id=$field[ID]&fid=$id");
|
||||
DrawMatrixRowEnd();
|
||||
}
|
||||
}
|
||||
DrawMatrixTableEnd();
|
||||
}
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
default:
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
DrawMatrixTableBegin("97%");
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderTop("Current Data Input Sources",$colors[dark_bar],"","1");
|
||||
DrawMatrixHeaderAdd($colors[dark_bar],"","data.php?action=edit");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderItem("Name",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
$src_list = db_fetch_assoc("select * from src order by name");
|
||||
$rows = sizeof($src_list);
|
||||
$i = 0;
|
||||
if (sizeof($src_list) > 0) {
|
||||
foreach ($src_list as $src) {
|
||||
|
||||
DrawMatrixRowAlternateColorBegin($colors[alternate],$colors[light],$i);
|
||||
DrawMatrixLoopItem($src[Name],html_boolean($config["vis_main_column_bold"]["value"]),"data.php?action=edit&id=$src[ID]");
|
||||
|
||||
if ($src[Type] == "") {
|
||||
$matrix_remove = "data.php?action=remove&id=$src[ID]";
|
||||
} else {
|
||||
$matrix_remove = "";
|
||||
}
|
||||
|
||||
DrawMatrixLoopItemAction("Remove",$colors[panel],"",false,$matrix_remove);
|
||||
DrawMatrixRowEnd();
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
DrawMatrixTableEnd();
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,95 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
$section = "Data Input";
|
||||
include ('include/auth.php');
|
||||
header("Cache-control: no-cache");
|
||||
include_once ('include/form.php');
|
||||
|
||||
if (isset($form[action])) { $action = $form[action]; } else { $action = $args[action]; }
|
||||
if (isset($form[ID])) { $id = $form[ID]; } else { $id = $args[id]; }
|
||||
|
||||
switch ($action) {
|
||||
case 'remove':
|
||||
db_execute("delete from src_fields where id=$id");
|
||||
db_execute("delete from src_data where fieldid=$id");
|
||||
|
||||
header ("Location: data.php?action=edit&id=$fid");
|
||||
break;
|
||||
case 'save':
|
||||
$sql_id = db_execute("replace into src_fields (id,srcid,name,dataname,inputoutput,
|
||||
updaterra) values ($id,$form[FID],\"$form[Name]\",\"$form[DataName]\",\"$form[InputOutput]\",
|
||||
\"$form[UpdateRRA]\")");
|
||||
|
||||
if ($id == 0) {
|
||||
$id = db_fetch_cell("select LAST_INSERT_ID()");
|
||||
|
||||
/* let me explain, if the user adds a new field and this data input source is
|
||||
in use by any number of ds's, data collection will fail because of the missing
|
||||
data corresponding to the newly added field...this is not good, so lets fix it */
|
||||
$ds_list = db_fetch_assoc("select * from rrd_ds where srcid=$form[FID]");
|
||||
if (sizeof($ds_list) > 0) {
|
||||
foreach ($ds_list as $ds) {
|
||||
/* create a null entry in every ds for this field */
|
||||
db_execute("replace into src_data (id,fieldid,dsid,value) values (0,$id,$ds[ID],\"\")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header ("Location: data.php?action=edit&id=$fid");
|
||||
break;
|
||||
case 'edit':
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
if ($id != "") {
|
||||
$field = db_fetch_row("select * from src_fields where id=$id");
|
||||
}
|
||||
|
||||
DrawFormHeader("Data Input Source Configuration","",false);
|
||||
|
||||
DrawFormItem("Name","The name of this data source; only used by the front end.");
|
||||
DrawFormItemTextBox("Name",$field[Name],"","");
|
||||
|
||||
DrawFormItem("Data Name","The name of the data source field used by the frontend to identify each field.");
|
||||
DrawFormItemTextBox("DataName",$field[DataName],"","");
|
||||
|
||||
DrawFormItem("Input/Output Field","Whether this field is for output; or requires input to be sent to the program.");
|
||||
DrawFormItemDropDownCustomHeader("InputOutput");
|
||||
DrawFormItemDropDownCustomItem("InputOutput","in","Input",$field[InputOutput]);
|
||||
DrawFormItemDropDownCustomItem("InputOutput","out","Output",$field[InputOutput]);
|
||||
DrawFormItemDropDownCustomItem("InputOutput","hcin","HC Input",$field[InputOutput]);
|
||||
DrawFormItemDropDownCustomItem("InputOutput","hcout","HC Output",$field[InputOutput]);
|
||||
DrawFormItemDropDownCustomFooter();
|
||||
|
||||
DrawFormItem("Use for RRA","Whether this data source field should be used to update the RRA with; there can only be one of these fields per data input source and it must be an output field.");
|
||||
DrawFormItemCheckBox("UpdateRRA",$field[UpdateRRA],"Field Used to Update RRA","");
|
||||
|
||||
DrawFormSaveButton();
|
||||
DrawFormItemHiddenIDField("ID",$id);
|
||||
DrawFormItemHiddenIDField("FID",$fid);
|
||||
DrawFormFooter();
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
break;
|
||||
} ?>
|
||||
@@ -0,0 +1,119 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? $section = "Add/Edit Data Sources"; include ('include/auth.php');
|
||||
header("Cache-control: no-cache");
|
||||
# include ('include/database.php');
|
||||
# include ('include/config.php');
|
||||
include_once ('include/form.php');
|
||||
|
||||
switch ($action) {
|
||||
case 'remove':
|
||||
if (($config["remove_verification"]["value"] == "on") && ($confirm != "yes")) {
|
||||
include_once ('include/top_header.php');
|
||||
DrawConfirmForm("Are You Sure?", "Are you sure you want to delete this SNMP host?", $current_script_name, "?action=remove&id=$id");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (($config["remove_verification"]["value"] == "") || ($confirm == "yes")) {
|
||||
db_execute("delete from snmp_hosts where id=$id");
|
||||
db_execute("delete from snmp_hosts_interfaces where hostid=$id");
|
||||
}
|
||||
|
||||
header ("Location: snmp.php");
|
||||
break;
|
||||
case 'save':
|
||||
include_once ("include/snmp_functions.php");
|
||||
|
||||
$sql_id = db_execute("replace into snmp_hosts (id,hostname,community) values
|
||||
($id,\"$hostname\",\"$community\")");
|
||||
|
||||
$hostid = db_fetch_cell"select LAST_INSERT_ID()");
|
||||
|
||||
get_snmp_interfaces($hostname,$community,$hostid);
|
||||
|
||||
header ("Location: snmp.php");
|
||||
break;
|
||||
case 'refresh':
|
||||
include_once ("include/snmp_functions.php");
|
||||
|
||||
$host = db_fetch_row("select * from snmp_hosts where id=$id");
|
||||
get_snmp_interfaces($host[Hostname],$host[Community],$id);
|
||||
|
||||
header ("Location: snmp.php");
|
||||
break;
|
||||
case 'edit':
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
DrawFormHeader("SNMP Host Configuration","",false);
|
||||
|
||||
DrawFormItem("Hostname","The hostname of the system you want to gather SNMP data from.");
|
||||
DrawFormItemTextBox("hostname",$sql_id,"","");
|
||||
|
||||
DrawFormItem("Community","The community to use when gathering data (default is public).");
|
||||
DrawFormItemTextBox("community",$sql_id,"","");
|
||||
|
||||
DrawFormSaveButton();
|
||||
DrawFormItemHiddenIDField("id",$id);
|
||||
DrawFormFooter();
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
default:
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
DrawMatrixTableBegin("97%");
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderTop("Current SNMP Hosts",$colors[dark_bar],"","4");
|
||||
DrawMatrixHeaderAdd($colors[dark_bar],"","snmp.php?action=edit");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderItem("Hostname",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Community",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Interfaces",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Refresh SNMP Data",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
$hosts = db_fetch_assoc("select * from snmp_hosts order by hostname");
|
||||
$rows = sizeof($hosts);
|
||||
$i = 0;
|
||||
while ($i < $rows) {
|
||||
$host = $hosts[$i];
|
||||
DrawMatrixRowAlternateColorBegin($colors[alternate],$colors[light],$i);
|
||||
DrawMatrixLoopItem($host[Hostname],false,"");
|
||||
DrawMatrixLoopItem($host[Community],false,"");
|
||||
DrawMatrixLoopItem("View Gathered Interfaces",false,"snmp_interfaces.php?id=$host[ID]");
|
||||
DrawMatrixLoopItem("Refresh Interface","","",false,"snmp.php?action=refresh&id=$host[ID]");
|
||||
DrawMatrixLoopItemAction("Remove",$colors[panel],"",false,"snmp.php?action=remove&id=$host[ID]");
|
||||
DrawMatrixRowEnd();
|
||||
$i++;
|
||||
}
|
||||
|
||||
DrawMatrixTableEnd();
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
} ?>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? $section = "Console Access";
|
||||
include ('include/auth.php');
|
||||
include_once ('include/form.php');
|
||||
include_once ("include/top_header.php");
|
||||
|
||||
DrawMatrixTableBegin("97%");
|
||||
$drag_inits[] = array("handle","mytarget","true");
|
||||
?>
|
||||
<div ID=handle style="position:static"><img src='images/menu_header_graph_setup.gif' border='0' alt='Graph Setup'></DIV>
|
||||
<BR><BR><BR>
|
||||
<div ID=mytarget style="position:static"><img src='images/menu_item_cdef.gif' border='0' alt='Graph Setup'></DIV>
|
||||
<?
|
||||
|
||||
DrawMatrixTableEnd();
|
||||
|
||||
include_once ("include/bottom_footer.php"); ?>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
$section = "View Graphs";
|
||||
$guest_account = true;
|
||||
include ('include/auth.php');
|
||||
include_once ("include/rrd_functions.php");
|
||||
include_once ("include/functions.php");
|
||||
include ("include/top_graph_header.php");
|
||||
include_once("include/tree_functions.php");
|
||||
|
||||
GrowTree($args[tree_start]);
|
||||
include_once ("include/bottom_footer.php");
|
||||
@@ -0,0 +1,318 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
$section = "View Graphs";
|
||||
#$guest_account = true;
|
||||
include ('include/auth.php');
|
||||
include_once ("include/rrd_functions.php");
|
||||
include_once ("include/functions.php");
|
||||
include ("include/top_graph_header.php");
|
||||
|
||||
$user_id = GetCurrentUserID($HTTP_COOKIE_VARS["cactilogin"], $config["guest_user"]["value"]);
|
||||
|
||||
if (isset($hide) == true) {
|
||||
/* find out if the current user has rights here */
|
||||
$gs = db_fetch_cell("select GraphSettings from auth_users where id=$user_id");
|
||||
|
||||
/* only update expand/contract info is this user has writes to keep their own settings */
|
||||
if ($gs > 0) {
|
||||
if ($gs == "on") {
|
||||
db_execute("delete from settings_tree where treeitemid=$branch_id and userid=$user_id");
|
||||
db_execute("insert into settings_tree (treeitemid,userid,status) values ($branch_id,$user_id,$hide)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if auth is enabled, get some basic info about this user so we know what they have
|
||||
rights to */
|
||||
if ($config["global_auth"]["value"] == "on") {
|
||||
$user = db_fetch_row("select GraphPolicy,ShowTree,ShowList,ShowPreview from auth_users where id=$user_id");
|
||||
|
||||
if (sizeof($user) <= 0) {
|
||||
print "<strong><font size='+1' color='FF0000'>CANNOT FIND USER!</font></strong>"; exit;
|
||||
} else {
|
||||
$show_tree_view = $user[ShowTree];
|
||||
$show_list_view = $user[ShowList];
|
||||
$show_preview_view = $user[ShowPreview];
|
||||
}
|
||||
}else{
|
||||
/* if auth is turned off; obviously they have rights */
|
||||
$show_tree_view = "on";
|
||||
$show_list_view = "on";
|
||||
$show_preview_view = "on";
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'tree':
|
||||
if ($show_tree_view != "on") {
|
||||
print "<strong><font size='+1' color='FF0000'>YOU DO NOT HAVE RIGHTS FOR TREE VIEW</font></strong>"; exit;
|
||||
}
|
||||
|
||||
include_once ('include/form.php');
|
||||
include_once ('include/tree_functions.php');
|
||||
|
||||
DrawMatrixTableBegin("97%");
|
||||
|
||||
$array_tree["options"]["sql_type_column"] = "type";
|
||||
|
||||
if (!(isset($tree_id))) { $tree_id = 0; }
|
||||
|
||||
/* if cacti's builtin authentication is turned on then make sure to take
|
||||
graph permissions into account here. if a user does not have rights to a
|
||||
particular graph; do not show it. they will get an access denied message
|
||||
if they try and view the graph directly. */
|
||||
if ($config["global_auth"]["value"] == "on") {
|
||||
/* take tree permissions into account here, if the user does not have permission
|
||||
give an "access denied" message */
|
||||
$id = db_fetch_cell("select UserID from auth_graph_hierarchy where hierarchyid=$tree_id and userid=" . GetCurrentUserID($HTTP_COOKIE_VARS["cactilogin"],$config["guest_user"]["value"]));
|
||||
|
||||
if ($config["graph_policy"]["auth"] == "1") {
|
||||
if ($id > 0) { $access_denied = true; }
|
||||
} elseif ($config["graph_policy"]["auth"] == "2") {
|
||||
if ($id == 0) { $access_denied = true; }
|
||||
}
|
||||
|
||||
if ($access_denied == true) {
|
||||
print "<strong><font size='+1' color='FF0000'>ACCESS DENIED</font></strong>"; exit;
|
||||
}
|
||||
|
||||
/* user is allowed to view this graph hierarchy; so lets move and create
|
||||
the SQL string that will show only the graphs that the user has rights to view
|
||||
in this tree */
|
||||
if ($config["graph_policy"]["auth"] == "1") {
|
||||
$sql_where = "where ag.userid is null";
|
||||
}elseif ($config["graph_policy"]["auth"] == "2") {
|
||||
$sql_where = "where (ag.userid is not null or h.type=\\\"Heading\\\")";
|
||||
}
|
||||
|
||||
$array_tree["options"]["sql_string"] = "select
|
||||
h.ID,h.GraphID,h.RRAID,h.Type,h.Title,h.Parent,
|
||||
g.title as GTitle,
|
||||
st.Status,
|
||||
ag.GraphID as AGGraphID, ag.userid as AGUserID
|
||||
from graph_hierarchy_items h
|
||||
left join rrd_graph g on h.graphid=g.id
|
||||
left join settings_tree st on (h.id=st.treeitemid and st.userid=$user_id)
|
||||
left join auth_graph ag on (g.id=ag.graphid and ag.userid=$user_id)
|
||||
$sql_where
|
||||
and h.parent=$branch
|
||||
and h.treeid=$tree_id
|
||||
order by h.sequence";
|
||||
} else {
|
||||
$array_tree["options"]["sql_string"] = "select
|
||||
h.ID,h.GraphID,h.RRAID,h.Type,h.Title,h.Parent,
|
||||
g.title as GTitle,
|
||||
r.name as RName,
|
||||
st.Status
|
||||
from graph_hierarchy_items h
|
||||
left join rrd_graph g on h.graphid=g.id
|
||||
left join rrd_rra r on h.rraid=r.id
|
||||
left join settings_tree st on (h.id=st.treeitemid and st.userid=$user_id)
|
||||
where h.parent=$branch
|
||||
and h.treeid=$tree_id
|
||||
order by h.sequence";
|
||||
}
|
||||
|
||||
/* this SQL string is used in case a user clicks on a branch in the tree; this way
|
||||
cacti will show the actual branch they clicked on in addition to its children */
|
||||
if ($start_branch != "") {
|
||||
$array_tree["options"]["sql_header_string"] = "select
|
||||
h.ID,h.GraphID,h.RRAID,h.Type,h.Title,h.Parent,
|
||||
g.title as GTitle,
|
||||
r.name as RName,
|
||||
st.Status
|
||||
from graph_hierarchy_items h
|
||||
left join rrd_graph g on h.graphid=g.id
|
||||
left join rrd_rra r on h.rraid=r.id
|
||||
left join settings_tree st on (h.id=st.treeitemid and st.userid=$user_id)
|
||||
where h.id=$branch
|
||||
and h.treeid=$tree_id
|
||||
order by h.sequence";
|
||||
}
|
||||
|
||||
$array_tree["options"]["indent"] = "- ";
|
||||
$array_tree["options"]["start_branch"] = $start_branch;
|
||||
$array_tree["options"]["alternating_row_colors"] = false;
|
||||
$array_tree["options"]["tree_id"] = $tree_id;
|
||||
$array_tree["options"]["remove_action"] = '';
|
||||
$array_tree["options"]["create_margin"] = true;
|
||||
$array_tree["options"]["use_expand_contract"] = true;
|
||||
|
||||
$array_tree["options"]["show_item"] = "<a href='graph_view.php?action=tree&tree_id=$tree_id&start_branch=$start_branch&hide=0&branch_id=$branch'><img src='images/show.gif' border='0'></a>";
|
||||
$array_tree["options"]["hide_item"] = "<a href='graph_view.php?action=tree&tree_id=$tree_id&start_branch=$start_branch&hide=1&branch_id=$branch'><img src='images/hide.gif' border='0'></a>";
|
||||
|
||||
$array_tree["item_can_have_children"]["Heading"] = true;
|
||||
$array_tree["item_td_code"]["Heading"] = "bgcolor='#$colors[panel]' colspan='" . $array_settings["preview"]["columnnumber"] . "'";
|
||||
# $array_tree["item_action"]["Heading"] = "<strong><a href='graph_view.php?action=tree&tree_id=$tree_id&start_branch=$branch'>" . mysql_result($sql_id, $i, "title") . "</a></strong>";
|
||||
|
||||
$array_tree["item_can_have_children"]["Graph"] = false;
|
||||
|
||||
switch ($array_settings["hierarchical"]["viewtype"]) {
|
||||
case "1":
|
||||
# $array_tree["item_action"]["Graph"] = "<a href='graph.php?graphid=" . mysql_result($sql_id, $i, "graphid") .
|
||||
# "&rraid=all'><img align='middle' src='graph_image.php?graphid=" . mysql_result($sql_id, $i, "graphid") .
|
||||
# "&rraid=" . mysql_result($sql_id, $i, "rraid") . "&graph_start=-" .
|
||||
# $array_settings["preview"]["timespan"] . "&graph_height=" .
|
||||
# $array_settings["preview"]["height"] . "&graph_width=" . $array_settings["preview"]["width"] .
|
||||
# "&graph_nolegend='true' border='0' alt='" . mysql_result($sql_id, $i, "gtitle") . "'></a>";
|
||||
$array_tree["item_columns"]["Graph"] = $array_settings["preview"]["columnnumber"];
|
||||
|
||||
break;
|
||||
case "2":
|
||||
$array_tree["item_action"]["Graph"] = "<a href='graph.php?graphid=" . mysql_result($sql_id, $i, "graphid") .
|
||||
"&rraid=all'>" . mysql_result($sql_id, $i, "gtitle") . "</a>";
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixCustom("<td colspan='2'>");
|
||||
DrawMatrixCustom("<strong><a href='graph_view.php?action=tree&tree_id=$tree_id'>[root]</a> - $tree_name</strong><br><br>");
|
||||
DrawMatrixCustom("</td>");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
print "<UL>\n";
|
||||
foreach (array_keys($array_tree) as $key) {
|
||||
if (is_array($array_tree[$key])) {
|
||||
print "<UL>\n";
|
||||
foreach (array_keys($array_tree[$key]) as $key2) {
|
||||
print "<LI>[$key][$key2] = '".$array_tree[$key][$key2]."'<BR>\n";
|
||||
}
|
||||
print "</UL>\n";
|
||||
} else {
|
||||
print "<LI>[$key] = '$array_tree[$key]'<BR>\n";
|
||||
}
|
||||
}
|
||||
print "</UL>\n";
|
||||
|
||||
GrowTree($array_tree);
|
||||
|
||||
print '</td></tr>';
|
||||
DrawMatrixTableEnd();
|
||||
|
||||
break;
|
||||
case 'preview':
|
||||
if ($show_preview_view != "on") {
|
||||
print "<strong><font size='+1' color='FF0000'>YOU DO NOT HAVE RIGHTS FOR PREVIEW VIEW</font></strong>"; exit;
|
||||
}
|
||||
|
||||
/* graph permissions */
|
||||
if ($config["global_auth"]["value"] == "on") {
|
||||
if ($config["graph_policy"]["auth"] == "1") {
|
||||
$sql_where = "where ag.userid is null";
|
||||
}elseif ($config["graph_policy"]["auth"] == "2") {
|
||||
$sql_where = "where ag.userid is not null";
|
||||
}
|
||||
|
||||
$graphs = db_fetch_assoc("select
|
||||
g.ID,g.Title
|
||||
from rrd_graph g
|
||||
left join auth_graph ag on (g.id=ag.graphid and ag.userid=$user_id)
|
||||
$sql_where
|
||||
order by g.title");
|
||||
}else{
|
||||
$graphs = db_fetch_assoc("select
|
||||
ID,Title
|
||||
from rrd_graph
|
||||
order by title");
|
||||
}
|
||||
|
||||
|
||||
print "<tr><td bgcolor='$colors[light]' width='1%' rowspan='99999'></td>\n";
|
||||
if (sizeof($graphs) > 0) {
|
||||
foreach ($graphs as $graph) {
|
||||
print "<td width='25%'><a href='graph.php?rraid=all&graphid=$graph[ID]'><img src='graph_image.php?graphid=$graph[ID]&rraid=".$array_settings["preview"]["rraid"];?>&graph_start=-<?print $array_settings["preview"]["timespan"];?>&graph_height=<?print $array_settings["preview"]["height"]."&graph_width=".$array_settings["preview"]["width"]."&graph_nolegend=true' border='0' alt='$graph[Title]'></a></td>";
|
||||
$k++;
|
||||
if ($k == $array_settings["preview"]["columnnumber"]) {
|
||||
$k = 0;
|
||||
print "</tr><tr height='10'><td> </td></tr><tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
break;
|
||||
case 'list':
|
||||
if ($show_list_view != "on") {
|
||||
print "<strong><font size='+1' color='FF0000'>YOU DO NOT HAVE RIGHTS FOR LIST VIEW</font></strong>"; exit;
|
||||
}
|
||||
|
||||
include_once ("include/form.php");
|
||||
|
||||
/* graph permissions */
|
||||
if ($config["global_auth"]["value"] == "on") {
|
||||
if ($config["graph_policy"]["auth"] == "1") {
|
||||
$sql_where = "where ag.userid is null";
|
||||
} elseif ($config["graph_policy"]["auth"] == "2") {
|
||||
$sql_where = "where ag.userid is not null";
|
||||
}
|
||||
|
||||
$graphs = db_fetch_assoc("select
|
||||
g.ID,g.Title
|
||||
from rrd_graph g
|
||||
left join auth_graph ag on (g.id=ag.graphid and ag.userid=$user_id)
|
||||
$sql_where
|
||||
order by g.title");
|
||||
} else {
|
||||
$graphs = db_fetch_assoc("select
|
||||
ID,Title
|
||||
from rrd_graph
|
||||
order by title");
|
||||
}
|
||||
|
||||
|
||||
$rra_list = db_fetch_assoc("select id,name from rrd_rra order by id");
|
||||
|
||||
print "<table width='97%'>";
|
||||
print "<tr>";
|
||||
if (sizeof($graphs) > 0) {
|
||||
foreach ($graphs as $graph) {
|
||||
switch ($array_settings["list"]["listviewtype"]) {
|
||||
case "1":
|
||||
print "<td width='25%'><strong>$graph[Title] [<a href='graph.php?graphid=$graph[ID]&rraid=all'>all</a>]</strong><br>\n";
|
||||
if (sizeof($rra_list) > 0) {
|
||||
foreach ($rra_list as $rra) {
|
||||
print "<a href='graph.php?graphid=$graph[ID]&rraid=$rra[ID]'><?print $rra[Name];?></a><br>\n";
|
||||
}
|
||||
}
|
||||
print "</td>\n";
|
||||
$k++;
|
||||
|
||||
if ($k==4) {
|
||||
$k = 0;
|
||||
print "</tr><tr height='10'><td> </td></tr><tr>\n";
|
||||
}
|
||||
|
||||
break;
|
||||
case "2" :
|
||||
print "<td><strong><a href='graph.php?graphid=$graph[ID]&rraid=all'>$graph[Title]</a></strong></td></tr><tr>\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
print "</tr></table>\n";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
include_once ("include/bottom_footer.php");
|
||||
@@ -0,0 +1,148 @@
|
||||
raXnet - cacti
|
||||
|
||||
0.6.7
|
||||
-feature: Added a "none" option for a data source when creating a CDEF.
|
||||
This can be used if you check the "Use the current data source being
|
||||
used on the graph instead of a preset one" box.
|
||||
-feature: Each user has a default graph policy: ALLOW or DENY for their
|
||||
graph permissions.
|
||||
-bug: Unique .rrd filename/data source name issues for SNMP "Make Graph"
|
||||
have been fixed.
|
||||
-feature: Changing the data source for a graph group parent will change
|
||||
the data sources for each of the child items.
|
||||
-bug: Logging has been fixed so errors do not show up in the Apache
|
||||
error_log any more.
|
||||
-bug: VRULE's work correctly now. Enter a time in the "value" field to use
|
||||
them, such as "00:00" or "14:00".
|
||||
-feature: If you select a graph to be added to the graph hierarchy, the
|
||||
"This Item is a Graph" checkbox is automatically selected.
|
||||
-docs: Install docs have been updated for Unix/Win32, documentation on
|
||||
upgrading cacti has been added. See the 'docs/' directory for more
|
||||
information.
|
||||
-bug: SNMP can function on win32/unix without snmpwalk/snmpget binaries.
|
||||
This will only work if you have php-snmp support compiled into both your
|
||||
php binary and web server modules. This is already the case for win32.
|
||||
-bug: A bug when more than one data source was created using the same
|
||||
data input source with multiple outputs has been fixed.
|
||||
-feature: The default install/upgrade screen has been revised.
|
||||
|
||||
0.6.6
|
||||
-feature: Multiple data sources per .rrd is supported. To use this
|
||||
feature, simply create a data input source with multiple outputs that
|
||||
'Update RRA'.
|
||||
-feature: Graph item grouping, which enables you to delete/reorder
|
||||
groups of similair graph items.
|
||||
-feature: Graph preview and output preview in the console, which allows
|
||||
you to preview what a graph will look like/what rrdtool's output is.
|
||||
-feature: Graph-based permissions have added, you can also show/hide
|
||||
certain hierarchies per user.
|
||||
-feature: Multiple data source per .rrd file support, read the docs
|
||||
for more information.
|
||||
-feature: You can now export graphs to static png's/html's every n
|
||||
times.
|
||||
-feature: By default, SNMP data source names come from <IP>_<IFNUM>,
|
||||
instead of just <IFDESC> which is more unique.
|
||||
-feature: More options for users such as where to go when the user logs
|
||||
in and whether the user can have their own settings or not.
|
||||
|
||||
0.6.5
|
||||
-bug: Fixed some of the data source naming issues. You can now
|
||||
use any data source name you want; cacti will take care of making
|
||||
the name "rrdtool friendly".
|
||||
-feature: Cacti will use PHP's builtin SNMP support if detected,
|
||||
SNMP is overall faster now too. NOTE: PHP's SNMP support may not
|
||||
work with all of your MIB names, you may have to use the OID
|
||||
instead!
|
||||
-feature: Basic high speed counter support has been added, use
|
||||
'hcin'/'hcout' to use it. Also may not work with PHP's builtin SNMP
|
||||
support yet.
|
||||
-bug: Using the MAX consolidation function with graph data works
|
||||
better now. You can make graphs that look like the MRTG ones (5
|
||||
minute maximum). This code still needs a little work though.
|
||||
|
||||
0.6.4
|
||||
-bug: You can now add the same CDEF to multiple data sources in the
|
||||
same graph.
|
||||
-feature: Ability to "sync" changes with the .rrd file with rrdtool's
|
||||
TUNE function. Cacti also tries to fill in internal data source path
|
||||
and name information to keep graphs from "breaking" when possible.
|
||||
-settings: You can now change the PHP Binary path from within cacti.
|
||||
-feature: Cacti can now export static images/html files when it gathers
|
||||
data like MRTG did.
|
||||
-feature: Multiple graph hierarchies are supported.
|
||||
-feature: You can now "zoom in" on any portion of the graph hierarchy
|
||||
by clicking on a header item.
|
||||
-bug: Some changes were made to make cacti more win32 complaint; a tutorial
|
||||
on how to setup cacti on win32 can be found on the raXnet page.
|
||||
-feature: You can now create all graphs for an SNMP host with one click.
|
||||
-feature: You can customize the graph title when creating graphs using
|
||||
the 'Make Graph' or 'Make All Graphs' link.
|
||||
-feature: Data sources in cacti are no longer limited to 19 characters.
|
||||
If you create a data source name that rrdtool will not like, cacti will
|
||||
automatically modify the name and save it internally for rrdtool-only use.
|
||||
|
||||
0.6.3
|
||||
-feature: Put limits (HTML 'maxlength') on fields that have a
|
||||
maximum length.
|
||||
-feature: Added 'cacti Settings' and 'User Administration' to the
|
||||
cacti menu.
|
||||
-feature: Added a 'Step' field for Data Sources to graph data at
|
||||
non-300 second intervals.
|
||||
-feature: Added a '--rigid' on/off option, plus the ability to choose
|
||||
between '--alt-autoscale' and '--alt-autoscale-max' when using
|
||||
auto scale.
|
||||
-feature: Added a 'Base Value' field to the graphs to adjust how the
|
||||
vertical axis is displayed.
|
||||
-feature: Updated the menu/header graphics for a smoother look and
|
||||
easier navigation.
|
||||
-feature: cacti now stores its settings in the database instead of
|
||||
config.php, so they can be manipulated under 'cacti Settings'.
|
||||
Database credentials are still located in config.php however.
|
||||
-feature: Added a preview of the rrdtool source when creating data
|
||||
sources.
|
||||
-feature: Added a "data source duplicate" function and moved "graph
|
||||
duplicate" to "Graphs" on the cacti menu.
|
||||
-settings: You can now turn on/off cacti's builtin authentication.
|
||||
-settings: You can control what is logged (create, graph, snmp, update).
|
||||
-feature: Added a "Total All Data Sources" CDEF, which can be used
|
||||
to represent the total of all of the data on a graph.
|
||||
-bug: Fixed a few add/edit/delete form-related bugs.
|
||||
-docs: Added some more content to the documentation and made it more
|
||||
visible from within cacti.
|
||||
|
||||
0.6.2
|
||||
-bug: Fixed some bugs when creating CDEF's using multiple
|
||||
data sources.
|
||||
-bug: Fixed more SNMP parsing bugs with some versions
|
||||
of net-snmp.
|
||||
-feature: added an "auto-refresh" feature to the graphs (thanks Nossie).
|
||||
-bug: HRULE's and VRULE's acually work now.
|
||||
-docs: the beginnings of some real documentation.
|
||||
-bug: you can select the color black now.
|
||||
|
||||
0.6.1
|
||||
-bug: Fixed a parsing bug with snmp, more parsing is done
|
||||
in cacti's code and not via arguments passed to
|
||||
snmpget.
|
||||
-auth: Updated the function used to hash passwords
|
||||
(more compatible with older MySQL versions), more
|
||||
strict on document caching.
|
||||
-feature: Easier installation: cacti now checks for common
|
||||
problems and gives suggestions. Database updates are
|
||||
also done at this time.
|
||||
-bug: Fixed a problem with adding new data input sources.
|
||||
-bug: Problem saving the wrong numbers for 'Round Robin
|
||||
Archives'.
|
||||
-feature: Ability to preview the output of the cron script
|
||||
from a web browser under 'Cron Printout'.
|
||||
-feature: Added 'Logout User' to the menu.
|
||||
-bug: Removed some occurances of /var/www/html and replaced
|
||||
them with more dynamic variables.
|
||||
|
||||
0.6
|
||||
-new tree code
|
||||
-some html table issues in graph view mode
|
||||
-fixed the settings code for saved graph-view data
|
||||
|
||||
0.5
|
||||
-initial release
|
||||
@@ -0,0 +1,20 @@
|
||||
Documentation of user-contributed code:
|
||||
|
||||
[include/rrd_functions.php]
|
||||
- 2/8/2002 - Dave Neitz, Sprint E|Solutionns
|
||||
Added 3 new CDEF special types:
|
||||
|
||||
Type Description
|
||||
---- -----------
|
||||
3 Total staggered datasources.
|
||||
4 Average all datasources.
|
||||
5 Average staggered datasources.
|
||||
|
||||
Staggered datasources are determined by parsing graph item value
|
||||
column in the following manner:
|
||||
|
||||
start=<starting position in datasource>&skip=<skip count>
|
||||
|
||||
[graphs_items.php]
|
||||
- 2/8/2002 - Dave Neitz, Sprint E|Solutionns
|
||||
Added additional screen help text to support value expanded usage.
|
||||
@@ -0,0 +1,229 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>cacti Installation Instruction for Windowss</title>
|
||||
<style>
|
||||
<!--
|
||||
BODY
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
P.code
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Courier New, Courier;
|
||||
font-weight: bold;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
color: #000066;
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
|
||||
TT.shell
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Courier New, Courier;
|
||||
font-weight: normal;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
P.php
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Courier New, Courier;
|
||||
font-weight: normal;
|
||||
color: #000000;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
|
||||
TT.php-var
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Courier New, Courier;
|
||||
font-weight: normal;
|
||||
color: #008080;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h2>Cacti Installation (Windows)</h2><p>
|
||||
|
||||
<h3>Dependencies</h3><p>
|
||||
|
||||
Cacti requires:
|
||||
<ul>
|
||||
<li>rrdtool:<br>
|
||||
<tt><a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/">http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/</a> <b><a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/rrdtool-1.0.35.x86distr.zip">rrdtool-1.0.35.x86distr.zip</a></b></tt><p></li>
|
||||
|
||||
<li><a href="http://www.php.net/">PHP 4</a> or newer (with SNMP support):<br>
|
||||
<tt><a href="http://www.php.net/downloads.php">http://www.php.net/downloads.php</a> <b><a href="http://www.php.net/do_download.php?download_file=php-4.1.2-Win32.zip">php-4.1.2-Win32.zip</a></b></tt><p></li>
|
||||
|
||||
<li><p><a href="http://www.mysql.com/">MySQL 3.23</a> or newer.</p></li>
|
||||
|
||||
<li><a href="http://www.apache.org/">Apache</a> 1.3.20/IIS 5.x or higher</li>
|
||||
</ul><p>
|
||||
|
||||
<h3>Install PHP (With Apache)</h3><p>
|
||||
|
||||
<ol>
|
||||
<li>Install the Apache web server. (I installed it in <strong>C:\Apache</strong>)<p>
|
||||
|
||||
<li>Extract PHP somewhere and rename the folder to "PHP". (I installed it in <strong>C:\PHP</strong>)<p>
|
||||
|
||||
<li>Move the <strong>php4ts.dll</strong> file to your system directory (winnt/system32).<p>
|
||||
|
||||
<li>Rename the <em>php.ini-dist</em> file to <em>php.ini</em>, copy it to your <em>winnt/</em> directory
|
||||
and make the following changes to the file:<p>
|
||||
|
||||
<p class="php">extension_dir = c:/php/extensions<br>
|
||||
extension=php_snmp.dll<br>
|
||||
include_path=c:/apache/htdocs/cacti<br>
|
||||
register_globals = On<br>
|
||||
register_argc_argv = On<p>
|
||||
|
||||
Make sure to replace <em>c:/apache/htdocs/cacti</em> with your <strong>full</strong> path to cacti.<p>
|
||||
|
||||
<li>Add the following lines to Apache's <strong>httpd.conf</strong> file:<p>
|
||||
|
||||
<p class="php">LoadModule php4_module c:/php/sapi/php4apache.dll<br>
|
||||
AddModule mod_php4.c<br>
|
||||
AddType application/x-httpd-php .php<br>
|
||||
DirectoryIndex index.html index.htm index.php<p>
|
||||
|
||||
Make sure to replace <em>c:/php/sapi/php4apache.dll</em> with your <strong>full</strong> path to the php4apache.dll file.<p>
|
||||
</ol>
|
||||
|
||||
<h3>Install PHP (With IIS)</h3><p>
|
||||
|
||||
<ol>
|
||||
<li>Extract PHP somewhere and rename the folder to "PHP". (I installed it in <strong>C:\PHP</strong>)<p>
|
||||
|
||||
<li>Rename the <em>php.ini-dist</em> file to <em>php.ini</em>, copy it to your <em>winnt/</em> directory
|
||||
and make the following changes to the file:<p>
|
||||
|
||||
<p class="php">extension_dir = c:/php/extensions<br>
|
||||
extension=php_snmp.dll<br>
|
||||
include_path=c:/inetpub/wwwroot/cacti<br>
|
||||
register_globals = On<br>
|
||||
register_argc_argv = On<p>
|
||||
|
||||
Make sure to replace <em>c:/inetpub/wwwroot/cacti</em> with your <strong>full</strong> path to cacti.<p>
|
||||
|
||||
<li>Start the Microsoft Management Console, right click on <em>Default Web Server</em> (in most cases) and
|
||||
select <strong>Properties</strong>.<p>
|
||||
|
||||
<li>Under the <em>Home Directory</em> tab, select <em>Configuration</em> and click <em>Add</em>.
|
||||
Browse to the path of <em>php4isapi.dll</em>, and type in .php as the extension.<p>
|
||||
|
||||
<li>Under the <em>ISAPI Filters</em> tab, click add and browse to the <em>php4isapi.dll</em> file. Name the
|
||||
filter "php" and click OK.<p>
|
||||
|
||||
<li>Under the <em>Documents</em> tab, add <strong>index.php</strong> to the list.<p>
|
||||
|
||||
<li>Completely stop and start the IIS service using the following commands:<p>
|
||||
|
||||
<p class="php">net stop iisadmin<br>
|
||||
net start w3svc<p>
|
||||
|
||||
</ol>
|
||||
|
||||
<h3>Installation Instructions</h3><p>
|
||||
|
||||
<ol>
|
||||
<li>Extract the distribution archive. You can use a program like <a href="http://www.winzip.com/">WinZip</a> to
|
||||
open .tar.gz files. These instructions will assume that the archive has been
|
||||
extracted to <em>C:\Apache\htdocs\cacti</em>, although you can use a different path if you wish.
|
||||
Make sure you extract with "Use folder names" enabled, so that the necessary sub-folders
|
||||
will be used.<p>
|
||||
|
||||
<li>Unzip rrdtool and copy <strong>rrdtool.exe</strong> from the <em>src/tool_release</em> directory to somewhere such as
|
||||
C:\rrdtool<p>
|
||||
|
||||
<li>Install MySQL (I installed it in <strong>C:\mysql</strong>) and start the MySQL service.<p>
|
||||
|
||||
<li>Create the MySQL database:<p>
|
||||
|
||||
<p class="code"><tt class="shell">C:\></tt> <b>cd Apache\htdocs\cacti</b><br>
|
||||
<tt class="shell">C:\Apache\htdocs\cacti></tt> <b>mysqladmin create cacti</b></p><br>
|
||||
|
||||
<b>Note</b> These examples assume that the MySQL executables directory (commonly C:\mysql\Bin) is in your %PATH%.<p>
|
||||
|
||||
<li>Import the default cacti database:<p>
|
||||
|
||||
<p class="code"><tt class="shell">C:\Apache\htdocs\cacti></tt> <b>mysql cacti < cacti.sql</b></p><br>
|
||||
|
||||
<li><b>Optional:</b> Create a MySQL username and password for cacti.<p>
|
||||
|
||||
<p class="code"><tt class="shell">C:\Apache\htdocs\cacti></tt> <b>mysql --user=root mysql</b><br>
|
||||
<tt class="shell">mysql></tt> <b>GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY '<i>somepassword</i>';</b><br>
|
||||
<tt class="shell">mysql></tt> <b>flush privileges;</b></p><br>
|
||||
|
||||
<li>Edit <b>include/config.php</b>.<p>
|
||||
|
||||
<ul>
|
||||
<li><p>Specify the MySQL user, password and database for your cacti configuration.</p></li>
|
||||
|
||||
<p class="php"><b>$database_default</b> = <tt class="php-var">"cacti"</tt>;<br>
|
||||
<b>$database_hostname</b> = <tt class="php-var">"localhost"</tt>;<br>
|
||||
<b>$database_username</b> = <tt class="php-var">"cactiuser"</tt>;<br>
|
||||
<b>$database_password</b> = <tt class="php-var">"cacti"</tt>;<br>
|
||||
</p><br>
|
||||
|
||||
<li><p>Change the operating system variable to "win32":</p></li>
|
||||
|
||||
<p class="php"><b>$cacti_server_os</b> = <tt class="php-var">"win32"</tt>;<br></p><br>
|
||||
|
||||
</ul>
|
||||
|
||||
<li>If you are using NTFS security, make sure the <em>I_USR_</em> user has write access to both the
|
||||
<strong>log/</strong> and <strong>rra/</strong> sub-directories.<p>
|
||||
|
||||
<li>You are going to need to schedule a task, so <em>cmd.php</em> can run every 5 minutes. Make sure the
|
||||
<em>Task Scheduler</em> service is started and open up the <strong>Scheduled Tasks</strong> control panel item.
|
||||
Add a new task, browse to your <em>php.exe</em> file and click <em>Next</em>. Have the task run daily (for now) and
|
||||
click <em>Next</em> twice until you are at the username/password screen. You must enter a user that has
|
||||
read/write permissions to cacti rra/ and log/ directories here. Click <em>Next</em>, check the box to open
|
||||
Advanced Properties and click <em>Finish</em>.<p>
|
||||
|
||||
You are going to have to enter the full command line in the <em>Run</em> textbox. Using default paths,
|
||||
your command line should look something like:<p>
|
||||
|
||||
<p class="php">c:\php\php.exe c:\apache\htdocs\cacti\cmd.php</p>
|
||||
|
||||
<p>Select the <em>Schedule</em> tab and click <em>Advanced</em>. Check the <em>Repeat task</em> checkbox
|
||||
and change it to every 5 minutes, then change the <em>Duration</em> to 24 hours. That should
|
||||
schedule <em>cmd.php</em> to run every 5 minutes.</p>
|
||||
|
||||
<li>Point your web browser to:<p>
|
||||
|
||||
<blockquote>http://your-server/cacti/</blockquote>
|
||||
|
||||
<p>Log in the with a username/password of <strong>admin</strong>. You will be required to
|
||||
change this password immediatly. Using the default paths described in this document, your
|
||||
paths should look something like:</p>
|
||||
|
||||
<p><strong>PHP Binary Path:</strong></p>
|
||||
|
||||
<p class="php">c:/php/php.exe</p>
|
||||
|
||||
<p><strong>rrdtool Binary Path:</strong></p>
|
||||
|
||||
<p class="php">c:/rrdtool/rrdtool.exe</p>
|
||||
|
||||
<p><strong>cacti Web Root:</strong></p>
|
||||
|
||||
<p class="php">/cacti</p>
|
||||
|
||||
<p><strong>Apache Web Root:</strong></p>
|
||||
|
||||
<p class="php">c:/apache/htdocs</p>
|
||||
</ol>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,139 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>cacti Installation Instructions</title>
|
||||
<style>
|
||||
<!--
|
||||
BODY
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
P.code
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Courier New, Courier;
|
||||
font-weight: bold;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
color: #000066;
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
|
||||
TT.shell
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Courier New, Courier;
|
||||
font-weight: normal;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
P.php
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Courier New, Courier;
|
||||
font-weight: normal;
|
||||
color: #000000;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
|
||||
TT.php-var
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Courier New, Courier;
|
||||
font-weight: normal;
|
||||
color: #008080;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h2>Cacti Installation</h2><p>
|
||||
|
||||
<h3>Dependencies</h3><p>
|
||||
|
||||
Cacti requires:
|
||||
<ul>
|
||||
<li>rrdtool:<br>
|
||||
<tt><a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/">http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/</a> <b><a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/rrdtool-1.0.35.tar.gz">rrdtool-1.0.35.tar.gz</a></b></tt><p>
|
||||
<li>net-snmp (for SNMP support):<br>
|
||||
<tt><a href="http://sourceforge.net/project/showfiles.php?group_id=12694">http://sourceforge.net/project/showfiles.php?group_id=12694</a> <b><a href="http://prdownloads.sourceforge.net/net-snmp/ucd-snmp-4.2.3.tar.gz">ucd-snmp-4.2.3.tar.gz</a></b></tt><p>
|
||||
|
||||
<li><a href="http://www.php.net/">PHP 4</a> or newer.
|
||||
<li><a href="http://www.mysql.com/">MySQL 3.23</a> or newer.
|
||||
</ul><p>
|
||||
|
||||
<h3>Installation Instructions</h3><p>
|
||||
|
||||
<ol>
|
||||
<li>Extract the distribution tarball.<p>
|
||||
|
||||
<p class="code"><tt class="shell">shell></tt> <b>tar xzvf cacti-<i>version</i>.tar.gz</b></p><br>
|
||||
|
||||
<li>Create the MySQL database:<p>
|
||||
|
||||
<p class="code"><tt class="shell">shell></tt> <b>mysqladmin create cacti</b></p><br>
|
||||
|
||||
<li>Import the default cacti database:<p>
|
||||
|
||||
<p class="code"><tt class="shell">shell></tt> <b>mysql cacti < cacti.sql</b></p><br>
|
||||
|
||||
<li><b>Optional:</b> Create a MySQL username and password for cacti.<p>
|
||||
|
||||
<p class="code"><tt class="shell">shell></tt> <b>mysql --user=root mysql</b><br>
|
||||
<tt class="shell">mysql></tt> <b>GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY '<i>somepassword</i>';</b><br>
|
||||
<tt class="shell">mysql></tt> <b>flush privileges;</b></p><br></p><br>
|
||||
|
||||
<li>Edit <b>include/config.php</b>.<p>
|
||||
|
||||
<ul>
|
||||
<li><p>Specify the MySQL user, password and database for your cacti configuration.</p></li>
|
||||
|
||||
<p class="php"><b>$database_default</b> = <tt class="php-var">"cacti"</tt>;<br>
|
||||
<b>$database_hostname</b> = <tt class="php-var">"localhost"</tt>;<br>
|
||||
<b>$database_username</b> = <tt class="php-var">"cactiuser"</tt>;<br>
|
||||
<b>$database_password</b> = <tt class="php-var">"cacti"</tt>;<br>
|
||||
</p><br>
|
||||
</ul>
|
||||
|
||||
<li>Edit <b>php.ini</b>.<p>
|
||||
|
||||
<ul>
|
||||
<li><p>Make sure you have the following options set in your php.ini file:</p></li>
|
||||
|
||||
<p class="php">
|
||||
register_globals = On<br>
|
||||
register_argc_argv = On</p><br>
|
||||
</ul>
|
||||
|
||||
<li>Set the appropriate permissions on cacti's directories for graph/log generation. You should execute these commands from inside cacti's directory to change the permissions.<p>
|
||||
|
||||
<p class="code"><tt class="shell">shell></tt> <b>chown <em>cactiuser</em> rra/ log/</b></p><br>
|
||||
|
||||
<p>(Enter a valid username for <em>cactiuser</em>, this user will also be used in the next step for
|
||||
data gathering.)</p>
|
||||
|
||||
<li>Add a line to your <strong>/etc/crontab</strong> file similar to:<p>
|
||||
|
||||
<p class="php">*/5 * * * * <em>cactiuser</em> php <em>/var/www/html/cacti/</em>cmd.php > /dev/null 2>&1</p><br>
|
||||
|
||||
<p><ul>
|
||||
<li>Replace <em>cactiuser</em> with the valid user specified in the previous step.</li>
|
||||
<li>Replace <em>/var/www/html/cacti/</em> with your <strong>full</strong> cacti path.</li>
|
||||
</ul></p>
|
||||
|
||||
<li>Point your web browser to:<p>
|
||||
|
||||
<blockquote>http://your-server/cacti/</blockquote>
|
||||
|
||||
<p>Log in the with a username/password of <strong>admin</strong>. You will be required to
|
||||
change this password immediatly. Make sure to fill in all of the path variables carefully
|
||||
and correctly on the following screen.</p>
|
||||
</ol>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,680 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>cacti Documentation</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link href="main.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
||||
|
||||
<table height="1%" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td colspan="3" bgcolor="#454E53">
|
||||
<map name="tabs">
|
||||
<area alt="Console" coords="7,5,87,35" href="../index.php">
|
||||
<area alt="Graphs" coords="166,5,241,32" href="../graph_view.php?action=tree" shape="RECT">
|
||||
<area alt="Documentation" coords="88,5,165,32" href="MANUAL.htm">
|
||||
</map>
|
||||
|
||||
<img src="images/top_tabs_main.gif" border="0" usemap="#tabs"><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" bgcolor="#E5E5E5">
|
||||
<img src="images/transparent_line.gif" width="170" height="5" border="0"><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="27" colspan="3" bgcolor="#E5E5E5" background="images/top_banner.gif">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" bgcolor="#E5E5E5">
|
||||
<img src="images/transparent_line.gif" width="170" height="5" border="0"><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr height="5" bgcolor="#454E53"><td colspan="3"><img src="images/transparent_line.gif" width="20" height="5" border="0"></td></tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<table align="center" width="98%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<font class="header">cacti Documentation Outline</font>
|
||||
|
||||
<ul>
|
||||
<li>1. <a href="MANUAL.htm#1">Installation</a></li>
|
||||
<li>2. <a href="MANUAL.htm#2">Permissions/User Management</a></li>
|
||||
<ul>
|
||||
<li>2.1. <a href="MANUAL.htm#2.1">Default Users</a></li>
|
||||
<li>2.2. <a href="MANUAL.htm#2.2">How to Access User Management</a></li>
|
||||
<li>2.3. <a href="MANUAL.htm#2.3">Adding a New User</a></li>
|
||||
<li>2.4. <a href="MANUAL.htm#2.4">Graph Permissions</a> <strong>(NEW)</strong></li>
|
||||
</ul>
|
||||
<li>3. <a href="MANUAL.htm#3">Creating a Graph</a></li>
|
||||
<ul>
|
||||
<li>3.1. <a href="MANUAL.htm#3.1">Overview</a></li>
|
||||
<li>3.2. <a href="MANUAL.htm#3.2">Data Input Sources</a></li>
|
||||
<ul>
|
||||
<li>3.2.1. <a href="MANUAL.htm#3.2.1">Data Input Overview</a></li>
|
||||
<li>3.2.2. <a href="MANUAL.htm#3.2.2">Pre-Installed Data Input Sources</a></li>
|
||||
<li>3.2.3. <a href="MANUAL.htm#3.2.3">How to Add/Remove Data Input Sources</a></li>
|
||||
</ul>
|
||||
<li>3.3. <a href="MANUAL.htm#3.3">Data Sources</a></li>
|
||||
<ul>
|
||||
<li>3.3.1. <a href="MANUAL.htm#3.3.1">Data Source Overview</a></li>
|
||||
<li>3.3.2. <a href="MANUAL.htm#3.3.2">How to Add/Remove Data Sources</a></li>
|
||||
<li>3.3.3. <a href="MANUAL.htm#3.3.3">Round Robin Archives</a></li>
|
||||
</ul>
|
||||
<li>3.4. <a href="MANUAL.htm#3.4">CDEF's</a></li>
|
||||
<ul>
|
||||
<li>3.4.1. <a href="MANUAL.htm#3.4.1">CDEF's in cacti/Overview</a></li>
|
||||
<li>3.4.2. <a href="MANUAL.htm#3.4.2">How to Create a CDEF in cacti</a></li>
|
||||
</ul>
|
||||
<li>3.5. <a href="MANUAL.htm#3.5">Graphs</a></li>
|
||||
<ul>
|
||||
<li>3.5.1. <a href="MANUAL.htm#3.5.1">How to Add/Remove Graphs</a></li>
|
||||
<li>3.5.2. <a href="MANUAL.htm#3.5.2">How to Add/Remove Graph Items</a></li>
|
||||
</ul>
|
||||
</ul>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<table align="center" width="98%" cellspacing="0" cellpadding="2" border="1">
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">1. Installation</font><a name="1"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p><b>1)</b> Extract the cacti tarball, like 'tar -xvzf cacti-0.3.tar.gz',
|
||||
and cd to the new directory.</p>
|
||||
|
||||
<p><b>2)</b> Create a database for cacti using syntax like:
|
||||
mysqladmin -u root -p create cacti</p>
|
||||
|
||||
<p><b>3)</b> Then import the cacti database:
|
||||
mysql -u root -p cacti < SQL</p>
|
||||
|
||||
<p><b>4)</b> Edit config.php in 'include/', make sure to give a valid SQL
|
||||
user name, password, and database.</p>
|
||||
|
||||
<p>NOTE: Be sure the MySQL user you give cacti has at least:</p>
|
||||
|
||||
<p>SELECT<br>
|
||||
INSERT<br>
|
||||
UPDATE<br>
|
||||
DELETE<br>
|
||||
CREATE<br>
|
||||
ALTER<br></p>
|
||||
|
||||
<p>Privileges to cacti's database!</p>
|
||||
|
||||
<p><b>5)</b> For cacti to run correctly, you must have the following settings
|
||||
set accordingly in your php.ini file:</p>
|
||||
|
||||
<p><em>register_globals = On<br>
|
||||
register_argc_argv = On</em></p>
|
||||
|
||||
<p><b>6)</b> Become root, and add a line to your /etc/crontab similar to:<br>
|
||||
*/5 * * * * apache php PATH_TO_CMD.PHP/cmd.php > /dev/null 2>&1</p>
|
||||
|
||||
<p>Make sure to fill in the correct path to cacti on your system.</p>
|
||||
|
||||
<p>IMPORTANT!<br>
|
||||
Also, make sure you replace 'apache' with your web server user,
|
||||
this user MUST have write access to the following directories in order
|
||||
to log data and create the rrdtool RRA files.</p>
|
||||
|
||||
<p>log/*<br>
|
||||
rra/*</p>
|
||||
|
||||
<p>If files do not start appearing in the 'rra/' directory after 5 minutes of
|
||||
adding your crontab entry, check your permissions.</p>
|
||||
|
||||
<p><b>7)</b> Point your browser to http://servername/cacti/, or where ever else
|
||||
you put it.</p>
|
||||
|
||||
<p><b>8)</b> For each new install/upgrade, cacti will check the variables in config.php
|
||||
to make sure everything is valid. If everything looks ok, then cacti will
|
||||
update the database if it finds a previous version and give you any last
|
||||
minute information.</p>
|
||||
|
||||
<p><b>9)</b> Go to http://servername/cacti/ again to use cacti.
|
||||
For new installs, you must login in with the account name of admin with
|
||||
a password of admin you will be forced to change this password once
|
||||
you successfully login for the first time.</p>
|
||||
|
||||
<p><b>10)</b> Sample graphs have already been created, yet data will not begin to
|
||||
be gathered until the entry in crontab has been successfully setup.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">2. Permissions/User Management</font><a name="2"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">2.1. Default Users</font><a name="2.1"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>By default cacti comes with the following users:</p>
|
||||
|
||||
<p><b>admin</b> - This user has privileges to everything in cacti, comes with the password 'admin' by
|
||||
default.<br>
|
||||
<b>guest</b> - The user that is used to view graphs with. You do not need a password to view graphs
|
||||
by default, so it is advised not to give this user extra permissions.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">2.2. How to Access User Management</font><a name="2.3"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>Login to cacti with 'admin' or another eqivilant user and select "User Administration" on
|
||||
the cacti menu.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">2.3. Adding a New User</font><a name="2.3"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>To add a new user, click the 'Add' link on the main user administration page.</p>
|
||||
|
||||
<p><b>Full Name</b> - A description of this user.</p>
|
||||
|
||||
<p><b>User Name</b> (Required) - The user name assigned to this user, no spaces please.</p>
|
||||
|
||||
<p><b>Password</b> (Required) - Enter this user's password twice.</p>
|
||||
|
||||
<p><b>User Must Change Password at Next Login</b> - Check this box to force this user to change their
|
||||
password upon their next successful login.</p>
|
||||
|
||||
<p><b>Allow this User to Keep Custom Graph Settings</b> - If you check this box this user will
|
||||
be allowed to set custom graph-view settings such as graph columns, height, width and page
|
||||
refresh times. This will also determine if a user can expand/contract branches in a
|
||||
graph hierarchy. <strong>NOTE:</strong> Even if you deny a user from changing their graph
|
||||
settings, the existing settings will still be used. This will allow administrators to
|
||||
create "default" settings for each user.</p>
|
||||
|
||||
<p><strong>User Has Rights to View ...</strong> - This allows you to specify what graph sections
|
||||
this user is allowed to view.</p>
|
||||
|
||||
<p><strong>Login Settings</strong> - Control what page is displayed immediatly after this user
|
||||
logs in.</p>
|
||||
|
||||
<p>Once the user is created, it will not be able to login until you assign it at least
|
||||
the 'Console Access' privilege under 'Allowed Sections'.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">2.4. Graph Permissions</font><a name="2.4"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>To change the graph permissions for any user, select "Graph Permissions" next to the username
|
||||
under the "User Administration" section of cacti.</p>
|
||||
|
||||
<p>In the first section, check each graph you want to DENY this user from. This is the most
|
||||
secure way to deny users from viewing graphs, since there is no obvious way a sneaky user
|
||||
could bookmark an unauthorized graph to view it. Graphs which users do not have permission to
|
||||
view will be hidden from the user in all areas of cacti.</p>
|
||||
|
||||
<p>In the second section, check each graph hierarchy you want to HIDE from this user. Please
|
||||
note that this method only hides the graph hierarchy from view and does not explicitly deny it
|
||||
like the above options.</p>
|
||||
|
||||
<p>For further user control, refer to the "User Has Rights to View ..." section of
|
||||
<a href="MANUAL.htm#2.3">Adding a New User</a>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3. Creating a Graph</font><a name="3"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.1. Overview</font><a name="3.1"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>Creating a simple, rrdtool based graph is a very easy with cacti. Even using more advanced features
|
||||
such as CDEF's are much easier than implementing them manually.</p>
|
||||
|
||||
<p>The basic "flow" of things in cacti is as follows:</p>
|
||||
|
||||
<p>Data Input Sources are required for Data Sources to gather data. They pretty much tell where a Data
|
||||
Source to get data from. A Data Source is some piece of data you are gathering whether is be processes
|
||||
on a server, traffic on a switch, or whatever. You can then place Data Sources on graphs to show the
|
||||
data that has been gathered.</p>
|
||||
</td>
|
||||
<tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.2. Data Input Sources</font><a name="3.2"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.2.1. Data Input Overview</font><a name="3.2.1"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>A data input source is simply an external program that is called to gather data for cacti.</p>
|
||||
|
||||
<p>Every five minutes, each data input is called for each data source it is used in. Input for the
|
||||
external programs can be gathered on a per-data source basis and can be fully customized. Output
|
||||
parameters are also defined telling cacti what to expect back from the external program. One
|
||||
of these parameters must be used to for updating the .rrd file, but more can be specified and
|
||||
stored in the database for use on the graph.</p>
|
||||
</td>
|
||||
<tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.2.2. Pre-Installed Data Input Sources</font><a name="3.2.2"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>The following data sources come with cacti and can be used to gather data for your graphs.</p>
|
||||
|
||||
<p><b>Get Custom TCP Connections</b> - Give a <i></i>string to "grep" for in netstat output and outputs the number
|
||||
of resulting lines.<br>
|
||||
<b>Get Load Average</b> - Specify either (5,15, or 30) to return a load average for that interval (yes I know
|
||||
it's 1, 5, and 10, probably only works right on Linux).<br>
|
||||
<b>Get Logged In Users</b> - Pass a <i></i>username to get the number of instances of that user logged in, or NULL to
|
||||
return the total number of users logged in.<br>
|
||||
<b>Get Memory Usage</b> - Give it<i></i> a "grep" string to use on the output of /proc/meminfo to return memory
|
||||
statistics on a Linux machine.<br>
|
||||
<b>Get Number of Open Samba Files</b> - Returns<i></i> the number of open Samba files.<br>
|
||||
<b>Get SNMP Data</b> - Give it<i></i> a host, SNMP community and OID and it returns the value for that SNMP
|
||||
OID.<br>
|
||||
<b>Get SNMP Network Data</b> - (Used f<i></i>or builtin SNMP support) Give it a host, SNMP community, "in" or
|
||||
"out", and one or more of the following: interface MAC Address, IP Address, Number, or Description.
|
||||
This script will then return the SNMP counter value representing this interface's traffic.<br>
|
||||
<b>Get SQL Connections</b> - Returns<i></i> the number of "questions" asked of a MySQL server. You may have to edit
|
||||
the username and password in the script (sql.pl).<br>
|
||||
<b>Get Web Hits</b> - Returns<i></i> the number of lines in any file specified (you would normally specify the path
|
||||
to an Apache log file).<br>
|
||||
<b>Ping Host</b> - Return <i></i>the number of milliseconds it takes to respond given a hostname and the number of times
|
||||
to ping the host.<br>
|
||||
</p>
|
||||
</td>
|
||||
<tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.2.3. How to Add/Remove Data Input Sources</font><a name="3.2.3"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>1. Click "Data Source" on the cacti menu and click "Add" to create a new data input source.</p>
|
||||
|
||||
<p><b>Name</b> - Make up some meaningful name for this data input source to identify what it is used for.</p>
|
||||
|
||||
<p><b>Input String</b> - You must specify the path to the external program you are calling, along with any
|
||||
parameters (optional) that the user must enter. A typical input string looks similar to the following:</p>
|
||||
|
||||
<p><i>/path/to/script.pl <arg1> <arg2></i></p>
|
||||
|
||||
<p>With the following setup, every time the user created a data source using this data input source
|
||||
they would have to enter a value for "arg1" and "arg2". For demonstration sake, let's say this was a ping
|
||||
script that took an <i>IP address</i> and <i>number of times to ping</i> as arguments, cacti would then execute a
|
||||
command similar to:</p>
|
||||
|
||||
<p><i>/path/to/script.pl 192.168.1.1 2</i></p>
|
||||
|
||||
<p><b>Output String</b> - Cacti needs to know what to expect back from the script and is setup the
|
||||
same way as the input string. Let's say our ping script above returns <i>milliseconds</i> and <i>"up" or "down"</i>.
|
||||
The output string would probably looks something like:</p>
|
||||
|
||||
<i><ms> <updown></i>
|
||||
|
||||
<p>That of course assumes that the external program delimits the output arguments with spaces, make to sure
|
||||
format your output string appropriately. Also note that unlike the input string, <b>every data input source
|
||||
must have at least one output argument!</b></p>
|
||||
|
||||
<p>2. Click save once you have finished filling in all of the fields. You will now see "Current Data Input Source
|
||||
Fields" lower down on the page. You must create an entry here for <b>EVERY</b> input and output argument used
|
||||
above.</p>
|
||||
|
||||
<p>3. Click "Add" to begin defining your fields.</p>
|
||||
|
||||
<p><b>Name</b> - The friendly name cacti will use to refer to this field, you may type anything meaningful here.</p>
|
||||
|
||||
<p><b>Data Name</b> - Enter the name of this field matching it <b>EXACTLY</b> to its use in the input/output string. Please
|
||||
do not include the "<" and ">" signs here. This field also cannot contain spaces or other non-alphanumeric
|
||||
characters. Good entries here would be like ("ms", "output_str", "arg1", or "string").</p>
|
||||
|
||||
<p><b>Input/Output Field</b> - You <b>MUST</b> select whether this argument is used in the input or output string.</p>
|
||||
|
||||
<p><b>Use for RRA</b> - If you want data sources using this data input source to keep track of the data
|
||||
gathered then you <b>MUST</b> check this box for at one of your output arguments. Since rrdtool can only store numbers,
|
||||
only check this box for an output argument that returns a number. <strong><font color="#FF0000">UPDATE</font></strong>: You
|
||||
may check this box for each output argument you want to write to the .rrd file. If you check
|
||||
this box more than once, cacti will automatically create an additional data sources for each
|
||||
output item when creating a new data source using this data input source.</p>
|
||||
|
||||
<p>4. Your data input source will now be available for use in any data source.</p>
|
||||
</td>
|
||||
<tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.3. Data Sources</font><a name="3.3"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.3.1. Data Source Overview</font><a name="3.3.1"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>A data source is basically some piece of data that is being gathered. This data can come from cacti's
|
||||
builtin data input sources or can come from an external .rrd file. Both methods allow you to graph data the
|
||||
same way. Whether you want to graph incoming traffic on a switch port or the 1 minute load average on your
|
||||
mail server, you will need to create a data source for it.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.3.2. How to Add/Remove Data Sources</font><a name="3.3.2"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>1. Click "Data Sources" on the cacti menu and click "Add" to create a new data source. Keep in mind
|
||||
that if cacti is not gathering data for this data source, only the first 3 fields are required!</p>
|
||||
|
||||
<p><b>Name</b> - The name used by rrdtool and cacti to identify this data source. You cannot use names
|
||||
longer than 19 characters or use non-alphanumeric characters (except "_"). Bad names in this field are
|
||||
one of the most common reasons a graph does not render or a data source does not get created.</p>
|
||||
|
||||
<p><b>(Optional) Internal Data Source Name</b> - <b>Used only if cacti is not gathering data for this
|
||||
data source!</b> Enter the data source name used in your .rrd file here. Remember that MRTG uses the
|
||||
data source names of "ds0" and "ds1" for incoming out outgoing traffic.</p>
|
||||
|
||||
<p><b>(Optional) Data Source Path</b> - <b>Used only if cacti is not gathering data for this
|
||||
data source!</b> Enter the full unix path to the .rrd file containing the data for this data source.</p>
|
||||
|
||||
<p><b>Data Source Type</b> - Describes what kind of data this data source will handle. Basically use "GAUGE" for
|
||||
numbers that do not increment (processes, temperature, etc) and "COUNTER" for values that increment (traffic, etc).
|
||||
More information can be found <a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/manual/rrdcreate.html">here</a>.</p>
|
||||
|
||||
<p><b>Data Input Type</b> - If cacti is gathering data for this data source, please select the data input source
|
||||
to use from the list. You will be able to enter the input arguments for the data input source after saving
|
||||
the data source.</p>
|
||||
|
||||
<p><b>Associated RRA's</b> - What RRA's to use when gathering data. Unless you know to do otherwise, <b>select
|
||||
ALL of the values from this list</b>.</p>
|
||||
|
||||
<p><b>Heartbeat</b> - As defined by rrdtool: The maximum amount of time that can pass before data is entered as
|
||||
"unknown". This field is usually "600" or 2 data gathering intervals.</p>
|
||||
|
||||
<p><b>Minimum Value</b> - The lowest possible number that rrdtool will allow for this data source, usually
|
||||
"0" for most purposes.</p>
|
||||
|
||||
<p><b>Maximum Value</b> - The highest possible number that rrdtool will allow for this data source. Remember to
|
||||
be generous with this value as numbers higher than the maximum will be stored as "Unknown". When graphing traffic,
|
||||
this number is usually the maximum throughput (in bytes) of an interface.</p>
|
||||
|
||||
<p><strong>Update Changes in .rrd File</strong> - If this box is checked, cacti will attempt
|
||||
to execute an rrdtool 'tune' function when you save this data source. This allows you to
|
||||
save updated min/max values, heartbeat, data source type and name settings to the .rrd file. </p>
|
||||
|
||||
<p><b>Active</b> - Only check this box if cacti is to be gathering data for this data source. Also can be useful
|
||||
to temporarily stop cacti from gathering data for this data source.</p>
|
||||
|
||||
<p>2. Click save to return to the main data source screen.</p>
|
||||
|
||||
<p><strong><font color="#FF0000">UPDATE:</font></strong> If you create a data source that has
|
||||
more than one output to be saved to the .rrd file, cacti will automatically create the
|
||||
additional data sources necessary. These "sub-data sources" will inherit the basic settings
|
||||
(data source type, heartbeat, and min/max values) from the data source you just created. It
|
||||
is usually a good idea to make sure these settings are accurate before going any further.</p>
|
||||
|
||||
<p>3. If cacti is gathering data for this data source, click "Edit Data" next to the data source you just
|
||||
created. You will be able to enter data for any input arguments defined in the Input String (see <a href="MANUAL.htm#3.2.3">Data
|
||||
Input Sources</a>). You are <b>required to enter data for all available fields</b> or cacti will not gather data
|
||||
correctly!</p>
|
||||
|
||||
<p>4. Your data source will now be available for use in any graph.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.3.3. Round Robin Archives</font><a name="3.3.3"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>Round Robin Archives (RRA's) usually do not need to be modified, but can be useful for graphing over
|
||||
non-standard time periods like two days or full resolution over a year. The fields for Round Robin
|
||||
Archives in cacti are pulled almost exactly from rrdtool. Beware that you can mess up data gathering
|
||||
and the look of your graphs by messing with these settings. Read more about how to use Round Robin
|
||||
Archives <a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/manual/rrdcreate.html">here</a>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.4. CDEF's</font><a name="3.4"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.4.1. CDEF's in cacti/Overview</font><a name="3.4.1"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>CDEF's serve the same function as with traditional rrdtool-based graphs. If you don't understand CDEF's
|
||||
please see the official <a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/manual/rrdgraph.html">
|
||||
documentation</a> or <a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/tutorial/cdeftutorial.html">
|
||||
tutorial</a>.</p>
|
||||
|
||||
<p>CDEF's are useful when you want to "alter" the data you have gathered for display on a graph. This is done
|
||||
builtin math functions in RPN (Reverse Polish Notation). Some common uses are: unit conversions, simple math, and
|
||||
summing up data are just a few.</p>
|
||||
|
||||
<p>In cacti you do write a out a CDEF statement like you may be used to, instead you "build" it.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.4.2. How to Create a CDEF in cacti</font><a name="3.4.2"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>1. Click "CDEF's" on the cacti menu and click "Add" to create a new CDEF.</p>
|
||||
|
||||
<p><b>Name</b> - Enter any enter name to describe this CDEF.</p>
|
||||
|
||||
<p>2. Click save to return to the main CDEF page.</p>
|
||||
|
||||
<p>3. Click "Edit Current CDEF" next to the CDEF that you just created.</p>
|
||||
|
||||
<p>In this screen you will add each of the CDEF items separately. For instance if you had the statement:
|
||||
<i>dsname,8,*</i>; you would add the data source name, the "8" and finally the "*" separately. This is why I reffer to it
|
||||
as "building" a CDEF statement.</p>
|
||||
|
||||
<p>4. Click "Add" to add an item to this statement.</p>
|
||||
|
||||
<p><b>Data Source</b> - Choose this option if you are inserting a data source, then choose it from the list.
|
||||
The "Use the current data source being used on the graph instead of a preset one." checkbox should be used
|
||||
when you do not know what data source will be used since it could vary depending on the graph it's used in.
|
||||
If you select this box, the data source you select above will be ignored.</p>
|
||||
|
||||
<p><b>CDEF Function</b> - Select this if you want to insert a CDEF math function, then select it from the list.</p>
|
||||
|
||||
<p><b>Custom Entry</b> - If you want to enter an arbitrary value such a number or other function, select
|
||||
this and enter your value in the box.</p>
|
||||
|
||||
<p>5. Click save and repeat this step as many times as is necessary. Also note that you do not have to include
|
||||
the commas in your CDEF statement, cacti will insert them for you.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.5. Graphs</font><a name="3.5"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.5.1. How to Add/Remove Graphs</font><a name="3.5"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>1. Click "Graphs" on the cacti menu, and click "Add" to create a new graph.</p>
|
||||
|
||||
<p><b>Title</b> - A name for this graph, can contain any character and is printed at the
|
||||
top of each graph.</p>
|
||||
|
||||
<p><b>Height</b> - The height (in pixels) that the graph is.</p>
|
||||
|
||||
<p><b>Width</b> - The width (in pixels) that the graph is.</p>
|
||||
|
||||
<p><b>Use Rigid Boundaries Mode (--rigid)</b> - From the rrdtool manual "<em>Normally rrdgraph
|
||||
will automatically expand the lower and upper limit if the graph contains a value outside
|
||||
the valid range. With this option you can disable this behavior.</em>"</p>
|
||||
|
||||
<p><b>Auto Scale</b> - Enable auto scale in the graph. This option must be check to use the
|
||||
next two options. Upper/Lower limit values are ignored when using autoscale since these
|
||||
boundaries are determined automatically.</p>
|
||||
|
||||
<p><b>Use --alt-autoscale</b> - From the rrdtool manual "<em>Compute Y range based on function
|
||||
absolute minimum and maximum values. Default algorithm uses predefined set of ranges.
|
||||
This is good in many cases but it fails miserably when you need to graph something like
|
||||
260 + 0.001 * sin(x). Default algorithm will use Y range from 250 to 300 and on the graph
|
||||
you will see almost straight line. With --alt-autoscale Y range will be from slightly less
|
||||
the 260 - 0.001 to slightly more then 260 + 0.001 and periodic behavior will be seen.
|
||||
(contributed by Sasha Mikheev)"</em></p>
|
||||
|
||||
<p><b>Use --alt-autoscale-max</b> - From the rrdtool manual "<em>Where --alt-autoscale will
|
||||
modify both the absolute maximum AND minimum values, this option will only affect the maximum
|
||||
value. The minimum value, if not defined on the command line, will be 0. This option can be
|
||||
useful when graphing router traffic when the WAN line uses compression, and thus the
|
||||
throughput may be higher than the WAN line speed.</em>"</p>
|
||||
|
||||
<p><b>Auto Padding</b> - If you have ever created rrdtool-based graphs manually, you may have
|
||||
realized how annoying it can be to get text to line up properly. With this option cacti will
|
||||
do its best to make the columns on your graph legend line up.</p>
|
||||
|
||||
<p>Auto Padding is not perfect and is best for graphs with consistent fields in each
|
||||
column. Auto padding also creates a small overhead when rendering graphs due to the extra
|
||||
text processing that is required.</p>
|
||||
|
||||
<p><strong>Allow Grouping</strong> - Grouping a is new feature which "groups" the GPRINT items
|
||||
on a graph to its "parent" item. This allows you to change the sequence of an entire group
|
||||
without changing each item individually, removing a parent also removes its child items.
|
||||
It is recommended that you use this feature since if anything it makes the graph items easier
|
||||
to visualize. Also, if you are graphing MAX lines (like in newer versions of MRTG), you
|
||||
want this feature turned on since it will prevent anomalies from happening on the graph legend.
|
||||
Either way, this feature can be turned on and off at any time, cacti will take care of
|
||||
grouping any graph that was previously not grouped <strong>without</strong> changing the order
|
||||
of items.</p>
|
||||
|
||||
<p><strong>Allow Graph Export</strong> - If you are using cacti's graph export feature, you
|
||||
can select whether this graph will be exported here.</p>
|
||||
|
||||
<p><b>Upper Limit</b> - The highest value to display on the Y-axis.</p>
|
||||
|
||||
<p><b>Lower Limit</b> - The lowest value to display on the Y-axis.</p>
|
||||
|
||||
<p><b>Base Value</b> - How to label the Y-axis. Use 1024 for memory and 1000 for traffic measurements.</p>
|
||||
|
||||
<p><b>Vertical Label</b> - The text to print on the left edge of the graph. Usually is the units
|
||||
the data in the graph is measured in.</p>
|
||||
|
||||
<p>2. Click save to return to the main graph page.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell2">
|
||||
<font class="header">3.5.2. How to Add/Remove Graph Items</font><a name="3.5.2"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell1">
|
||||
<p>1. Click "Edit Graph Items" next to any graph on the Graphs page in cacti.</p>
|
||||
|
||||
<p>In the section of cacti, you will build your graph piece by piece; much how you would
|
||||
stack building blocks. Creating a graph is very simple; but it still helps to know a little
|
||||
about how rrdtool graphs work. Make sure to get comfortable with
|
||||
<a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/manual/rrdgraph.html">this
|
||||
manual</a> first.</p>
|
||||
|
||||
<p>2. Click "Add" to add a new item to the graph.</p>
|
||||
|
||||
<p><b>Data Source</b> - Where to get data from for this graph item. Whether you are printing
|
||||
out this information using text (<em>GPRINT</em>) or graphically (<em>AREA</em>, <em>STACK</em>, <em>LINE[1-3]</em>), you
|
||||
must select the data source to pull this information from. Some graph items will not have
|
||||
a data source, for instance if you are printing text or using <em>HRULE</em>/<em>VRULE's</em>.</p>
|
||||
|
||||
<p><strong>Item Group</strong> - If you are using cacti's graph grouping feature; you can
|
||||
select which parent item this child item belongs to. Note: If you are adding a parent item
|
||||
(<em>AREA</em>, <em>STACK</em>, <em>LINE[1-3]</em>) this field will be ignored. Also, by default
|
||||
the last parent item added will automatically be selected for convenience.</p>
|
||||
|
||||
<p><b>Color</b> - The color to use when putting the information on the graph. This color is
|
||||
only for graph data, and not for text. Only applies to: <em>AREA</em>, <em>STACK</em>, <em>LINE[1-3]</em>, <em>VRULE</em>, and
|
||||
<em>HRULE</em>.</p>
|
||||
|
||||
<p><b>Graph Item Type</b> - How the data is to be represented on the graph. Represent data on
|
||||
the graph using: <em>AREA</em>, <em>STACK</em>, and <em>LINE[1-3]</em>. Add vertical/horizontal
|
||||
lines to the graph using: <em>VRULE</em> and <em>HRULE</em>. Add text the legend area by using <em>COMMENT</em> and <em>GPRINT</em>.</p>
|
||||
|
||||
<p>One useful note: <strong>You must always put an AREA item before using STACK or your graph will
|
||||
not render.</strong></p>
|
||||
|
||||
<p><b>Consolidation Function</b> - How data is to be represented on a graph. Normally <em>AVERAGE</em>
|
||||
is used to represent an average over the selected time span. But <em>LAST</em>, <em>MIN</em>, and <em>MAX</em> can also
|
||||
be used to display other kinds of data too.</p>
|
||||
|
||||
<p><b>CDEF Function</b> - If you want to apply a CDEF function to this graph item, select it here.
|
||||
Look at the <a href="MANUAL.htm#3.4">CDEF section</a> of the cacti documentation for more information.</p>
|
||||
|
||||
<p><b>Value</b> - This field is only used with the <em>HRULE</em>/<em>VRULE</em> graph item types.
|
||||
Type the value of the appropriate (X/Y) axis to draw the line at.</p>
|
||||
|
||||
<p><b>Text Format</b> - The text-based label for the legend. You may type any text here to
|
||||
appear on the graph's legend. You may also put data input/output sources here using the syntax:
|
||||
<dataname>. Get more information on <a href="MANUAL.htm#3.2">data input sources</a> in cacti if you do not understand
|
||||
how this works.</p>
|
||||
|
||||
<p><b>Insert Hard Return</b> - Check this box to force graph items onto the next line.</p>
|
||||
|
||||
<p>3. Click save to return to the graph items page. Repeat step 2 until your graph is complete.
|
||||
Check out some of the graphs that come with cacti to see how to create a working graph.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,87 @@
|
||||
raXnet - cacti
|
||||
|
||||
REQUIREMENTS:
|
||||
Cacti should be able to run on any Unix-based operating system with
|
||||
the following requirements:
|
||||
|
||||
PHP 4.0+
|
||||
MySQL 3.22+
|
||||
|
||||
PHP Must also be compiled as a standalone cgi binary. This is required
|
||||
for data gathering in crontab. This requirement may go away in the future
|
||||
if I decide to replace it with a small C program. If anyone wishes to
|
||||
do this, please contact me first; that would be much appreciated.
|
||||
|
||||
Cacti has been successfully run on the following operating systems:
|
||||
|
||||
Redhat 7.2 (Linux 2.4.9-13)
|
||||
Redhat 7.1 (Linux 2.4.9-6)
|
||||
FreeBSD 4.2
|
||||
Windows 2000 Professional/Server
|
||||
Slackware 8.0
|
||||
Debian Linux
|
||||
SuSE Linux 7.3
|
||||
|
||||
A Note About Debian:
|
||||
|
||||
Under Debian Linux, the PHP binary is available as the php4-cgi package.
|
||||
This package creates a separate php.ini, so you must edit your
|
||||
'php4/cgi/php.ini' file and add line that says 'extension=mysql.so'.
|
||||
|
||||
If you get cacti running on other operating systems, please contact me, I
|
||||
will add the names to the list.
|
||||
|
||||
A Note About SuSE 7.3:
|
||||
|
||||
The SNMP support that comes with PHP 4.0.6 does not appear to work correctly
|
||||
under SuSE Linux 7.3. It is recommended that you go to http://www.php.net/,
|
||||
download the newest source and compile a new PHP-binary with SNMP support.
|
||||
|
||||
INFORMATION ABOUT CACTI:
|
||||
|
||||
Cacti is a complete frontend to rrdtool, it stores all of the nessesary
|
||||
information to create graphs and populate them with data in a MySQL
|
||||
database. The frontend is completely PHP driven. Along with being able
|
||||
to maintain Graphs, Data Sources, and Round Robin Archives in a database,
|
||||
cacti handles the data gathering also. There is also SNMP support for
|
||||
those used to creating traffic graphs with MRTG.
|
||||
|
||||
To handle data gathering, you can feed cacti the paths to any external
|
||||
script/command along with any data that the user will need to "fill in",
|
||||
cacti will then gather this data in a cron-job and populate a MySQL
|
||||
database/the round robin archives.
|
||||
|
||||
Data Sources can also be created, which correspond to actual data on
|
||||
the graph. For instance, if a user would want to graph the ping times
|
||||
to a host, you could create a data source choosing a script that pings
|
||||
a host and returns it's value in milliseconds. After defining options
|
||||
for rrdtool such as how to store the data you will be able to define
|
||||
any additional information that the data input source requires, such
|
||||
as a host to ping in this case. Once a data source is created, it is
|
||||
automatically mantained at 5 minute intervals.
|
||||
|
||||
For those that are used to creating traffic graphs in MRTG, this
|
||||
process has become much simplier in cacti. An SNMP interface allows
|
||||
you to enter SNMP capable hosts and cacti will display that host's
|
||||
interfaces, all which can be graphed will once click from that point.
|
||||
|
||||
Once one or more data sources are defined, an rrdtool graph can be
|
||||
created using the data. Cacti allows you to create almost any
|
||||
imaginable rrdtool graph using all of the standard rrdtool graph types
|
||||
and consolidation functions. A color selection area and automatic text
|
||||
padding function also aid in the creation of graphs to make the process
|
||||
easier.
|
||||
|
||||
Not only can you create rrdtool based graphs in cacti, but there are
|
||||
many ways to display them. Along with a standard "list view" and a
|
||||
"preview mode", which resembles the rrdtool frontend 14all, there is
|
||||
a "tree view", which allows you to put graphs onto a hierarchical tree
|
||||
for organizational purposes.
|
||||
|
||||
Due to the many functions of cacti, a user based management tool is
|
||||
built in so you can add users and give them rights to certain areas
|
||||
of cacti. This would allow someone to create some users that can change
|
||||
graph parameters, while others can only view graphs. Each user also
|
||||
mantains their own settings when it comes to viewing graphs.
|
||||
|
||||
04012002/raXnet
|
||||
@@ -0,0 +1,108 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>cacti Upgrade Instructions</title>
|
||||
<style>
|
||||
<!--
|
||||
BODY
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
P.code
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Courier New, Courier;
|
||||
font-weight: bold;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
color: #000066;
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
|
||||
TT.shell
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Courier New, Courier;
|
||||
font-weight: normal;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
P.php
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Courier New, Courier;
|
||||
font-weight: normal;
|
||||
color: #000000;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
|
||||
TT.php-var
|
||||
{
|
||||
font-size: 10pt;
|
||||
font-family: Courier New, Courier;
|
||||
font-weight: normal;
|
||||
color: #008080;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h2>Cacti Upgrade</h2><p>
|
||||
|
||||
<h3>Upgrade Instructions</h3><p>
|
||||
|
||||
<ol>
|
||||
<li>Backup the old cacti database:<p>
|
||||
|
||||
<p class="code"><tt class="shell">shell></tt> <b>mysqldump cacti > mysql.cacti</b></p><br>
|
||||
|
||||
<li>Backup the old cacti directory:<p>
|
||||
|
||||
<p class="code"><tt class="shell">shell></tt> <b>mv cacti cacti_old</b></p><br>
|
||||
|
||||
<li>Extract the distribution tarball.<p>
|
||||
|
||||
<p class="code"><tt class="shell">shell></tt> <b>tar xzvf cacti-<i>version</i>.tar.gz</b></p><br>
|
||||
|
||||
<li>Rename the new cacti directory to match the old one:<p>
|
||||
|
||||
<p class="code"><tt class="shell">shell></tt> <b>mv cacti-<em>version</em> cacti</b></p><br>
|
||||
|
||||
<li>Copy the *.rrd files from the old cacti directory:<p>
|
||||
|
||||
<p class="code"><tt class="shell">shell></tt> <b>cp cacti_old/rra/* cacti/rra/</b></p><br>
|
||||
|
||||
<li>Edit <b>include/config.php</b>.<p>
|
||||
|
||||
<ul>
|
||||
<li><p>Specify the MySQL user, password and database for your cacti configuration.</p></li>
|
||||
|
||||
<p class="php"><b>$database_default</b> = <tt class="php-var">"cacti"</tt>;<br>
|
||||
<b>$database_hostname</b> = <tt class="php-var">"localhost"</tt>;<br>
|
||||
<b>$database_username</b> = <tt class="php-var">"cactiuser"</tt>;<br>
|
||||
<b>$database_password</b> = <tt class="php-var">"cacti"</tt>;<br>
|
||||
</p><br>
|
||||
</ul>
|
||||
|
||||
<li>Set the appropriate permissions on cacti's directories for graph/log generation. You should execute these commands from inside cacti's directory to change the permissions.<p>
|
||||
|
||||
<p class="code"><tt class="shell">shell></tt> <b>chown <em>cactiuser</em> rra/ log/</b></p><br>
|
||||
|
||||
<p>(Enter a valid username for <em>cactiuser</em>, this user will also be used in the next step for
|
||||
data gathering.)</p>
|
||||
|
||||
<li>Point your web browser to:<p>
|
||||
|
||||
<blockquote>http://your-server/cacti/</blockquote>
|
||||
|
||||
<p>Make sure to fill in all of the path variables carefully
|
||||
and correctly on the following screen.</p>
|
||||
</ol>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,61 @@
|
||||
A
|
||||
{
|
||||
TEXT-DECORATION: none;
|
||||
color : Blue;
|
||||
}
|
||||
|
||||
A:active
|
||||
{
|
||||
TEXT-DECORATION: none
|
||||
}
|
||||
|
||||
A:hover
|
||||
{
|
||||
TEXT-DECORATION: underline
|
||||
color: #333333
|
||||
}
|
||||
|
||||
A:active
|
||||
{
|
||||
}
|
||||
|
||||
A:visited
|
||||
{
|
||||
color : Blue;
|
||||
}
|
||||
|
||||
BODY
|
||||
|
||||
{
|
||||
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
|
||||
FONT-SIZE: 12px;
|
||||
background-color : #F5F5F5;
|
||||
}
|
||||
|
||||
TABLE, TR, TD
|
||||
{
|
||||
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
|
||||
FONT-SIZE: 12px;
|
||||
LETTER-SPACING: 0px;
|
||||
}
|
||||
|
||||
TABLE H4
|
||||
{
|
||||
TEXT-ALIGN: center
|
||||
}
|
||||
|
||||
.header
|
||||
{
|
||||
FONT-SIZE: 14px;
|
||||
font-weight : bold;
|
||||
}
|
||||
|
||||
.cell1
|
||||
{
|
||||
background-color: #FFFFFF
|
||||
}
|
||||
|
||||
.cell2
|
||||
{
|
||||
background-color: #E7E9F2
|
||||
}
|
||||
@@ -0,0 +1,387 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? $section = "Add/Edit Data Sources";
|
||||
include ('include/auth.php');
|
||||
header("Cache-control: no-cache");
|
||||
include_once ('include/functions.php');
|
||||
include_once ('include/form.php');
|
||||
|
||||
if (isset($form[action])) { $action = $form[action]; } else { $action = $args[action]; }
|
||||
if (isset($form[ID])) { $id = $form[ID]; } else { $id = $args[id]; }
|
||||
|
||||
switch ($action) {
|
||||
case 'duplicate':
|
||||
include_once ('include/utility_functions.php');
|
||||
|
||||
$id = DuplicateDataSource($id);
|
||||
|
||||
header ("Location: $PHP_SELF?action=edit&id=$id");
|
||||
break;
|
||||
case 'save':
|
||||
/* do some error checking here */
|
||||
if ($dsname != "") {
|
||||
if (CleanUpName($dsname) != $dsname) {
|
||||
header ("Location: $PHP_SELF?action=edit&id=$id&error=1");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* take care of renaming ds in the .rrd if the user wants it */
|
||||
if ($update_rrd == "on") {
|
||||
include_once ('include/rrd_functions.php');
|
||||
|
||||
$rrd_tune_array["data_source_id"] = $id;
|
||||
$rrd_tune_array["heartbeat"] = $form[Heartbeat];
|
||||
$rrd_tune_array["minimum"] = $form[MinValue];
|
||||
$rrd_tune_array["maximum"] = $form[MaxValue];
|
||||
$rrd_tune_array["data-source-type"] = $form[DataSourceTypeID];
|
||||
$rrd_tune_array["data-source-rename"] = $form[DSName];
|
||||
|
||||
rrdtool_function_tune($rrd_tune_array);
|
||||
}
|
||||
|
||||
$sql_id = db_execute("replace into rrd_ds (id,name,datasourcetypeid,heartbeat,
|
||||
minvalue,maxvalue,srcid,active,dsname,dspath,step,subdsid,subfieldid,isparent)
|
||||
values ($id,\"$form[Name]\",$form[DataSourceTypeID],$form[Heartbeat],$form[MinValue],$form[MaxValue],$form[SrcID],
|
||||
\"$form[Active]\",\"$form[DSName]\",\"$form[DSPath]\",$form[Step],$form[SubDSID_Old],$form[SubFieldID],$formIsParent])");
|
||||
|
||||
if ($id == 0) {
|
||||
/* get dsid if this is a new save */
|
||||
$id = db_fetch_cell("select LAST_INSERT_ID()");
|
||||
|
||||
if ($id == 0) {
|
||||
unset($id);
|
||||
}
|
||||
}
|
||||
|
||||
/* update table with rra info */
|
||||
$sql_id = db_execute("delete from lnk_ds_rra where dsid=$id");
|
||||
|
||||
for ($i = 0; $i < count($rraid); $i++) {
|
||||
db_execute("insert into lnk_ds_rra (dsid,rraid) values ($id,$rraid[$i])");
|
||||
}
|
||||
|
||||
/* NEW: If this data source uses a data input source that has multiple outputs
|
||||
we must create the appropriate cacti data sources here! The following settings will
|
||||
be copied from the settings just entered to each data source we have to create:
|
||||
|
||||
- Data Source Type
|
||||
- Heartbeat
|
||||
- Minimum Value
|
||||
- Maximum Value
|
||||
|
||||
Additionally, to get the 'Name' field, we will append the data input source field
|
||||
name to the current 'Name' field. The 'Internal Data Source Name' will simply by
|
||||
default be the data input source field name.
|
||||
|
||||
*/
|
||||
|
||||
if ($SrcID != $SrcID_Old) {
|
||||
/* ------------------ CLEANUP ------------------ */
|
||||
/* if the data input source changed, make sure to delete any children this
|
||||
ds has */
|
||||
|
||||
if ($ID != "0") {
|
||||
db_execute("delete from rrd_ds where subdsid=$id");
|
||||
|
||||
/* ... same goes for the items in src_data */
|
||||
db_execute("delete from src_data where dsid=$id");
|
||||
|
||||
/* we have to make sure to kill the children's DS's in src_data */
|
||||
$id_list = db_fetch_assoc("select ID from rrd_ds where subdsid=$id");
|
||||
|
||||
if (sizeof($id_list) > 0) {
|
||||
foreach ($id_list as $myid) {
|
||||
db_execute("delete from src_data where dsid=$myid[ID]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------ CLEANUP ------------------ */
|
||||
|
||||
/* Test if the current data input source has more than one output */
|
||||
$fields = db_fetch_assoc("select ID,DataName
|
||||
from src_fields
|
||||
where srcid=$form[SrcID]
|
||||
and inputoutput=\"out\"
|
||||
and updaterra=\"on\"
|
||||
order by id");
|
||||
if (sizeof($fields) > 0) {
|
||||
|
||||
/* Yes, it has more than one output.... */
|
||||
$data_source_is_parent = "1";
|
||||
|
||||
/* Loop through each output and create a sub-data source for the data
|
||||
source that has just been created */
|
||||
foreach ($fields as $field) {
|
||||
db_execute("replace into rrd_ds
|
||||
(id,subdsid,subfieldid,name,datasourcetypeid,heartbeat,minvalue,maxvalue,srcid,active,
|
||||
dsname,dspath,step
|
||||
) values (0,$id,$field[ID],\"$name" . "_" . "$field[DataName]\",
|
||||
$form[DataSourceTypeID],$form[Heartbeat],$form[MinValue],$form[MaxValue],0,\"on\",\"" .
|
||||
CheckDataSourceName($field[DataName]) . "\",\"\",0)");
|
||||
}
|
||||
}else{
|
||||
$data_source_is_parent = "0";
|
||||
}
|
||||
|
||||
db_execute("update rrd_ds set isparent=$data_source_is_parent where id=$id");
|
||||
}
|
||||
|
||||
/* this will do any of the cleanup that is required on the data source name to make
|
||||
sure rrdtool is ok with it. */
|
||||
SyncDataSourceName($id, $form[DSName], $form[DSPath]);
|
||||
|
||||
header ("Location: $PHP_SELF");
|
||||
break;
|
||||
case 'remove':
|
||||
if (($config["remove_verification"]["value"] == "on") && ($confirm != "yes")) {
|
||||
include_once ('include/top_header.php');
|
||||
DrawConfirmForm("Are You Sure?", "Are you sure you want to delete this data source?", $current_script_name, "?action=remove&id=$id");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (($config["remove_verification"]["value"] == "") || ($confirm == "yes")) {
|
||||
if ($id != "0") {
|
||||
db_execute("delete from rrd_ds where id=$id");
|
||||
db_execute("delete from rrd_ds where subdsid=$id");
|
||||
db_execute("delete from lnk_ds_rra where dsid=$id");
|
||||
db_execute("delete from src_data where dsid=$id");
|
||||
|
||||
/* we have to make sure to kill the children's DS's in src_data */
|
||||
$id_list = db_fetch_assoc("select ID from rrd_ds where subdsid=$id");
|
||||
|
||||
if (sizeof($id_list) > 0) {
|
||||
foreach ($id_list as $id) {
|
||||
db_execute("delete from src_data where dsid=$id[ID]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header ("Location: $PHP_SELF");
|
||||
break;
|
||||
case 'edit':
|
||||
include_once ('include/rrd_functions.php');
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
if ($id != "") {
|
||||
$ds = db_fetch_row("select * from rrd_ds where id=$id");
|
||||
|
||||
$srcid_old = $ds[SrcID];
|
||||
$sub_data_source_id = $ds[SubDSID];
|
||||
}
|
||||
|
||||
DrawFormHeader("rrdtool Data Source Configuration","",false);
|
||||
|
||||
if ($id != "") {
|
||||
switch ($error) {
|
||||
case '1':
|
||||
$dsname_error .= "<font color=\"red\">YOU HAVE ENTERED AN INVALID NAME!</font>\n\n";
|
||||
break;
|
||||
}
|
||||
|
||||
/* check to see if the current data source exists */
|
||||
$data_source_path = GetDataSourcePath($id, true);
|
||||
|
||||
if (file_exists($data_source_path) == false) {
|
||||
$warning_text .= "<font color=\"red\">CANNOT FIND DATA SOURCE: $data_source_path</font>\n\n";
|
||||
}
|
||||
|
||||
/* see if the data source has any rra's */
|
||||
$rras = db_fetch_assoc("select * from lnk_ds_rra where dsid=$id");
|
||||
|
||||
if (! sizeof($rras) > 0) {
|
||||
$warning_text .= "<font color=\"red\">THIS DATA SOURCE NEEDS TO HAVE AT LEAST ONE RRA ASSOCIATED WITH IT!</font>\n\n";
|
||||
}
|
||||
|
||||
if ($sub_data_source_id == 0) {
|
||||
DrawFormPreformatedText($colors[panel], $warning_text . rrdtool_function_create($id, true));
|
||||
}
|
||||
}
|
||||
|
||||
DrawFormItem("Name","The name used for RRA files, among other things; no spaces or strange characters.");
|
||||
DrawFormItemTextBox("Name",$ds[Name],"","255");
|
||||
|
||||
DrawFormItem("$dsname_error (Optional) Internal Data Source Name","The name of the data source used by rrdtool, by default this name is the same as the Data Source Name. However it may need to be changed for compatability with other RRA's.");
|
||||
DrawFormItemTextBox("DSName",$ds[DSName],"","19");
|
||||
|
||||
if ($sub_data_source_id == 0) {
|
||||
DrawFormItem("(Optional) Data Source Path","Used only if the data source lies in a different directory; you must include_once the full path to the RRA file.");
|
||||
DrawFormItemTextBox("DSPath",$ds[DSPath],"","");
|
||||
} else {
|
||||
DrawFormItemHiddenTextBox("DSPath","","");
|
||||
}
|
||||
|
||||
if ($sub_data_source_id == 0) {
|
||||
DrawFormItemHiddenTextBox("SubFieldID","0","0");
|
||||
} else {
|
||||
DrawFormItem("Output Field","Which output value is associated with this data
|
||||
source.");
|
||||
|
||||
$mysrcid = db_fetch_cell("select SrcID from rrd_ds where id=$sub_data_source_id");
|
||||
DrawFormItemDropdownFromSQL("SubFieldID",db_fetch_assoc("select id,concat(name,' (',dataname,')') as Name from src_fields where
|
||||
srcid=$mysrcid and inputoutput=\"out\""),"Name","ID",$ds[SubFieldID],"","");
|
||||
}
|
||||
|
||||
DrawFormItem("Data Source Type","The type of data that is being represented.");
|
||||
DrawFormItemDropdownFromSQL("DatasourceTypeID",db_fetch_assoc("select * from def_ds order by name"),"Name","ID",$ds[DataSourceTypeID],"","");
|
||||
|
||||
if ($sub_data_source_id == 0) {
|
||||
DrawFormItem("Data Input Type","What is used to gather the data for use in RRA files and on graphs.");
|
||||
DrawFormItemDropdownFromSQL("SrcID",db_fetch_assoc("select * from src order by name"),"Name","ID",$ds[SrcID],"None","");
|
||||
}else{
|
||||
DrawFormItemHiddenTextBox("SrcID","0","0");
|
||||
}
|
||||
|
||||
if ($sub_data_source_id == 0) {
|
||||
DrawFormItem("Associated RRA's","Which RRA's to use when entering data. (It is recommended that you select all of these values)");
|
||||
DrawFormItemMultipleList("RRAID","select Name,ID from rrd_rra","Name","ID",
|
||||
"select * from lnk_ds_rra where dsid=$id","RRAID");
|
||||
}else{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
DrawFormItem("Heartbeat","The maximum amount of time that can pass before data is entered as \"unknown\". (Usually 600)");
|
||||
DrawFormItemTextBox("Heartbeat",$ds[Hearbeat],"600","");
|
||||
|
||||
if ($sub_data_source_id == 0) {
|
||||
DrawFormItem("Step","Specifies the base interval in seconds with which data will be fed into the .rrd file. (Usually 300)");
|
||||
DrawFormItemTextBox("Step",$ds[Step],"300","");
|
||||
}else{
|
||||
DrawFormItemHiddenTextBox("step","0","0");
|
||||
}
|
||||
|
||||
DrawFormItem("Minimum Value","The minimum value of data that is allowed to be collected.");
|
||||
DrawFormItemTextBox("MinValue",$ds[MinValue],"0","");
|
||||
|
||||
DrawFormItem("Maximum Value","The maximum value of data that is allowed to be collected (number must be smaller than max value).");
|
||||
DrawFormItemTextBox("MaxValue",$ds[MaxValue],"1","");
|
||||
|
||||
if ($sub_data_source_id == 0) {
|
||||
DrawFormItem("Update .rrd File","Update the .rrd file in addition the cacti's database when saving these changes.");
|
||||
DrawFormItemCheckBox("update_rrd","","Update Changes in .rrd File","");
|
||||
}else{
|
||||
DrawFormItemHiddenTextBox("update_rrd","","");
|
||||
}
|
||||
|
||||
if ($sub_data_source_id == 0) {
|
||||
DrawFormItem("Active","Whether data is currently be collected for this data source.");
|
||||
DrawFormItemCheckBox("Active",$ds[Active],"Data Source Currently Active","on");
|
||||
}else{
|
||||
DrawFormItemHiddenTextBox("active","on","on");
|
||||
}
|
||||
|
||||
DrawFormSaveButton();
|
||||
DrawFormItemHiddenTextBox("SrcID_Old",$srcid_old,"0");
|
||||
DrawFormItemHiddenTextBox("SubDSID_Old",$sub_data_source_id,"0");
|
||||
DrawFormItemHiddenIDField("IsParent",$ds[IsParent]);
|
||||
DrawFormItemHiddenIDField("ID",$id);
|
||||
DrawFormFooter();
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
default:
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
DrawMatrixTableBegin("97%");
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderTop("Current Data Sources",$colors[dark_bar],"","4");
|
||||
DrawMatrixHeaderAdd($colors[dark_bar],"","$PHP_SELF?action=edit");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderItem("Name",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Data Input Type",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Duplicate",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Active",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
$ds_list = db_fetch_assoc("select
|
||||
d.ID,d.Name,d.DataSourceTypeID,d.SrcID,d.Active,d.SubDSID,d.IsParent,
|
||||
(d.id=d.subdsid) as sortstr,
|
||||
s.id as SID,s.name as SName
|
||||
from rrd_ds d left join src s on (d.srcid=s.id)
|
||||
order by sortstr,name");
|
||||
$rows = sizeof($ds_list);
|
||||
if (sizeof($ds_list) > 0) {
|
||||
foreach ($ds_list as $ds) {
|
||||
DrawMatrixRowAlternateColorBegin($colors[alternate],$colors[light],$i);
|
||||
if ($ds[SubDSID] != 0) {
|
||||
$matrix_title = "<img src=\"images/gray_line.gif\" width=\"7\" height=\"1\" border=\"0\"> " . $ds[Name];
|
||||
} else {
|
||||
$matrix_title = $ds[Name];
|
||||
}
|
||||
|
||||
DrawMatrixLoopItem($matrix_title,html_boolean($config["vis_main_column_bold"]["value"]),"$PHP_SELF?action=edit&id=$ds[ID]");
|
||||
|
||||
if ($ds[SrcID] == 0) {
|
||||
$matrix_title = "None";
|
||||
} else {
|
||||
$matrix_title = "$ds[SName] [<a href=\"ds_data_config.php?id=$ds[ID]&did=$ds[SrcID]\">Edit Data</a>]";
|
||||
}
|
||||
|
||||
DrawMatrixLoopItem($matrix_title,false,"");
|
||||
|
||||
if ($ds[SubDSID] != 0) {
|
||||
$matrix_title = "N/A";
|
||||
} else {
|
||||
if ($ds[Active] == "on") {
|
||||
$matrix_title = "Currently Active";
|
||||
} else {
|
||||
$matrix_title = "<font color=\"#FF0000\">Not Active</font>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($ds[SubDSID] != 0) {
|
||||
$matrix_url = "";
|
||||
} else {
|
||||
if ($ds[IsParent] != 0) {
|
||||
$matrix_url = "";
|
||||
} else {
|
||||
$matrix_url = "$PHP_SELF?id=$ds[ID]&action=duplicate";
|
||||
}
|
||||
}
|
||||
|
||||
DrawMatrixLoopItem("Duplicate",false,$matrix_url);
|
||||
DrawMatrixLoopItem($matrix_title,false,"");
|
||||
|
||||
if ($ds[SubDSID]!= 0) {
|
||||
$matrix_url = "";
|
||||
}else{
|
||||
$matrix_url = "$PHP_SELF?action=remove&id=$ds[ID]";
|
||||
}
|
||||
|
||||
DrawMatrixLoopItemAction("Remove",$colors[panel],"",false,$matrix_url);
|
||||
DrawMatrixRowEnd();
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
DrawMatrixTableEnd();
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
} ?>
|
||||
@@ -0,0 +1,94 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
$section = "Add/Edit Data Sources";
|
||||
include ('include/auth.php');
|
||||
include_once ("include/functions.php");
|
||||
include_once ('include/form.php');
|
||||
|
||||
if ($form[action]) { $action = $form[action]; } else { $action = $args[action]; }
|
||||
if ($form[id]) { $id = $form[ID]; } else { $id = $args[id]; }
|
||||
|
||||
switch ($action) {
|
||||
case 'save':
|
||||
/* ok, first pull out all 'input' values so we know how much to save */
|
||||
$ds_list = db_fetch_assoc("select d.SrcID, f.ID, f.InputOutput, f.DataName from rrd_ds d left
|
||||
join src_fields f on d.srcid=f.srcid where d.id=$id and f.inputoutput=\"in\"");
|
||||
if (sizeof($ds_list) > 0) {
|
||||
foreach ($ds_list as $ds) {
|
||||
|
||||
/* then, check and see if this value already exists */
|
||||
$myid = db_fetch_cell("select id from src_data where fieldid=$ds[ID] and dsid=$id");
|
||||
|
||||
/* use id 0 if it doesn't; previd if it does */
|
||||
if ($myid <= 0) {
|
||||
$new_id = 0;
|
||||
}else{
|
||||
$new_id = $myid;
|
||||
}
|
||||
|
||||
/* save the data into the src_data table */
|
||||
$sql_id_save = db_execute("replace into src_data (id,fieldid,dsid,value) values
|
||||
($new_id,$myid,$id,\"$ds[ID]" . ${$ds[DataName]} . "\")");
|
||||
}
|
||||
}
|
||||
header ("Location: ds.php");
|
||||
break;
|
||||
default:
|
||||
include_once ('include/rrd_functions.php');
|
||||
include_once ("include/top_header.php");
|
||||
|
||||
$fields = db_fetch_assoc("select * from src_fields where srcid=$did and inputoutput=\"in\" order by name");
|
||||
|
||||
DrawFormHeader("rrdtool Data Source Configuration",false,false);
|
||||
DrawFormPreformatedText($colors[panel], GetCronPath($id) . "\n" . rrdtool_function_update($id, "", true));
|
||||
if (sizeof($fields) > 0) {
|
||||
foreach ($fields as $field) {
|
||||
$data = db_fetch_row("select * from src_data where DSID=$id and FieldID=$field[ID]");
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixCustom("<td bgcolor=\"#$colors[panel]\"><strong>$ds[Name]</strong></td>");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
if (sizeof($data) > 0) {
|
||||
$old_value = $data[Value];
|
||||
}else{
|
||||
$old_value = "";
|
||||
}
|
||||
|
||||
DrawFormItemTextBox("Value",$old_value,"","");
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
DrawFormSaveButton();
|
||||
DrawFormItemHiddenIDField("id",$id);
|
||||
DrawFormFooter();
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
|
||||
include("include/config.php");
|
||||
|
||||
exec($config["path_php_binary"]["value"] . " -q $path_cacti/export_index.php > " . $config["path_html_export"]["value"] . "/index.html");
|
||||
exec($config["path_php_binary"]["value"] . " -q $path_cacti/export_images.php");
|
||||
|
||||
/* copy the css/images on the first time */
|
||||
if (file_exists($config["path_html_export"]["value"] . "/main.css") == false) {
|
||||
copy("$path_cacti/css/main.css", $config["path_html_export"]["value"] . "/main.css");
|
||||
copy("$path_cacti/images/top_tabs_export.gif", $config["path_html_export"]["value"] . "/top_tabs_export.gif");
|
||||
copy("$path_cacti/images/top_tabs_graph_preview.gif", $config["path_html_export"]["value"] . "/top_tabs_graph_preview.gif");
|
||||
copy("$path_cacti/images/top_tabs_graph_preview_down.gif", $config["path_html_export"]["value"] . "/top_tabs_graph_preview_down.gif");
|
||||
copy("$path_cacti/images/transparent_line.gif", $config["path_html_export"]["value"] . "/transparent_line.gif");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? include ('include/config.php'); ?>
|
||||
<html>
|
||||
<head>
|
||||
<title>cacti</title>
|
||||
<link href="main.css" rel="stylesheet">
|
||||
<?
|
||||
$page_refresh = $array_settings["preview"]["pagerefresh"];
|
||||
echo "<meta http-equiv=refresh content=\"$page_refresh\"; url=\"$PHP_SELF?$QUERY_STRING\">\n";
|
||||
echo "<meta http-equiv=Pragma content=no-cache>\n";
|
||||
echo "<meta http-equiv=cache-control content=no-cache>\n";
|
||||
?>
|
||||
</head>
|
||||
|
||||
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td bgcolor="#454E53" colspan="<?print $array_settings["preview"]["columnnumber"];?>" nowrap>
|
||||
<map name="tabs">
|
||||
<area alt="cacti" coords="7,5,87,35" href="http://www.raxnet.net/">
|
||||
<area alt="Graphs" coords="88,5,165,32" href="index.html" shape="RECT">
|
||||
</map>
|
||||
|
||||
<img src="top_tabs_export.gif" border="0" usemap="#tabs"><br>
|
||||
</td>
|
||||
<td bgcolor="#454E53" align="right" nowrap>
|
||||
<a href="index.html"><img src="top_tabs_graph_preview<?if ($action == "preview") { print "_down"; }?>.gif" border="0" alt="Preview View"></a><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" bgcolor="#<?print $colors[panel];?>">
|
||||
<img src="transparent_line.gif" width="170" height="5" border="0"><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="5" colspan="3" bgcolor="#<?print $colors[panel];?>">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0"
|
||||
<tr height="5"><td colspan="3"> </td></tr>
|
||||
<tr>
|
||||
<td bgcolor="#<?print $colors[light];?>" width="1%"></td>
|
||||
<td valign="top" colspan="2">
|
||||
@@ -0,0 +1,72 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
|
||||
include ("include/database.php");
|
||||
include_once ("include/rrd_functions.php");
|
||||
include_once ("include/functions.php");
|
||||
include ('include/config.php');
|
||||
include ("export_header.php");
|
||||
|
||||
$graphs = db_fetch_assoc("select
|
||||
g.ID,g.Title,g.ImageFormatID,
|
||||
t.Name
|
||||
from rrd_graph g
|
||||
left join def_image_type t
|
||||
on g.imageformatid=t.id
|
||||
and g.export=\"on\"
|
||||
order by g.title");
|
||||
|
||||
if (sizeof($graphs) > 0) {
|
||||
foreach ($graphs as $graph) {
|
||||
$filename = "graph_$graph[id].html";
|
||||
$fp = fopen($config["path_html_export"]["value"] . "/$filename", "w");
|
||||
|
||||
$exp_header = shell_exec($config["path_php_binary"]["value"] . " -q $path_cacti/export_header.php");
|
||||
|
||||
$graph_html = "";
|
||||
$rra_list = db_fetch_assoc("select id,name from rrd_rra order by steps");
|
||||
if (sizeof($rra_list) > 0) {
|
||||
foreach ($rra_list as $rra) {
|
||||
$image_filename = "normal_" . $graph[id] . "_" . $rra[id] . "." . $graph[name];
|
||||
|
||||
$graph_html .= "<div align=center><img src=\"$image_filename\" border=0></div>\n";
|
||||
$graph_html .= "<div align=center><strong>$row_rra[name]</strong></div><br>";
|
||||
|
||||
$graph_data_array["export"] = true;
|
||||
$graph_data_array["export_filename"] = $image_filename;
|
||||
|
||||
rrdtool_function_graph($graph[id],$rra[id],$graph_data_array);
|
||||
}
|
||||
}
|
||||
|
||||
$main_html = $exp_header . $graph_html;
|
||||
fwrite($fp, $main_html);
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,70 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
|
||||
include_once ("include/rrd_functions.php");
|
||||
include_once ("include/functions.php");
|
||||
$action = "preview";
|
||||
include ("export_header.php");
|
||||
|
||||
$array_settings = LoadSettingsIntoArray("","");
|
||||
|
||||
|
||||
print "<tr><td bgcolor='#$colors[light]' width='1%' rowspan='99999'></td>\n";
|
||||
|
||||
$graphs = db_fetch_assoc("select
|
||||
g.id,g.title,g.imageformatid,
|
||||
t.name
|
||||
from rrd_graph g
|
||||
left join def_image_type t
|
||||
on g.imageformatid=t.id
|
||||
and g.export=\"on\"
|
||||
order by g.title");
|
||||
|
||||
if (sizeof($graphs) > 0) {
|
||||
foreach ($graphs as $graph) {
|
||||
$graph_data_array["graph_width"] = $array_settings["preview"]["width"];
|
||||
$graph_data_array["graph_height"] = $array_settings["preview"]["height"];
|
||||
$graph_data_array["use"] = true;
|
||||
$graph_data_array["graph_nolegend"] = true;
|
||||
$graph_data_array["graph_start"] = -$array_settings["preview"]["timespan"];
|
||||
|
||||
$image_filename = "prev_".$graph[ID] .".". $graph[Name];
|
||||
|
||||
$graph_data_array["export"] = true;
|
||||
$graph_data_array["export_filename"] = $image_filename;
|
||||
|
||||
/* use rraid of 1 (daily) for now as default */
|
||||
rrdtool_function_graph($graph[ID],1,$graph_data_array);
|
||||
|
||||
print "<td width='25%'><a href='graph_$graph[ID].html'><img src='$image_filename' border='0' alt='rrdtool Graph'></a></td>\n";
|
||||
$k++;
|
||||
|
||||
if ($k % $array_settings["preview"]["columnnumber"] == 0) {
|
||||
print "</tr><tr height='10'><td> </td></tr><tr>\n";
|
||||
}
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
@@ -0,0 +1,80 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
$section = "View Graphs";
|
||||
$guest_account = true;
|
||||
include ('include/auth.php');
|
||||
include_once ("include/rrd_functions.php");
|
||||
include_once ("include/functions.php");
|
||||
include ("include/top_graph_header.php");
|
||||
|
||||
if (isset($form[action])) { $action = $form[action]; } else { $action = $args[action]; }
|
||||
if (isset($form[ID])) { $id = $form[ID]; } else { $id = $args[id]; }
|
||||
|
||||
switch ($args[rraid]) {
|
||||
case 'all':
|
||||
$sql_where = " where id is not null";
|
||||
break;
|
||||
default:
|
||||
$sql_where = " where id=$rraid";
|
||||
break;
|
||||
}
|
||||
|
||||
/* take graph permissions into account here, if the user does not have permission
|
||||
give an "access denied" message */
|
||||
if ($config["global_auth"]["value"] == "on") {
|
||||
$user = db_fetch_row("select userid from auth_graph where graphid=$graphid and userid=" . GetCurrentUserID($HTTP_COOKIE_VARS["cactilogin"],$config["guest_user"]["value"]));
|
||||
|
||||
if ($config["graph_policy"]["auth"] == "1") {
|
||||
if (sizeof($user) > 0) { $access_denied = true; }
|
||||
} elseif ($config["graph_policy"]["auth"] == "2") {
|
||||
if (! sizeof($user) > 0) { $access_denied = true; }
|
||||
}
|
||||
|
||||
if ($access_denied == true) {
|
||||
print "<strong><font size=\"+1\" color=\"FF0000\">ACCESS DENIED</font></strong>"; exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* make sure the graph requested exists (sanity) */
|
||||
$gid = db_fetch_cell("select ID from rrd_graph where id=$graphid");
|
||||
|
||||
if (! $gid > 0) {
|
||||
print "<strong><font size=\"+1\" color=\"FF0000\">GRAPH DOES NOT EXIST</font></strong>"; exit;
|
||||
}
|
||||
|
||||
$rra_list = db_fetch_assoc("select ID,Name from rrd_rra $sql_where order by steps");
|
||||
|
||||
if (sizeof($rra_list) > 0) {
|
||||
foreach ($rra_list as $rra) {
|
||||
?>
|
||||
<div align="center"><img src="graph_image.php?graphid=<?print $graphid;?>&rraid=<?print $rra[ID];?>" border="0" alt="cacti/rrdtool graph"></div>
|
||||
<div align="center"><strong><?print $rra[Name];?></strong> [<a href="graph.php?graphid=<?print $graphid;?>&rraid=<?print $rra[ID];?>&showinfo=true">source</a>]</div><br>
|
||||
<?
|
||||
}
|
||||
}
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
$section = "View Graphs";
|
||||
$guest_account = true;
|
||||
include ('include/auth.php');
|
||||
include_once ("include/rrd_functions.php");
|
||||
|
||||
|
||||
/* check to see if there are user specified vars */
|
||||
if ($graph_start != "") {
|
||||
$graph_data_array["use"] = true;
|
||||
$graph_data_array["graph_start"] = $args[graph_start];
|
||||
$graph_data_array["graph_height"] = $args[graph_height];
|
||||
$graph_data_array["graph_width"] = $args[graph_width];
|
||||
}
|
||||
|
||||
/* treat the legend separatly */
|
||||
if ($graph_nolegend != "") {
|
||||
$graph_data_array["graph_nolegend"] = $args[graph_nolegend];
|
||||
}
|
||||
|
||||
$graph_data_array["print_source"] = $args[showsource];
|
||||
print rrdtool_function_graph($args[graphid], $args[rraid], $graph_data_array);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,104 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
$section = "View Graphs";
|
||||
include ('include/auth.php');
|
||||
header("Cache-control: no-cache");
|
||||
include_once ("include/functions.php");
|
||||
include_once ('include/form.php');
|
||||
|
||||
if (isset($form[action])) { $action = $form[action]; } else { $action = $args[action]; }
|
||||
if (isset($form[ID])) { $id = $form[ID]; } else { $id = $args[id]; }
|
||||
|
||||
/* get current user */
|
||||
$current_user_id = GetCurrentUserID($HTTP_COOKIE_VARS["cactilogin"], $config["guest_user"]["value"]);
|
||||
|
||||
switch ($action) {
|
||||
case 'save':
|
||||
$sql_id = db_execute("replace into settings_graphs (id,userid,rraid,treeid, height,width,timespan,columnnumber,viewtype,listviewtype,pagerefresh)
|
||||
values ($id,$current_user_id,$form[RRAID],$form[TreeID],$form[Height],$form[Width],$form[TimeSpan],$form[ColumnNumber],$form[ViewType],$form[ListViewType],$form[PageRefresh])");
|
||||
|
||||
header ("Location: $referer");
|
||||
break;
|
||||
default:
|
||||
include_once ('include/top_graph_header.php');
|
||||
|
||||
/* find out if the current user has right s here */
|
||||
$gs = db_fetch_cell("select GraphSettings from auth_users where id=$current_user_id");
|
||||
|
||||
if (! $gs) {
|
||||
print "<strong><font size=\"+1\" color=\"FF0000\">YOU DO NOT HAVE RIGHTS TO CHANGE GRAPH SETTINGS</font></strong>"; exit;
|
||||
}
|
||||
|
||||
$settings = db_fetch_assoc("select * from settings_graphs where userid=$current_user_id");
|
||||
|
||||
if (getenv("HTTP_REFERER") == "") {
|
||||
$referer = $HTTP_REFERER;
|
||||
}else{
|
||||
$referer = getenv("HTTP_REFERER");
|
||||
}
|
||||
|
||||
DrawFormHeader("Graph Preview Settings","",false);
|
||||
|
||||
DrawFormItem("Height","The height of graphs created in preview mode.");
|
||||
DrawFormItemTextBox("Height",$settings[Height],"100","");
|
||||
|
||||
DrawFormItem("Width","The width of graphs created in preview mode.");
|
||||
DrawFormItemTextBox("Width",$settings[Width],"300","");
|
||||
|
||||
DrawFormItem("Timespan","The amount of time to represent on a graph created in preview mode (0 uses auto).");
|
||||
DrawFormItemTextBox("TimeSpan",$settings[TimeSpan],"60000","");
|
||||
|
||||
DrawFormItem("Default RRA","The default RRA to use when displaying graphs in preview mode.");
|
||||
DrawFormItemDropdownFromSQL("RRAID",db_fetch_assoc("select * from rrd_rra order by name"),"Name","ID",$settings[RRAID],"","");
|
||||
|
||||
DrawFormItem("Columns","The number of columns to display graphs in using preview mode.");
|
||||
DrawFormItemTextBox("ColumnNumber",$settings[ColumnNumber],"2","");
|
||||
|
||||
DrawFormItem("Page Refresh","The number of seconds between automatic page refreshes.");
|
||||
DrawFormItemTextBox("PageRefresh",$settings[PageRefresh],"300","");
|
||||
|
||||
DrawPlainFormHeader("List Settings");
|
||||
|
||||
DrawFormItem("View Settings","Options that govern how the graphs are displayed.");
|
||||
DrawFormItemRadioButton("ListViewType", $settings[ListViewType], "1", "Show a 4 column list of each graph and its RRA.", "1");
|
||||
DrawFormItemRadioButton("ListViewType", $settings[ListViewType], "2", "Show a 1 column list of each graph.", "1");
|
||||
|
||||
DrawPlainFormHeader("Hierarchical Settings");
|
||||
|
||||
DrawFormItem("Default Graph Hierarchy ","The default graph hierarchy to use when displaying graphs in tree mode.");
|
||||
DrawFormItemDropdownFromSQL("TreeID",db_fetch_assoc("select * from viewing_trees order by Title"),"Title","ID",$settings[TreeID],"","");
|
||||
|
||||
DrawFormItem("View Settings","Options that govern how the graphs are displayed.");
|
||||
DrawFormItemRadioButton("ViewType", $settings[ViewType], "1", "Show a preview of the graph.", "1");
|
||||
DrawFormItemRadioButton("ViewType", $settings[ViewType], "2", "Show a text-based listing of the graph.", "1");
|
||||
|
||||
DrawFormSaveButton();
|
||||
DrawFormItemHiddenIDField("ID",$settings[ID]);
|
||||
DrawFormItemHiddenIDField("referer", $referer);
|
||||
DrawFormFooter();
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
break;
|
||||
} ?>
|
||||
@@ -0,0 +1,191 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? header ("Cache-Control: no-cache, must-revalidate");
|
||||
header ("Pragma: no-cache");
|
||||
|
||||
session_start();
|
||||
|
||||
include_once ("include/rrd_functions.php");
|
||||
include_once ("include/functions.php");
|
||||
include ("include/top_graph_header.php");
|
||||
|
||||
$user_id = GetCurrentUserID($HTTP_SESSION_VARS['user_id'], $config["guest_user"]["value"]);
|
||||
|
||||
if (isset($hide) == true) {
|
||||
/* find out if the current user has rights here */
|
||||
$graph_settings = db_fetch_cell("select GraphSettings from auth_users where id=$user_id");
|
||||
|
||||
/* only update expand/contract info is this user has writes to keep their own settings */
|
||||
//if (mysql_num_rows($sql_id) != 0) {
|
||||
if ($graph_settings == "on") {
|
||||
db_execute("delete from settings_tree where treeitemid=$branch_id and userid=$user_id");
|
||||
db_execute("insert into settings_tree (treeitemid,userid,status) values ($branch_id,$user_id,$hide)");
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
/* if auth is enabled, get some basic info about this user so we know what they have
|
||||
rights to */
|
||||
if ($config["global_auth"]["value"] == "on") {
|
||||
$user = db_fetch_row("select GraphPolicy,ShowTree from auth_users where id=$user_id");
|
||||
|
||||
if (sizeof($user) == 0) {
|
||||
print "<strong><font size=\"+1\" color=\"FF0000\">CANNOT FIND USER!</font></strong>"; exit;
|
||||
}else{
|
||||
$show_tree_view = $user[ShowTree];
|
||||
//$show_list_view = mysql_result($sql_id_user, 0, "showlist");
|
||||
//$show_preview_view = mysql_result($sql_id_user, 0, "showpreview");
|
||||
}
|
||||
}else{
|
||||
/* if auth is turned off; obviously they have rights */
|
||||
$show_tree_view = "on";
|
||||
//$show_list_view = "on";
|
||||
//$show_preview_view = "on";
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'tree':
|
||||
if ($show_tree_view != "on") {
|
||||
print "<strong><font size=\"+1\" color=\"FF0000\">YOU DO NOT HAVE RIGHTS FOR TREE VIEW</font></strong>"; exit;
|
||||
}
|
||||
|
||||
include_once ('include/form.php');
|
||||
include_once ('include/tree_functions.php');
|
||||
|
||||
DrawMatrixTableBegin("97%");
|
||||
|
||||
if (!(isset($tree_id))) { $tree_id = 0; }
|
||||
|
||||
/* if cacti's builtin authentication is turned on then make sure to take
|
||||
graph permissions into account here. if a user does not have rights to a
|
||||
particular graph; do not show it. they will get an access denied message
|
||||
if they try and view the graph directly. */
|
||||
if ($config["global_auth"]["value"] == "on") {
|
||||
/* take tree permissions into account here, if the user does not have permission
|
||||
give an "access denied" message */
|
||||
$user = db_fetch_row("select UserID from auth_graph_hierarchy where hierarchyid=$tree_id and userid=" . GetCurrentUserID($HTTP_SESSION_VARS['user_id'],$config["guest_user"]["value"]));
|
||||
|
||||
if ($config["graph_policy"]["auth"] == "1") {
|
||||
if (sizeof($user) > 0) { $access_denied = true; }
|
||||
}elseif ($config["graph_policy"]["auth"] == "2") {
|
||||
if (sizeof($user) == 0) { $access_denied = true; }
|
||||
}
|
||||
|
||||
if ($access_denied == true) {
|
||||
print "<strong><font size=\"+1\" color=\"FF0000\">ACCESS DENIED</font></strong>"; exit;
|
||||
}
|
||||
|
||||
/* user is allowed to view this graph hierarchy; so lets move and create
|
||||
the SQL string that will show only the graphs that the user has rights to view
|
||||
in this tree */
|
||||
|
||||
if ($config["graph_policy"]["auth"] == "1") {
|
||||
$sql_where = "and ag.userid is null";
|
||||
}elseif ($config["graph_policy"]["auth"] == "2") {
|
||||
$sql_where = "and (ag.userid is not null or h.type=\\\"Heading\\\")";
|
||||
}
|
||||
|
||||
$array_tree["options"]["sql_string"] = 'select
|
||||
h.ID,h.GraphID,h.RRAID,h.Type,h.Title,h.OrderKey,
|
||||
g.Title as gtitle,
|
||||
st.Status,
|
||||
ag.graphid as aggraphid, ag.userid as aguserid
|
||||
from graph_hierarchy_items h
|
||||
left join rrd_graph g on h.graphid=g.id
|
||||
left join settings_tree st on (h.id=st.treeitemid and st.userid=' . $user_id . ')
|
||||
left join auth_graph ag on (g.id=ag.graphid and ag.userid=' . $user_id . ')
|
||||
where h.treeid=' . $tree_id . '
|
||||
and OrderKey like \"$search_key%\"
|
||||
' . $sql_where . '
|
||||
order by h.OrderKey';
|
||||
}else{
|
||||
$array_tree["options"]["sql_string"] = 'select
|
||||
h.ID,h.GraphID,h.RRAID,h.Type,h.Title,h.OrderKey,
|
||||
g.title as gtitle,
|
||||
r.name as rname,
|
||||
st.Status
|
||||
from graph_hierarchy_items h
|
||||
left join rrd_graph g on h.graphid=g.id
|
||||
left join rrd_rra r on h.rraid=r.id
|
||||
left join settings_tree st on (h.id=st.treeitemid and st.userid=' . $user_id . ')
|
||||
where h.treeid=' . $tree_id . '
|
||||
and OrderKey like \"$search_key%\"
|
||||
order by h.OrderKey';
|
||||
}
|
||||
|
||||
$array_tree["options"]["indent"] = "- ";
|
||||
$array_tree["options"]["start_branch"] = $start_branch;
|
||||
$array_tree["options"]["alternating_row_colors"] = false;
|
||||
$array_tree["options"]["tree_id"] = $tree_id;
|
||||
$array_tree["options"]["remove_action"] = '';
|
||||
$array_tree["options"]["create_margin"] = true;
|
||||
$array_tree["options"]["use_expand_contract"] = true;
|
||||
$array_tree["options"]["sql_type_column"] = "Type";
|
||||
|
||||
$array_tree["options"]["show_item"] = '<a href=\"graph_view.php?action=tree&tree_id=' .
|
||||
$tree_id . '&start_branch=' . $start_branch . '&hide=0&branch_id=" .
|
||||
$leaf[ID] . "\"><img src=\"images/show.gif\" border=\"0\"></a>';
|
||||
$array_tree["options"]["hide_item"] = '<a href=\"graph_view.php?action=tree&tree_id=' .
|
||||
$tree_id . '&start_branch=' . $start_branch . '&hide=1&branch_id=" .
|
||||
$leaf[ID] . "\"><img src=\"images/hide.gif\" border=\"0\"></a>';
|
||||
|
||||
$array_tree["item_can_have_children"]["Heading"] = true;
|
||||
$array_tree["item_td_code"]["Heading"] = 'bgcolor=\"#$colors[panel]\" colspan=\"' . $array_settings["preview"]["columnnumber"] . '\"';
|
||||
$array_tree["item_action"]["Heading"] = '<strong><a href=\"graph_view.php?action=tree&tree_id=' . $tree_id . '&start_branch=" . $leaf[ID] . "\">" . $leaf[Title] . "</a></strong>';
|
||||
|
||||
$array_tree["item_can_have_children"]["Graph"] = false;
|
||||
|
||||
switch ($array_settings["hierarchical"]["viewtype"]) {
|
||||
case "1":
|
||||
$array_tree["item_action"]["Graph"] = '<a href=\"graph.php?graphid=" . $leaf[GraphID] .
|
||||
"&rraid=all\"><img align=\"middle\" src=\"graph_image.php?graphid=" . $leaf[GraphID] .
|
||||
"&rraid=" . $leaf[RRAID] . "&graph_start=-' .
|
||||
$array_settings["preview"]["timespan"] . '&graph_height=' .
|
||||
$array_settings["preview"]["height"] . '&graph_width=' . $array_settings["preview"]["width"] .
|
||||
'&graph_nolegend=true\" border=\"0\" alt=\"" . $leaf[gtitle] . "\"></a>';
|
||||
$array_tree["item_columns"]["Graph"] = $array_settings["preview"]["columnnumber"];
|
||||
|
||||
break;
|
||||
case "2":
|
||||
$array_tree["item_action"]["Graph"] = '<a href=\"graph.php?graphid=" . $leaf[GraphID] .
|
||||
"&rraid=all\">" . $leaf[gtitle] . "</a>';
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixCustom("<td colspan=\"2\">");
|
||||
DrawMatrixCustom("<strong><a href=\"graph_view.php?action=tree&tree_id=$tree_id\">[root]</a> - $tree_name</strong><br><br>");
|
||||
DrawMatrixCustom("</td>");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
GrowTree($array_tree);
|
||||
|
||||
print '</td></tr>';
|
||||
DrawMatrixTableEnd();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
@@ -0,0 +1,458 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? $section = "Add/Edit Graphs"; include ('include/auth.php');
|
||||
header("Cache-control: no-cache");
|
||||
//include ('include/database.php');
|
||||
//include ('include/config.php');
|
||||
include_once ('include/form.php');
|
||||
|
||||
if (isset($form[action])) { $action = $form[action]; } else { $action = $args[action]; }
|
||||
if (isset($form[ID])) { $id = $form[ID]; } else { $id = $args[id]; }
|
||||
|
||||
$current_script_name = basename($HTTP_SERVER_VARS["SCRIPT_NAME"]);
|
||||
|
||||
function draw_main_form_select() {
|
||||
global $current_script_name, $colors;?>
|
||||
<tr bgcolor="#<?print $colors[panel];?>">
|
||||
</form>
|
||||
<form name="form_tree_id">
|
||||
<td valign="middle">
|
||||
<select name="cbo_tree_id" onChange="window.location=document.form_tree_id.cbo_tree_id.options[document.form_tree_id.cbo_tree_id.selectedIndex].value">
|
||||
<option value="<?print $current_script_name;?>"<?if (($_GET[action]=="") || (strstr($_GET[action],"graph"))) {?> selected<?}?>>Main Graph Management Page</option>
|
||||
<option value="<?print $current_script_name;?>?action=tree"<?if (strstr($_GET[action],"tree")){?> selected<?}?>>Graph Tree Configuration</option>
|
||||
</select>
|
||||
|
||||
<input type="image" src="images/button_go.gif" alt="Go" align="absmiddle">
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
<?}
|
||||
|
||||
function draw_graph_form_select() {
|
||||
global $current_script_name, $colors; ?>
|
||||
<tr bgcolor="#<?print $colors[panel];?>">
|
||||
<form name="form_graph_id">
|
||||
<td>
|
||||
<select name="cbo_graph_id" onChange="window.location=document.form_graph_id.cbo_graph_id.options[document.form_graph_id.cbo_graph_id.selectedIndex].value">
|
||||
<option value="<?print $current_script_name;?>"<?if (($_GET[action]=="") || (strstr($_GET[action],"graph"))) {?> selected<?}?>>Graph Configuration</option>
|
||||
<option value="<?print $current_script_name;?>?action=graph"<?if (strstr($_GET[action],"graph")){?> selected<?}?>>Custom Graph Item Configuration</option>
|
||||
</select>
|
||||
|
||||
<input type="image" src="images/button_go.gif" alt="Go" align="absmiddle">
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
<?}
|
||||
|
||||
switch ($action) {
|
||||
case 'graph_duplicate':
|
||||
include_once ('include/utility_functions.php');
|
||||
|
||||
DuplicateGraph($id);
|
||||
|
||||
header ("Location: graphs.php");
|
||||
break;
|
||||
case 'graph_save':
|
||||
if ($lowerlimit==""){$lowerlimit=0;} /* no nulls; zeros */
|
||||
if ($upperlimit==""){$upperlimit=0;} /* no nulls; zeros */
|
||||
if ($unitexponentvalue==""){$unitexponentvalue=0;} /* no nulls; zeros */
|
||||
|
||||
if ($id != 0) {
|
||||
$grouping = db_fetch_cell("select Grouping from rrd_graph where id=$id");
|
||||
|
||||
if ($grouping != $grouping) { /* the value has changed */
|
||||
include_once ('include/utility_functions.php');
|
||||
|
||||
if ($grouping == "on") {
|
||||
group_graph_items($id);
|
||||
}else{
|
||||
ungroup_graph_items($id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
db_execute("replace into rrd_graph (id,imageformatid,title,height,width,
|
||||
upperlimit,lowerlimit,verticallabel,autoscale,autopadding,autoscaleopts,rigid,
|
||||
basevalue,grouping,export,unitvalue,unitexponentvalue,autoscalelog) values ($id,$imageformatid,
|
||||
\"$title\",$height,$width,$upperlimit,$lowerlimit,\"$verticallabel\",\"$autoscale\",
|
||||
\"$autopadding\",$autoscaleopts,\"$rigid\",$basevalue,\"$grouping\",\"$export\",
|
||||
\"$unitvalue\",$unitexponentvalue,\"$autoscalelog\")");
|
||||
|
||||
if ($id == 0) {
|
||||
/* get graphid if this is a new save */
|
||||
$db_id = db_fetch_cell("select LAST_INSERT_ID()");
|
||||
|
||||
if ($db_id != 0) {
|
||||
$id = $db_id;
|
||||
}
|
||||
}
|
||||
|
||||
header ("Location: graphs.php");
|
||||
break;
|
||||
case 'graph_remove':
|
||||
if (($config["remove_verification"]["value"] == "on") && ($confirm != "yes")) {
|
||||
include_once ('include/top_header.php');
|
||||
DrawConfirmForm("Are You Sure?", "Are you sure you want to delete this graph?", $current_script_name, "?action=remove&id=$id");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (($config["remove_verification"]["value"] == "") || ($confirm == "yes")) {
|
||||
db_execute("delete from rrd_graph where id=$id");
|
||||
db_execute("delete from rrd_graph_item where graphid=$id");
|
||||
db_execute("delete from graph_hierarchy_items where graphid=$id");
|
||||
db_execute("delete from auth_graph where graphid=$id");
|
||||
}
|
||||
|
||||
header ("Location: graphs.php");
|
||||
break;
|
||||
case 'graph_edit':
|
||||
include_once ("include/top_header.php");
|
||||
$title_text = "Graph Management [edit]"; $add_text = "$current_script_name?action=graph_edit";
|
||||
include_once ("include/top_table_header.php");
|
||||
|
||||
draw_main_form_select();
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2" class="textSubHeaderDark" bgcolor="#00438C">Graph Configuration</td>
|
||||
</tr>
|
||||
<?
|
||||
|
||||
draw_graph_form_select();
|
||||
|
||||
if (isset($id)) {
|
||||
$graphs = db_fetch_row("select * from rrd_graph where id=$id", $cnn_id);
|
||||
}else{
|
||||
unset($graphs);
|
||||
}
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" bgcolor="#00438C">
|
||||
<img src="images/transparent_line.gif" width="170" height="1" border="0"><br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],0); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Title</font><br>
|
||||
The name that is printed on the graph.
|
||||
</td>
|
||||
<?DrawFormItemTextBox("Title",$graphs[Title],"","50", "40");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],1); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Image Format</font><br>
|
||||
The type of graph that is generated; GIF or PNG.
|
||||
</td>
|
||||
<?DrawFormItemDropdownFromSQL("ImageFormatID",$cnn_id,"select * from def_image_type order by name","Name","ID",$graphs[ImageFormatID],"","1");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],0); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Height</font><br>
|
||||
The height (in pixels) that the graph is.
|
||||
</td>
|
||||
<?DrawFormItemTextBox("Height",$graphs[Height],"","50", "40");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],0); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Width</font><br>
|
||||
The width (in pixels) that the graph is.
|
||||
</td>
|
||||
<?DrawFormItemTextBox("Width",$graphs[Width],"","50", "40");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],1); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Auto Scale</font><br>
|
||||
Auto scale vertical data instead of defining an upper and lower limit. Note: if this
|
||||
is check both the Upper and Lower limit will be ignored.
|
||||
</td>
|
||||
<td>
|
||||
<?
|
||||
DrawStrippedFormItemCheckBox("Rigid",$graphs[Rigid],"Use Rigid Boundaries Mode (--rigid)","",true);
|
||||
DrawStrippedFormItemCheckBox("AutoScale",$graphs[AutoScale],"Auto Scale","on",true);
|
||||
DrawStrippedFormItemRadioButton("AutoScaleOpts", $graphs[AutoScaleOpts], "1", "Use --alt-autoscale","2",true);
|
||||
DrawStrippedFormItemRadioButton("AutoScaleOpts", $graphs[AutoScaleOpts], "2", "Use --alt-autoscale-max","2",true);
|
||||
DrawStrippedFormItemCheckBox("AutoScaleLog",$graphs[AutoScaleLog],"Logarithmic Auto Scaling (--logarithmic)","",true);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],0); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Auto Padding</font><br>
|
||||
Pad text so that legend and graph data always line up. Note: this could cause graphs
|
||||
to take longer to render because of the larger overhead. Also Auto Padding may not
|
||||
be accurate on all types of graphs, consistant labeling usually helps.
|
||||
</td>
|
||||
<?DrawFormItemCheckBox("AutoPadding",$graphs[AutoPadding],"Auto Padding","");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],1); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Allow Grouping</font><br>
|
||||
This will enable you to "group" items of your graph together for eaier manipulation.
|
||||
Note when you check this box and save, cacti will automatically group the items in
|
||||
your graph; you may have to re-group part of the graph manually.
|
||||
</td>
|
||||
<?DrawFormItemCheckBox("Grouping",$graphs[Grouping],"Allow Grouping","on");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],0); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Allow Graph Export</font><br>
|
||||
Choose whether this graph will be included in the static html/png export if you use
|
||||
cacti's export feature.
|
||||
</td>
|
||||
<?DrawFormItemCheckBox("Export",$graphs[Export],"Allow Graph Export","on");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],1); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Upper Limit</font><br>
|
||||
The maximum vertical value for the rrd graph.
|
||||
</td>
|
||||
<?DrawFormItemTextBox("UpperLimit",$graphs[UpperLimit],"0","50", "40");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],0); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Lower Limit</font><br>
|
||||
The minimum vertical value for the rrd graph.
|
||||
</td>
|
||||
<?DrawFormItemTextBox("LowerLimit",$graphs[LowerLimit],"0","50", "40");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],1); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Base Value</font><br>
|
||||
Should be set to 1024 for memory and 1000 for traffic measurements.
|
||||
</td>
|
||||
<?DrawFormItemTextBox("BaseValue",$graphs[BaseValue],"1000","50", "40");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],0); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Unit Value</font><br>
|
||||
(--unit) Sets the exponent value on the Y-axis for numbers. Note: This option was
|
||||
recently added in rrdtool 1.0.36.
|
||||
</td>
|
||||
<?DrawFormItemTextBox("UnitValue",$graphs[UnitValue],"","50", "40");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],1); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Unit Exponent Value</font><br>
|
||||
What unit cacti should use on the Y-axis. Use 3 to display everything in 'k' or -6
|
||||
to display everything in 'u' (micro).
|
||||
</td>
|
||||
<?DrawFormItemTextBox("UnitExponentValue",$graphs[UnitExponentValue],"","50", "40");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],0); ?>
|
||||
<td width="50%">
|
||||
<font class="textEditTitle">Vertical Label</font><br>
|
||||
The label vertically printed to the left of the graph.
|
||||
</td>
|
||||
<?DrawFormItemTextBox("VerticalLabel",$graphs[VerticalLabel],"","50", "40");?>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="#FFFFFF">
|
||||
<td colspan="2" align="right" background="images/blue_line.gif">
|
||||
<?DrawFormSaveButton("save");?>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
|
||||
DrawFormItemHiddenIDField("id",$id);
|
||||
DrawFormFooter();
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
case 'tree_edit':
|
||||
include_once ("include/top_header.php");
|
||||
$title_text = "Graph Management - Graph Tree Configuration [edit]"; $add_text = "$current_script_name?action=edit_tree";
|
||||
include_once ("include/top_table_header.php");
|
||||
|
||||
if (isset($id)) {
|
||||
$graph_tree = db_fetch_row("select * from rrd_graph_tree where id=$_GET[id]", $cnn_id);
|
||||
}else{
|
||||
unset($graph_tree);
|
||||
}
|
||||
|
||||
draw_main_form_select();
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2" bgcolor="#00438C">
|
||||
<img src="images/transparent_line.gif" width="170" height="1" border="0"><br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],0); ?>
|
||||
<td width="40%">
|
||||
<font class="textEditTitle">Tree Name</font><br>
|
||||
Enter a name for this tree.
|
||||
</td>
|
||||
<?DrawFormItemTextBox("name",$graph_tree[name],"","50", "40");?>
|
||||
</tr>
|
||||
|
||||
<?DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],1); ?>
|
||||
<td width="40%">
|
||||
<font class="textEditTitle">Show as Tab</font><br>
|
||||
Whether to show this tree as a tab on the graph management page.
|
||||
</td>
|
||||
<?DrawFormItemCheckBox("show_tab",$graph_tree[show_tab],"Show as Tab","",true);?>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="#<?print $colors[form_alternate2];?>">
|
||||
<td colspan="2" align="right" background="images/blue_line.gif">
|
||||
<?DrawFormSaveButton("save");?>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
include_once ("include/bottom_table_footer.php");
|
||||
|
||||
break;
|
||||
case 'tree':
|
||||
include_once ("include/top_header.php");
|
||||
$title_text = "Graph Management - Graph Tree Configuration"; $add_text = "$current_script_name?action=tree_edit";
|
||||
include_once ("include/top_table_header.php");
|
||||
|
||||
draw_main_form_select();
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" bgcolor="#00438C">
|
||||
<img src="images/transparent_line.gif" width="170" height="1" border="0"><br>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderItem("Tree Name",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Display as Tab",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
$graph_tree_list = db_fetch_assoc("select * from rrd_graph_tree", $cnn_id);
|
||||
|
||||
foreach ($graph_tree_list as $graph_tree) {
|
||||
DrawMatrixRowAlternateColorBegin($colors[alternate],$colors[light],$i);
|
||||
?>
|
||||
<td>
|
||||
<a class="linkEditMain" href="graphs.php?action=tree_edit&id=<?print $graph_tree[id];?>"><?print $graph_tree[name];?></a>
|
||||
</td>
|
||||
<td>
|
||||
<?if ($graph_tree[show_tab] == "on") { print "Yes"; }else{ print "No"; }?>
|
||||
</td>
|
||||
<td width="1%" align="right">
|
||||
<a href="graphs.php?action=tree_remove&id=<?print $graph_tree[id];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
$i++;
|
||||
}
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
include_once ("include/bottom_table_footer.php");
|
||||
|
||||
break;
|
||||
default:
|
||||
include_once ("include/top_header.php");
|
||||
$title_text = "Graph Management"; $add_text = "$current_script_name?action=graph_edit";
|
||||
include_once ("include/top_table_header.php");
|
||||
|
||||
draw_main_form_select();
|
||||
?>
|
||||
|
||||
|
||||
<tr height="33">
|
||||
<td valign="bottom" colspan="2" background="images/tab_back.gif">
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td nowrap class="textTab" align="center" background="images/tab_middle.gif">
|
||||
<img src="images/tab_left.gif" border="0" align="absmiddle">Core Routers <img src="images/delete_icon_dark_back.gif" border="0" alt="Remove this Tree's Tab" align="absmiddle"><img src="images/tab_right.gif" border="0" align="absmiddle">
|
||||
</td>
|
||||
<td nowrap class="textTab" align="center" background="images/tab_middle.gif">
|
||||
<img src="images/tab_left.gif" border="0" align="absmiddle">Catalyst Fabric <img src="images/delete_icon_dark_back.gif" border="0" alt="Remove this Tree's Tab" align="absmiddle"><img src="images/tab_right.gif" border="0" align="absmiddle">
|
||||
</td>
|
||||
<td nowrap class="textTab" align="center" background="images/tab_middle.gif">
|
||||
<img src="images/tab_left.gif" border="0" align="absmiddle">Server Farm (1) <img src="images/delete_icon_dark_back.gif" border="0" alt="Remove this Tree's Tab" align="absmiddle"><img src="images/tab_right.gif" border="0" align="absmiddle">
|
||||
</td>
|
||||
<td nowrap class="textTab" align="center" background="images/tab_middle.gif">
|
||||
<img src="images/tab_left.gif" border="0" align="absmiddle">Web Server <img src="images/delete_icon_dark_back.gif" border="0" alt="Remove this Tree's Tab" align="absmiddle"><img src="images/tab_right.gif" border="0" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<form name="form_graph_tree">
|
||||
<td align="right" valign="middle" background="images/tab_back.gif">
|
||||
<select class="cboSmall" name="cbo_graph_tree" onChange="window.location=document.form_graph_tree.cbo_graph_tree.options[document.form_graph_tree.cbo_graph_tree.selectedIndex].value">
|
||||
<option value="<?print $current_script_name;?>" selected>Core Routers</option>
|
||||
<option value="<?print $current_script_name;?>">Catalyst Fabric</option>
|
||||
<option value="<?print $current_script_name;?>">Server Farm (1)</option>
|
||||
<option value="<?print $current_script_name;?>">Web Server</option>
|
||||
</select>
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
|
||||
<?
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderItem("Graph Title",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Size",$colors[panel],$$colors[panel_text]);
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
$graph_list = db_fetch_assoc("select ID,Height,Width,Title from rrd_graph order by Title", $cnn_id);
|
||||
|
||||
foreach ($graph_list as $graph) {
|
||||
DrawMatrixRowAlternateColorBegin($colors[alternate],$colors[light],$i);
|
||||
?>
|
||||
<td>
|
||||
<a class="linkEditMain" href="graphs.php?action=graph_edit&id=<?print $graph[ID];?>"><?print $graph[Title];?></a>
|
||||
</td>
|
||||
<td>
|
||||
<?print $graph[Height];?>x<?print $graph[Width];?>
|
||||
</td>
|
||||
<td width="1%" align="right">
|
||||
<a href="graphs.php?action=graph_remove&id=<?print $graph[ID];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
$i++;
|
||||
}
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
include_once ("include/bottom_table_footer.php");
|
||||
|
||||
break;
|
||||
} ?>
|
||||
@@ -0,0 +1,517 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? $section = "Add/Edit Graphs";
|
||||
include ('include/auth.php');
|
||||
header("Cache-control: no-cache");
|
||||
include_once ('include/utility_functions.php');
|
||||
include_once ('include/form.php');
|
||||
|
||||
if ($form[action]) { $action = $form[action]; } else { $action = $args[action]; }
|
||||
if ($form[ID]) { $id = $form[ID]; } else { $id = $args[id]; }
|
||||
if ($form[GID]) { $gid = $form[GID]; } else { $gid = $args[gid]; }
|
||||
if ($form[TID]) { $tid = $form[TID]; } else { $tid = $args[tid]; }
|
||||
|
||||
/* if the user wants to change the grouping status of this
|
||||
graph, do it here */
|
||||
if (isset($HTTP_GET_VARS["graph_grouping"]) == true) {
|
||||
$grouping = db_fetch_row("select Grouping from rrd_graph where id=$args[id]");
|
||||
$current_graph_grouping = $grouping[Grouping];
|
||||
|
||||
switch ($graph_grouping) {
|
||||
case 'on':
|
||||
/* make sure graph grouping is already OFF */
|
||||
if ($current_graph_grouping == "") {
|
||||
group_graph_items($args[id]);
|
||||
db_execute("update rrd_graph set grouping=\"on\" where id=$args[id]");
|
||||
}
|
||||
break;
|
||||
case 'off':
|
||||
/* make sure graph grouping is already ON */
|
||||
if ($current_graph_grouping == "on") {
|
||||
ungroup_graph_items($id);
|
||||
db_execute("update rrd_graph set grouping=\"\" where id=$id");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
header ("Location: graphs_items.php?id=$id"); exit;
|
||||
}
|
||||
|
||||
if (isset($HTTP_GET_VARS["graph_preview"]) == true) {
|
||||
switch ($HTTP_GET_VARS["graph_preview"]) {
|
||||
case 'on':
|
||||
header ("Set-Cookie: graph_preview=on; path=/;");
|
||||
break;
|
||||
case 'off':
|
||||
header ("Set-Cookie: graph_preview=off; path=/;");
|
||||
break;
|
||||
}
|
||||
|
||||
header ("Location: graphs_items.php?id=$id"); exit;
|
||||
}
|
||||
|
||||
if (isset($HTTP_GET_VARS["graph_output_preview"]) == true) {
|
||||
switch ($HTTP_GET_VARS["graph_output_preview"]) {
|
||||
case 'on':
|
||||
header ("Set-Cookie: graph_output_preview=on; path=/;");
|
||||
break;
|
||||
case 'off':
|
||||
header ("Set-Cookie: graph_output_preview=off; path=/;");
|
||||
break;
|
||||
}
|
||||
|
||||
header ("Location: graphs_items.php?id=$id"); exit;
|
||||
}
|
||||
|
||||
$graph_preview = $HTTP_COOKIE_VARS["graph_preview"];
|
||||
$graph_output_preview = $HTTP_COOKIE_VARS["graph_output_preview"];
|
||||
|
||||
switch ($action) {
|
||||
case 'save':
|
||||
include_once ('include/functions.php');
|
||||
if ($id == '') { $id = '0'; }
|
||||
|
||||
$sql_id = db_execute("replace into rrd_graph_item (id,dsid,colorid,textformat,
|
||||
sequence,graphid,graphtypeid,consolidationfunction,hardreturn,cdefid,value,sequenceparent,
|
||||
parent) values ($id,$form[DSID],$form[ColorID],\"$form[TextFormat]\",$form[Sequence],$gid,$form[GraphTypeID],
|
||||
$form[ConsolidationFunction],\"$form[HardReturn]\",$form[CDEFID],\"$form[Value]\",$form[SequenceParent],$form[Parent])");
|
||||
|
||||
if ($id == 0) {
|
||||
/* get graphid if this is a new save */
|
||||
$tmp = db_fetch_row("select LAST_INSERT_ID() as ID");
|
||||
|
||||
if ($tmp[ID] != 0) {
|
||||
/* we are using new_id so only the next two queries so the
|
||||
sequence code does not know about it...therefore forcing a new
|
||||
sequence number if this is a new save */
|
||||
$new_id = $tmp[ID];
|
||||
}
|
||||
}else{
|
||||
$new_id = $id;
|
||||
}
|
||||
|
||||
$grouping = db_fetch_cell("select grouping from rrd_graph where id=$gid");
|
||||
$item = db_fetch_row("select t.Name from rrd_graph_item i left join def_graph_type t
|
||||
on i.graphtypeid=t.id where i.id=$new_id");
|
||||
|
||||
if ($grouping == "on") {
|
||||
if ($old_graphtypeid != "0") {
|
||||
/* get the name of the LAST graph item type */
|
||||
$old_graphtype = db_fetch_cell("select name from def_graph_type where id=$old_graphtypeid");
|
||||
}
|
||||
|
||||
if ($item[Name] != "GPRINT") {
|
||||
/* graph type changed; force a new sequence id */
|
||||
if ($old_graphtype == "GPRINT") { $id = 0; }
|
||||
|
||||
$max_sequence = GetSequence($id, "sequenceparent", "rrd_graph_item", "graphid", $gid);
|
||||
|
||||
db_execute("update rrd_graph_item set sequenceparent=$max_sequence where id=$new_id");
|
||||
db_execute("update rrd_graph_item set parent=$new_id where id=$new_id");
|
||||
|
||||
/* this is a save on a parent item: if this parent has children with all of the same
|
||||
data source, then update the data source change in the parent to the children as
|
||||
well. this saves the user some clicks */
|
||||
$sql_id = db_fetch_assoc("select dsid from rrd_graph_item where parent=$new_id and parent!=id group by dsid");
|
||||
|
||||
if (sizeof($sql_id) == "1") {
|
||||
/* there is only one data source in use for this group */
|
||||
mysql_query("update rrd_graph_item set dsid=$dsid where parent=$new_id");
|
||||
}
|
||||
}else{
|
||||
/* if the group changes, force a new sequence */
|
||||
if ($old_parent != $parent) { $id = 0; }
|
||||
|
||||
if ($old_graphtype != "GPRINT") {
|
||||
/* graph type changed; force a new sequence id */
|
||||
$id = 0;
|
||||
|
||||
/* if the old item was a parent and now it is a child (GPRINT), we must find
|
||||
a new parent for this child. cacti says... go with the last available parent... */
|
||||
$parents = db_fetch_row("select SequenceParent,Parent from rrd_graph_item i left join def_graph_type t
|
||||
on i.graphtypeid=t.id where i.graphid=$gid and (t.name = 'AREA' or t.name =
|
||||
'STACK' or t.name = 'LINE1' or t.name = 'LINE2' or t.name = 'LINE3')
|
||||
order by i.sequenceparent desc");
|
||||
if (sizeof($parents) != "0") { $parent = $parents[Parent]; }
|
||||
|
||||
/* also... what if that old parent had children... orfans need homes as well */
|
||||
$items_list = db_fetch_assoc("select ID from rrd_graph_item where parent=$new_id");
|
||||
|
||||
foreach ($items_list as $items) {
|
||||
$sequenceparent = $parents[SequenceParent];
|
||||
$max_sequence = GetSequence(0, "sequence", "rrd_graph_item", "graphid", "$gid and parent=$parent");
|
||||
|
||||
db_execute("update rrd_graph_item set sequence=$max_sequence,
|
||||
sequenceparent=$sequenceparent,
|
||||
parent=$parent
|
||||
where id=" . $items[ID]);
|
||||
}
|
||||
}
|
||||
|
||||
$max_sequence = GetSequence($id, "sequence", "rrd_graph_item", "graphid", "$gid and parent=$parent");
|
||||
|
||||
if ($parent != 0) {
|
||||
$sequenceparent = db_fetch_cell("select sequenceparent from rrd_graph_item where id=$parent");
|
||||
}
|
||||
|
||||
db_execute("update rrd_graph_item set sequence=$max_sequence where id=$new_id", $cnn_id);
|
||||
db_execute("update rrd_graph_item set sequenceparent=$sequenceparent where id=$new_id", $cnn_id);
|
||||
}
|
||||
}else{
|
||||
$max_sequence = GetSequence($id, "sequence", "rrd_graph_item", "graphid", $gid);
|
||||
|
||||
db_execute("update rrd_graph_item set sequence=$max_sequence where id=$new_id", $cnn_id);
|
||||
}
|
||||
|
||||
header ("Location: graphs_items.php?id=$gid");
|
||||
break;
|
||||
case 'remove':
|
||||
$grouping = db_fetch_cell("select Grouping from rrd_graph where id=$gid");
|
||||
$item = db_fetch_row("select t.Name from rrd_graph_item i left join def_graph_type t
|
||||
on i.graphtypeid=t.id where i.id=$id");
|
||||
|
||||
if ($grouping == "on") {
|
||||
if ($item[Name] != "GPRINT") {
|
||||
db_execute("delete from rrd_graph_item where parent=$tid");
|
||||
}else{
|
||||
db_execute("delete from rrd_graph_item where id=$id");
|
||||
}
|
||||
}else{
|
||||
db_execute("delete from rrd_graph_item where id=$id");
|
||||
}
|
||||
|
||||
header ("Location: graphs_items.php?id=$gid&graph_preview=$graph_preview&graph_output_preview=$graph_output_preview");
|
||||
break;
|
||||
case 'movedown':
|
||||
include_once ('include/functions.php');
|
||||
|
||||
$grouping = db_fetch_row("select Grouping from rrd_graph where id=$gid");
|
||||
$item = db_fetch_row("select t.Name from rrd_graph_item i left join def_graph_type t
|
||||
on i.graphtypeid=t.id where i.id=$id");
|
||||
|
||||
if ($grouping[Grouping] == "on") {
|
||||
if ($item[Name] != "GPRINT") {
|
||||
$sequence_column = "sequenceparent";
|
||||
$sequence_query = "$gid";
|
||||
} else {
|
||||
$sequence_column = "sequence";
|
||||
$sequence_query = "$gid and parent=$tid";
|
||||
}
|
||||
}else{
|
||||
$sequence_column = "sequence";
|
||||
$sequence_query = "$gid";
|
||||
}
|
||||
|
||||
$next_item = GetNextItem("rrd_graph_item",$sequence_column,$id,"graphid",$sequence_query);
|
||||
|
||||
if ($sequence_column == "sequenceparent") { /* group order */
|
||||
# print "here1<BR>\n";
|
||||
$sql = "select Parent from rrd_graph_item where $sequence_column=$next_item and graphid=$gid";
|
||||
# print "$sql<BR>\n";
|
||||
$parent = db_fetch_row($sql);
|
||||
$seq = db_fetch_row("select $sequence_column from rrd_graph_item where id=$id");
|
||||
$sql = "update rrd_graph_item set $sequence_column=$next_item where parent=$id";
|
||||
# print "$sql<BR>\n";
|
||||
db_execute($sql);
|
||||
$sql = "update rrd_graph_item set $sequence_column=$seq[$sequence_column] where parent=$parent[Parent]";
|
||||
# print "$sql<BR>\n";
|
||||
db_execute($sql);
|
||||
} elseif ($sequence_column == "sequence") { /* item order */
|
||||
$id = db_fetch_row("select ID from rrd_graph_item where $sequence_column=$next_item and graphid=$gid and parent=$tid");
|
||||
$seq = db_fetch_row("select $sequence_column from rrd_graph_item where id=$id");
|
||||
db_execute("update rrd_graph_item set $sequence_column=$next_item where id=$id");
|
||||
db_execute("update rrd_graph_item set $sequence_column=$seq[$sequence_column] where id=$id[ID]");
|
||||
}
|
||||
|
||||
header ("Location: graphs_items.php?id=$gid&graph_preview=$graph_preview&graph_output_preview=$graph_output_preview"); exit;
|
||||
break;
|
||||
case 'moveup':
|
||||
include_once ('include/functions.php');
|
||||
|
||||
$grouping = db_fetch_row("select Grouping from rrd_graph where id=$gid");
|
||||
$item = db_fetch_row("select t.Name from rrd_graph_item i left join def_graph_type t
|
||||
on i.graphtypeid=t.id where i.id=$id");
|
||||
|
||||
if ($grouping[Grouping] == "on") {
|
||||
if ($item[Name] != "GPRINT") {
|
||||
$sequence_column = "sequenceparent";
|
||||
$sequence_query = "$gid";
|
||||
}else{
|
||||
$sequence_column = "sequence";
|
||||
$sequence_query = "$gid and parent=$tid";
|
||||
}
|
||||
}else{
|
||||
$sequence_column = "sequence";
|
||||
$sequence_query = "$gid";
|
||||
}
|
||||
|
||||
$last_item = GetLastItem($cnn_id,"rrd_graph_item",$sequence_column,$id,"graphid",$sequence_query);
|
||||
|
||||
if ($sequence_column == "sequenceparent") { /* group order */
|
||||
$parent = db_fetch_row("select Parent from rrd_graph_item where $sequence_column=$last_item and graphid=$gid");
|
||||
$seq = db_fetch_row("select $sequence_column from rrd_graph_item where id=$id");
|
||||
db_execute("update rrd_graph_item set $sequence_column=$last_item where parent=$id");
|
||||
db_execute("update rrd_graph_item set $sequence_column=$seq[$sequence_column] where parent=$parent[Parent]");
|
||||
}elseif ($sequence_column == "sequence") { /* item order */
|
||||
$id = db_fetch_row("select ID from rrd_graph_item where $sequence_column=$last_item and graphid=$gid and parent=$tid");
|
||||
$seq = db_fetch_row("select $sequence_column from rrd_graph_item where id=$id");
|
||||
db_execute("update rrd_graph_item set $sequence_column=$last_item where id=$id");
|
||||
db_execute("update rrd_graph_item set $sequence_column=$seq[$sequence_column] where id=$id[ID]");
|
||||
}
|
||||
|
||||
header ("Location: graphs_items.php?id=$gid&graph_preview=$graph_preview&graph_output_preview=$graph_output_preview"); exit;
|
||||
break;
|
||||
case 'edit':
|
||||
include_once ('include/top_header.php');
|
||||
|
||||
/* get current graph name for the header text */
|
||||
$title = db_fetch_row("select Title,Grouping from rrd_graph where id=$gid");
|
||||
$graph_title = $title[Title];
|
||||
|
||||
if ($id != "") {
|
||||
$item = db_fetch_row("select * from rrd_graph_item where id=$id");
|
||||
$old_parent = $item[Parent];
|
||||
}
|
||||
|
||||
DrawFormHeader("Graph Item Configuration for: $graph_title","",false);
|
||||
|
||||
/* by default, select the LAST DS chosen to make everyone's lives easier */
|
||||
$default = db_fetch_row("select * from rrd_graph_item where graphid=$gid order by sequenceparent DESC,sequence DESC");
|
||||
|
||||
if (sizeof($default) > 0) {
|
||||
$default_item = $default[SDID];
|
||||
} else {
|
||||
$default_item = 0;
|
||||
}
|
||||
|
||||
DrawFormItem("Data Source","The data source to use for this graph item; not used for COMMENT fields.");
|
||||
DrawFormItemDropdownFromSQL("DSID",db_fetch_assoc("select ID,Name from rrd_ds where isparent=0 order by name"),
|
||||
"Name","ID","","None",$default_item);
|
||||
|
||||
if ($title[Grouping] == "on") {
|
||||
/* default item (last item) */
|
||||
$types = db_fetch_assoc("select CONCAT_WS('',t.name,': ',d.name) as Name,
|
||||
i.ID from rrd_graph_item i left join def_graph_type t on i.graphtypeid=t.id left join
|
||||
rrd_ds d on i.dsid=d.id where graphid=$gid and (t.name = 'AREA' or t.name = 'STACK' or t.name = 'LINE1'
|
||||
or t.name = 'LINE2' or t.name = 'LINE3') order by i.sequenceparent DESC");
|
||||
|
||||
if (sizeof($types) == 0) {
|
||||
DrawFormItemHiddenIDField("Parent","0");
|
||||
} else {
|
||||
$default_item = $types[0][ID];
|
||||
|
||||
DrawFormItem("Item Group","Choose which graph item this GPRINT is associated with. NOTE: This field
|
||||
will be ignored if it is not a GPRINT.");
|
||||
DrawFormItemDropdownFromSQL("Parent",$types,"Name","ID","","",$default_item);
|
||||
}
|
||||
} else {
|
||||
DrawFormItemHiddenIDField("Parent","0");
|
||||
}
|
||||
|
||||
DrawFormItem("Color","The color that is used for this item; not used for COMMENT fields.");
|
||||
DrawFormItemColorSelect("ColorID",$item[ColorID],"None","0");
|
||||
|
||||
DrawFormItem("Graph Item Type","How data for this item is displayed.");
|
||||
DrawFormItemDropdownFromSQL("GraphTypeID",db_fetch_assoc("select ID,Name from def_graph_type order by name"),"Name","ID","","","");
|
||||
|
||||
DrawFormItem("Consolidation Function","How data is to be represented on the graph.");
|
||||
DrawFormItemDropdownFromSQL("ConsolidationFunction",db_fetch_assoc("select * from def_cf order by name"),"Name","ID","","","");
|
||||
|
||||
DrawFormItem("CDEF Function","A CDEF Function to apply to this item on the graph.");
|
||||
DrawFormItemDropdownFromSQL("CDEFID",db_fetch_assoc("select * from rrd_ds_cdef order by name"),"Name","ID","None","","");
|
||||
|
||||
DrawFormItem("Value","For use with VRULE and HRULE, <i>numbers only</i>, and<br> staggered CDEF Calculations, format start=<<i>Data Source Position</i>>&skip<<i>Skip Count</i>>.");
|
||||
DrawFormItemTextBox("Value",$item[Value],"","");
|
||||
|
||||
DrawFormItem("Text Format","The text of the comment or legend, input and output keywords are allowed.");
|
||||
DrawFormItemTextBox("TextFormat",$item[TextFormat],"","");
|
||||
DrawFormItemCheckBox("HardReturn",$item[HardReturn],"Insert Hard Return","");
|
||||
|
||||
DrawFormSaveButton();
|
||||
DrawFormItemHiddenIDField("GID",$gid);
|
||||
DrawFormItemHiddenIDField("SequenceParent",$item[SequenceParent]);
|
||||
DrawFormItemHiddenIDField("Sequence",$item[Sequence]);
|
||||
DrawFormItemHiddenIDField("old_parent",$old_parent);
|
||||
DrawFormItemHiddenIDField("ID",$id);
|
||||
DrawFormFooter();
|
||||
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
default:
|
||||
include_once ('include/top_header.php');
|
||||
include_once ('include/rrd_functions.php');
|
||||
|
||||
/* get current graph name for the header text */
|
||||
$graph = db_fetch_row("select Title,Grouping from rrd_graph where id=$id");
|
||||
$graph_title = $graph[Title];
|
||||
$allow_grouping = $grouping[Grouping];
|
||||
|
||||
DrawMatrixTableBegin("97%");
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderTop("Graph Items for: $graph_title",$colors[dark_bar],"","6");
|
||||
DrawMatrixHeaderAdd($colors[dark_bar],"","graphs_items.php?action=edit&gid=$id");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
?>
|
||||
<td bgcolor="#<?print $colors[panel];?>" colspan="7">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td rowspan="2" valign="top">
|
||||
<a href="graphs_items.php?id=<?print $id;?>&graph_preview=<?if ($graph_preview == "on") { print "off"; }else{ print "on"; }?>">Turn Graph Preview <?if ($graph_preview == "on") { print "<strong>Off</strong>"; }else{ print "<strong>On</strong>"; }?></a><br>
|
||||
<a href="graphs_items.php?id=<?print $id;?>&graph_output_preview=<?if ($graph_output_preview == "on") { print "off"; }else{ print "on"; }?>">Turn Graph Output Preview <?if ($graph_output_preview == "on") { print "<strong>Off</strong>"; }else{ print "<strong>On</strong>"; }?></a><br>
|
||||
<a href="graphs_items.php?id=<?print $id;?>&graph_grouping=<?if ($allow_grouping == "on") { print "off"; }else{ print "on"; }?>">Turn Graph Grouping <?if ($allow_grouping == "on") { print "<strong>Off</strong>"; }else{ print "<strong>On</strong>"; }?></a><br>
|
||||
</td>
|
||||
<td align="right">
|
||||
<?if ($graph_preview == "on") {?>
|
||||
<img src="graph_image.php?graphid=<?print $id;?>&rraid=1&graph_start=-86400&graph_height=100&graph_width=350">
|
||||
<?}?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<?if ($graph_output_preview == "on") {
|
||||
$graph_data_array["output_flag"] = 2;
|
||||
?><PRE><?print rrdtool_function_graph($id, 1, $graph_data_array);?></PRE><?
|
||||
}?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<?
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
DrawMatrixRowBegin();
|
||||
DrawMatrixHeaderItem("Graph Item",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Data Source Name",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderItem("Graph Item Type",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixCustom("<td bgcolor=\"$colors[panel]\" colspan=\"2\">Item Color</td>");
|
||||
DrawMatrixHeaderItem("Sequence",$colors[panel],$colors[panel_text]);
|
||||
DrawMatrixHeaderAdd($colors[panel],"","graphs_items.php?action=edit&gid=$id");
|
||||
DrawMatrixRowEnd();
|
||||
|
||||
$items = db_fetch_assoc("select
|
||||
d.id as DID, d.name as DName,
|
||||
t.id as TID, t.Name,
|
||||
c.id as CID,c.Hex,
|
||||
cf.name as CFName,
|
||||
g.*,
|
||||
cd.name as CDEFName
|
||||
from rrd_graph_item g
|
||||
left join def_graph_type t on g.graphtypeid=t.id
|
||||
left join def_colors c on g.colorid=c.id
|
||||
left join def_cf cf on g.consolidationfunction=cf.id
|
||||
left join rrd_ds d on g.dsid=d.id
|
||||
left join rrd_ds_cdef cd on g.cdefid=cd.id
|
||||
where g.graphid=$id order by g.sequenceparent,g.sequence");
|
||||
$rows = sizeof($items);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $rows) {
|
||||
$item = $items[$i];
|
||||
$current_color = DrawMatrixRowAlternateColorBegin($colors[alternate],$colors[light],$i);
|
||||
/* grouping options */
|
||||
if ($allow_grouping == "on") { /* GROUPING ON, PARENT */
|
||||
print "<P>Name = '$item[Name]'</P>\n";
|
||||
if ($item[Name] != "GPRINT") {
|
||||
$items_bold = true;
|
||||
$title_bold = true;
|
||||
$items_indent = "";
|
||||
} else { /* GROUPING ON, CHILD */
|
||||
$items_bold = false;
|
||||
$title_bold = false;
|
||||
$items_indent = "<img src=\"images/gray_line.gif\" width=\"7\" height=\"1\" border=\"0\">";
|
||||
}
|
||||
} else { /* GROUPING OFF */
|
||||
$items_bold = false;
|
||||
$title_bold = html_boolean($config["vis_main_column_bold"]["value"]);
|
||||
$items_indent = "";
|
||||
}
|
||||
|
||||
DrawMatrixLoopItem("$items_indent Item #" . ($i+1),$title_bold,"graphs_items.php?action=edit&id=$item[ID]&gid=$id");
|
||||
|
||||
switch ($item[Name]) {
|
||||
case 'COMMENT':
|
||||
$matrix_title = "COMMENT: $item[TextFormat]";
|
||||
break;
|
||||
case 'GPRINT':
|
||||
$matrix_title = $item[DName] . ": " . $item[TextFormat];
|
||||
break;
|
||||
case 'HRULE':
|
||||
$matrix_title = "HRULE: $item[Value]";
|
||||
break;
|
||||
case 'VRULE':
|
||||
$matrix_title = "VRULE: $item[Value]";
|
||||
break;
|
||||
default:
|
||||
$matrix_title = $item[DName];
|
||||
break;
|
||||
}
|
||||
|
||||
/* for display only */
|
||||
$matrix_title = htmlspecialchars($matrix_title);
|
||||
|
||||
/* use the cdef name (if in use) if all else fails */
|
||||
if ($matrix_title == "") {
|
||||
if ($item[CDEFName] != "") {
|
||||
$matrix_title .= "CDEF: $item[CDEFName]";
|
||||
}
|
||||
}
|
||||
|
||||
if ($item[HardReturn] == "on") {
|
||||
$matrix_title .= "<strong><font color=\"#FF0000\"><HR></font></strong>";
|
||||
}
|
||||
|
||||
if ($item[Name] != "GPRINT") {
|
||||
if ($item[CFName] != "AVERAGE") {
|
||||
$matrix_title .= " (" . $item[CFName] . ")";
|
||||
}
|
||||
}
|
||||
|
||||
DrawMatrixLoopItem($matrix_title,$items_bold,"");
|
||||
DrawMatrixLoopItem($item[Name],$items_bold,"");
|
||||
|
||||
if ($item[Hex] != "") {
|
||||
$matrix_bgcolor = $item[Hex];
|
||||
} else {
|
||||
$matrix_bgcolor = $current_color;
|
||||
}
|
||||
|
||||
DrawMatrixLoopItemAction(" ",$matrix_bgcolor,"",$items_bold,""); /* color preview */
|
||||
DrawMatrixLoopItem($item[Hex],$items_bold,""); /* hex value */
|
||||
DrawMatrixLoopItem("[<a href=\"graphs_items.php?action=movedown&id=$item[ID]&gid=$id&tid=$item[Parent]\">Down</a>], [<a
|
||||
href=\"graphs_items.php?action=moveup&id=$item[ID]&gid=$id&tid=$item[Parent]\">Up</a>]",$items_bold,"");
|
||||
DrawMatrixLoopItemAction("Remove",$colors[panel],"",$items_bold,"graphs_items.php?action=remove&id=$item[ID]&gid=$id&tid=$item[Parent]");
|
||||
|
||||
DrawMatrixRowEnd();
|
||||
$i++;
|
||||
}
|
||||
|
||||
DrawMatrixTableEnd();
|
||||
include_once ("include/bottom_footer.php");
|
||||
|
||||
break;
|
||||
} ?>
|
||||
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 581 B |
|
After Width: | Height: | Size: 565 B |
|
After Width: | Height: | Size: 372 B |
|
After Width: | Height: | Size: 516 B |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 184 B |
|
After Width: | Height: | Size: 122 B |
|
After Width: | Height: | Size: 44 B |
|
After Width: | Height: | Size: 64 B |
|
After Width: | Height: | Size: 353 B |
|
After Width: | Height: | Size: 413 B |
|
After Width: | Height: | Size: 228 B |
|
After Width: | Height: | Size: 248 B |
|
After Width: | Height: | Size: 223 B |
|
After Width: | Height: | Size: 204 B |
|
After Width: | Height: | Size: 236 B |
|
After Width: | Height: | Size: 196 B |
|
After Width: | Height: | Size: 191 B |
|
After Width: | Height: | Size: 233 B |
|
After Width: | Height: | Size: 219 B |
|
After Width: | Height: | Size: 230 B |
|
After Width: | Height: | Size: 250 B |
|
After Width: | Height: | Size: 200 B |
|
After Width: | Height: | Size: 232 B |
|
After Width: | Height: | Size: 271 B |
|
After Width: | Height: | Size: 255 B |
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 72 B |
|
After Width: | Height: | Size: 67 B |
|
After Width: | Height: | Size: 68 B |
|
After Width: | Height: | Size: 599 B |
|
After Width: | Height: | Size: 213 B |
|
After Width: | Height: | Size: 598 B |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 55 B |
@@ -0,0 +1,113 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? /* NON-AUTH STUFF */
|
||||
header ("Cache-Control: no-cache, must-revalidate");
|
||||
header ("Pragma: no-cache");
|
||||
$form = $HTTP_POST_VARS;
|
||||
parse_str(getenv('QUERY_STRING'),$args);
|
||||
include("config.php");
|
||||
include_once("database.php");
|
||||
|
||||
include_once("browser_detect.inc");
|
||||
$browser = new BrowserDetector;
|
||||
|
||||
/* check to see if this is a new installation */
|
||||
include_once ("include/version_functions.php");
|
||||
|
||||
if (GetCurrentVersion() != $config[cacti_version]) {
|
||||
header ("Location: install.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
/* END OF NON-AUTH STUFF */
|
||||
include ("include/config.php");
|
||||
|
||||
/* SESSION DATA */
|
||||
session_start();
|
||||
|
||||
if ($config["global_auth"]["value"] == "on") {
|
||||
$user_id = $HTTP_SESSION_VARS['user_id'];
|
||||
$user_hash = $HTTP_SESSION_VARS['user_hash'];
|
||||
|
||||
$host = getenv("REMOTE_ADDR");
|
||||
|
||||
if (getenv("HTTP_REFERER") == "") {
|
||||
$referer = $HTTP_REFERER;
|
||||
}else{
|
||||
$referer = getenv("HTTP_REFERER");
|
||||
}
|
||||
|
||||
if ($HTTP_SESSION_VARS['change_password'] == "1") {
|
||||
header ("Location: auth_changepassword.php?ref=$referer");
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($guest_account == true) {
|
||||
/* don't even bother with the guest code if we're already logged in */
|
||||
if ($user_id == "") {
|
||||
$sql_id = db_fetch_cell("select ID from auth_users where username=\"" . $config["guest_user"]["value"] . "\"");
|
||||
|
||||
/* cannot find guest user */
|
||||
if (sizeof($sql_id) == 0) {
|
||||
print "<strong><font size=\"+1\" color=\"FF0000\">CANNOT FIND GUEST USER: " . $config["guest_user"]["value"] . "</font></strong>";
|
||||
}else{
|
||||
if ($user_id == "") {
|
||||
$user_id = $sql_id[ID];
|
||||
}
|
||||
|
||||
$res_id = db_fetch_assoc("select a.SectionID, a.UserID, s.ID, s.Section from
|
||||
auth_acl a left join auth_sections s on a.sectionid=s.id where s.section=\"$section\"
|
||||
and a.userid=$user_id");
|
||||
|
||||
if (sizeof($res_id) != 0) {
|
||||
$au = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($au != 1) {
|
||||
$res_id = db_fetch_assoc("select a.SectionID, a.UserID, s.ID, s.Section from
|
||||
auth_acl a left join auth_sections s on a.sectionid=s.id where s.section=\"$section\"
|
||||
and a.userid=\"$user_id\"");
|
||||
$rows = sizeof($res_id);
|
||||
|
||||
/* Make sure user is logged in */
|
||||
if ($user_id == "") {
|
||||
include_once ("auth_login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
/* Make sure they are authenticated */
|
||||
if ($rows != "") {
|
||||
$au = 1;
|
||||
}else{
|
||||
$au = 0;
|
||||
include_once ("auth_noauth.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,96 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
function DrawMenu($userid, $menuid) {
|
||||
global $config,$paths,$colors;
|
||||
|
||||
include_once ("include/database.php");
|
||||
include_once ("include/config.php");
|
||||
|
||||
/* get the current use logged in (if there is one) */
|
||||
if ($userid=="COOKIE") {
|
||||
$userid = $HTTP_COOKIE_VARS[$conf_cookiename];
|
||||
}
|
||||
|
||||
$item = db_fetch_row("select ItemOrder from menu where id=$menuid");
|
||||
|
||||
/* decide whether this menu is sorted alphabetically or seqentially */
|
||||
if ($item[ItemOrder] == 1) {
|
||||
$sql_sort_string = "cname, name";
|
||||
}else{
|
||||
$sql_sort_string = "c.sequence,i.sequence";
|
||||
}
|
||||
|
||||
if ($config["global_auth"]["value"] == "on") {
|
||||
/* auth is on: show items based on user logged in */
|
||||
$data = db_fetch_assoc("select a.SectionID, a.UserID,
|
||||
s.ID, s.Section,
|
||||
c.Name as CName,c.ID, c.ImagePath as CImagePath,
|
||||
i.*
|
||||
from auth_acl a
|
||||
left join auth_sections s
|
||||
on a.sectionid=s.id
|
||||
left join menu_items i
|
||||
on a.sectionid=i.sectionid
|
||||
left join menu_category c
|
||||
on c.id=i.categoryid
|
||||
where a.userid=$userid
|
||||
and i.menuid=$menuid
|
||||
order by $sql_sort_string");
|
||||
}else{
|
||||
/* auth is off: show all items */
|
||||
$data = db_fetch_assoc("select
|
||||
c.name as CName,c.ID, c.ImagePath as CImagePath,
|
||||
i.*
|
||||
from menu_items i
|
||||
left join menu_category c
|
||||
on c.id=i.categoryid
|
||||
where i.menuid=$menuid
|
||||
order by $sql_sort_string");
|
||||
}
|
||||
|
||||
print '<tr><td width="100%"><table cellpadding=3 cellspacing=0 border=0 width="100%">';
|
||||
|
||||
if (sizeof($data) > 0) {
|
||||
foreach ($data as $row) {
|
||||
if ($row[CName] != $old_cat_name) {
|
||||
print '<tr><td class="textMenuHeader">' . $row[CName] . '</td></tr>';
|
||||
|
||||
$old_cat_name = $row[CName];
|
||||
}
|
||||
|
||||
if ($row[Parent] == ""){
|
||||
$parent = "_self";
|
||||
}else{
|
||||
$parent = $row[Parent];
|
||||
}
|
||||
|
||||
print '<tr><td class="textMenuItem" background="images/menu_line.gif"><a parent="' . $parent . '" href="' . $row[URL] . '">' . $row[Name] . '</a></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</table></td></tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<SCRIPT LANGUAGE=JAVASCRIPT>
|
||||
<!--
|
||||
function drag_prep() {
|
||||
<?
|
||||
foreach ($drag_inits as $div_id) {
|
||||
if ($div_id[2] == '') { $div_id[2] = 'undefined'; }
|
||||
if ($browser->BROWSER == 'Netscape') {
|
||||
print " Drag.init(document.getElementById(\"$div_id[0]\"),document.getElementById(\"$div_id[1]\"),\"$div_id[2]\");\n";
|
||||
} else {
|
||||
print " Drag.init(document.all[\"$div_id[0]\"],document.all[\"$div_id[1]\"],\"$div_id[2]\");\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,4 @@
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
/******************************************
|
||||
** Description : BrowserDetector
|
||||
** Version : 1.0.5
|
||||
** File Name : browserDetector.php3
|
||||
** Author : epsilon7 for PHyX8 studios
|
||||
** Author Email : epsilon7@asphyxia.com
|
||||
** Created : Thursday, May 11, 2000
|
||||
** Last Modified : Thursday, August 17, 2000
|
||||
** Modified By : epsilon7
|
||||
*'
|
||||
INFO:
|
||||
Returns Browser information
|
||||
based on HTTP_USER_AGENT
|
||||
|
||||
Based on The Webmonkey JavaScript Source
|
||||
##BrowserDetector()
|
||||
##Parses User-Agent string into useful info.
|
||||
##Source: Webmonkey Code Library
|
||||
##(http://www.hotwired.com/webmonkey/javascript/code_library/)
|
||||
##Author: Rich Blaylock
|
||||
##Author Email: blaylock@wired.com
|
||||
|
||||
## CHANGE LOG
|
||||
++Thursday, August 17, 2000
|
||||
Modified to recognize Netscape 6 Preview Releases
|
||||
|
||||
++Friday, August 4, 2000
|
||||
Modified to properly recognize iCab, an alernative browser for Macintosh
|
||||
(modified by suzerain -- http://www.suzerain.com/)
|
||||
|
||||
++Friday, July 28, 2000
|
||||
Opera browsers below version 4.0 should
|
||||
now be successfully detected.
|
||||
|
||||
++Thursday, July 20, 2000
|
||||
Replaced preg_match() with eregi()
|
||||
|
||||
++Wednesday, July 12, 2000
|
||||
Fixed PHP4 Bug
|
||||
|
||||
Usage:
|
||||
include("browserDetector.php3");
|
||||
$bd = new BrowserDetector;
|
||||
|
||||
Variables:
|
||||
$bd->BROWSER // Netscape, MSIE, Opera
|
||||
$bd->PLATFORM // Win,Mac,Unix
|
||||
$bd->VERSION // MajorVersion.MinorVersion
|
||||
$bd->MAJORVER // Major Version (before . in version string)
|
||||
$bd->MINORVER // Minor Version (after . in version string)
|
||||
|
||||
'****************************************/
|
||||
class BrowserDetector
|
||||
{ var $UA = "";
|
||||
var $BROWSER = "Unknown";
|
||||
var $PLATFORM = "Unknown";
|
||||
var $VERSION = "";
|
||||
var $MAJORVER = "";
|
||||
var $MINORVER = "";
|
||||
|
||||
/* START CONSTRUCTOR */
|
||||
function BrowserDetector()
|
||||
{ $this->UA = getenv(HTTP_USER_AGENT);
|
||||
$preparens = "";
|
||||
$parens = "";
|
||||
$postparens = "";
|
||||
$i = strpos($this->UA,"(");
|
||||
if ($i >= 0)
|
||||
{ $preparens = trim(substr($this->UA,0,$i));
|
||||
$parensTMP = substr($this->UA,$i+1,strlen($this->UA));
|
||||
$j = strpos($parensTMP,")");
|
||||
if($j>=0)
|
||||
{ $parens = substr($parensTMP,0,$j);
|
||||
$postparens = trim(substr($parensTMP,$j+1,strlen($parensTMP)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{ $preparens = $this->UA;
|
||||
}
|
||||
$browVer = $preparens;
|
||||
$token = trim(strtok($parens,";"));
|
||||
while($token)
|
||||
{ if($token=="compatible")
|
||||
{
|
||||
}
|
||||
elseif(eregi("MSIE","$token"))
|
||||
{ $browVer = $token;
|
||||
}
|
||||
elseif(eregi("Opera","$token"))
|
||||
{ $browVer = $token;
|
||||
}
|
||||
elseif(eregi("X11","$token") || eregi("SunOS","$token") || eregi("Linux","$token"))
|
||||
{ $this->PLATFORM = "Unix";
|
||||
}
|
||||
elseif(eregi("Win","$token"))
|
||||
{ $this->PLATFORM = $token;
|
||||
}
|
||||
elseif(eregi("Mac","$token") || eregi("PPC","$token"))
|
||||
{ $this->PLATFORM = $token;
|
||||
}
|
||||
$token = strtok(";");
|
||||
}
|
||||
$msieIndex = strpos($browVer,"MSIE");
|
||||
if($msieIndex >= 0)
|
||||
{ $browVer = substr($browVer,$msieIndex,strlen($browVer));
|
||||
}
|
||||
$leftover = "";
|
||||
if(substr($browVer,0,strlen("Mozilla")) == "Mozilla")
|
||||
{ $this->BROWSER = "Netscape";
|
||||
$leftover=substr($browVer,strlen("Mozilla")+1,strlen($browVer));
|
||||
}
|
||||
elseif(substr($browVer,0,strlen("Lynx")) == "Lynx")
|
||||
{ $this->BROWSER = "Lynx";
|
||||
$leftover=substr($browVer,strlen("Lynx")+1,strlen($browVer));
|
||||
}
|
||||
elseif(substr($browVer,0,strlen("MSIE")) == "MSIE")
|
||||
{ $this->BROWSER = "IE";
|
||||
$leftover=substr($browVer,strlen("MSIE")+1,strlen($browVer));
|
||||
}
|
||||
elseif(substr($browVer,0,strlen("Microsoft Internet Explorer")) == "Microsoft Internet Explorer")
|
||||
{ $this->BROWSER = "IE";
|
||||
$leftover=substr($browVer,strlen("Microsoft Internet Explorer")+1,strlen($browVer));
|
||||
}
|
||||
elseif(substr($browVer,0,strlen("Opera")) == "Opera")
|
||||
{ $this->BROWSER = "Opera";
|
||||
$leftover=substr($browVer,strlen("Opera")+1,strlen($browVer));
|
||||
}
|
||||
elseif(substr($browVer,0,strlen("iCab")) == "iCab")
|
||||
{ $this->BROWSER = "iCab";
|
||||
$leftover=substr($browVer,strlen("iCab")+1,strlen($browVer));
|
||||
}
|
||||
$leftover = trim($leftover);
|
||||
/* CHECK FOR OPERA BROWSERS BELOW VERSION 4.0 */
|
||||
if(!empty($postparens))
|
||||
{ if(substr($postparens,0,strlen("Opera")) == "Opera")
|
||||
{ $this->BROWSER = "Opera";
|
||||
$v = trim(substr($postparens,strlen("Opera")+1,strlen($postparens)));
|
||||
$v = trim(substr($v,0,strpos($v," ")));
|
||||
$leftover = $v;
|
||||
}
|
||||
}
|
||||
/* CHECK FOR NETSCAPE 6 PREVIEW RELEASES */
|
||||
if(!empty($postparens))
|
||||
{ if(eregi("Netscape6",$postparens))
|
||||
{ $this->BROWSER = "Netscape";
|
||||
$i = strpos($postparens,"Netscape6");
|
||||
if($i >= 0)
|
||||
{ $v = trim(substr($postparens,$i+strlen("Netscape6")+1,strlen($postparens)));
|
||||
$leftover = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
$i=strpos($leftover," ");
|
||||
if($i > 0)
|
||||
{ $this->VERSION = substr($leftover,0,$i);
|
||||
}
|
||||
else
|
||||
{ $this->VERSION = $leftover;
|
||||
}
|
||||
$j = strpos($this->VERSION,".");
|
||||
if($j >= 0)
|
||||
{ $this->MAJORVER = substr($this->VERSION,0,$j);
|
||||
$this->MINORVER = substr($this->VERSION,$j+1,strlen($this->VERSION));
|
||||
}
|
||||
else
|
||||
{ $this->MAJORVER = $this->VERSION;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,131 @@
|
||||
/**************************************************
|
||||
* dom-drag.js
|
||||
* 09.25.2001
|
||||
* www.youngpup.net
|
||||
**************************************************
|
||||
* 10.28.2001 - fixed minor bug where events
|
||||
* sometimes fired off the handle, not the root.
|
||||
**************************************************/
|
||||
|
||||
var Drag = {
|
||||
|
||||
obj : null,
|
||||
|
||||
init : function(o, oRoot, reOrigin, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
|
||||
{
|
||||
o.onmousedown = Drag.start;
|
||||
|
||||
o.hmode = bSwapHorzRef ? false : true ;
|
||||
o.vmode = bSwapVertRef ? false : true ;
|
||||
|
||||
o.root = oRoot && oRoot != null ? oRoot : o ;
|
||||
o.root.reOrigin = reOrigin == 'undefined' ? false : true;
|
||||
o.root.handle = o;
|
||||
|
||||
if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px";
|
||||
if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px";
|
||||
if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px";
|
||||
if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";
|
||||
|
||||
o.minX = typeof minX != 'undefined' ? minX : null;
|
||||
o.minY = typeof minY != 'undefined' ? minY : null;
|
||||
o.maxX = typeof maxX != 'undefined' ? maxX : null;
|
||||
o.maxY = typeof maxY != 'undefined' ? maxY : null;
|
||||
|
||||
o.xMapper = fXMapper ? fXMapper : null;
|
||||
o.yMapper = fYMapper ? fYMapper : null;
|
||||
|
||||
o.root.onDragStart = new Function();
|
||||
o.root.onDragEnd = new Function();
|
||||
o.root.onDrag = new Function();
|
||||
},
|
||||
|
||||
start : function(e)
|
||||
{
|
||||
var o = Drag.obj = this;
|
||||
e = Drag.fixE(e);
|
||||
var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
|
||||
var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
|
||||
var hx = o.root.handle.style["left"];
|
||||
var hy = o.root.handle.style["top"];
|
||||
if (o.root.reOrigin == true) {
|
||||
alert("Should re-Origin Now to "+hx+","+hy+" from "+ o.root.style["left"]+","+o.root.style["top"]);
|
||||
|
||||
o.root.style["left"] = o.root.hx + "px";
|
||||
o.root.style["top"] = o.root.hx + "px";
|
||||
}
|
||||
o.root.onDragStart(x, y);
|
||||
|
||||
o.lastMouseX = e.clientX;
|
||||
o.lastMouseY = e.clientY;
|
||||
|
||||
if (o.hmode) {
|
||||
if (o.minX != null) o.minMouseX = e.clientX - x + o.minX;
|
||||
if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX;
|
||||
} else {
|
||||
if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
|
||||
if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
|
||||
}
|
||||
|
||||
if (o.vmode) {
|
||||
if (o.minY != null) o.minMouseY = e.clientY - y + o.minY;
|
||||
if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY;
|
||||
} else {
|
||||
if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
|
||||
if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
|
||||
}
|
||||
|
||||
document.onmousemove = Drag.drag;
|
||||
document.onmouseup = Drag.end;
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
drag : function(e)
|
||||
{
|
||||
e = Drag.fixE(e);
|
||||
var o = Drag.obj;
|
||||
|
||||
var ey = e.clientY;
|
||||
var ex = e.clientX;
|
||||
var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
|
||||
var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
|
||||
var nx, ny;
|
||||
|
||||
if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
|
||||
if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
|
||||
if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
|
||||
if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);
|
||||
|
||||
nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
|
||||
ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
|
||||
|
||||
if (o.xMapper) nx = o.xMapper(y)
|
||||
else if (o.yMapper) ny = o.yMapper(x)
|
||||
|
||||
Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
|
||||
Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
|
||||
Drag.obj.lastMouseX = ex;
|
||||
Drag.obj.lastMouseY = ey;
|
||||
|
||||
Drag.obj.root.onDrag(nx, ny);
|
||||
return false;
|
||||
},
|
||||
|
||||
end : function()
|
||||
{
|
||||
document.onmousemove = null;
|
||||
document.onmouseup = null;
|
||||
Drag.obj.root.onDragEnd( parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]),
|
||||
parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
|
||||
Drag.obj = null;
|
||||
},
|
||||
|
||||
fixE : function(e)
|
||||
{
|
||||
if (typeof e == 'undefined') e = window.event;
|
||||
if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
|
||||
if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
|
||||
return e;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,207 @@
|
||||
<SCRIPT LANGUAGE=JAVASCRIPT>
|
||||
<!--
|
||||
var loaded = 0;
|
||||
|
||||
function startup() {
|
||||
loaded = 1;
|
||||
drag_prep();
|
||||
<?
|
||||
if ($PHP_SELF == '/task_tree.php' || $PHP_SELF == '/gantt.php') {
|
||||
print " setInterval(\"scroll_tasklist();\",10);\n";
|
||||
print "js_alerts();\n";
|
||||
}
|
||||
print " }\n";
|
||||
?>
|
||||
|
||||
<?
|
||||
#print "<P>Browser = '".$browser->BROWSER."'</P>\n";
|
||||
|
||||
if ($browser->BROWSER == 'Netscape') {
|
||||
## Netscape Support Starts Here
|
||||
|
||||
?>
|
||||
|
||||
function scroll_tasklist() {
|
||||
var arg = "tasklist";
|
||||
var tl = arg;
|
||||
if (typeof arg == "string") {
|
||||
<?
|
||||
|
||||
if ($browser->MAJORVER > 4) {
|
||||
print " tl = document.getElementById(arg).style;\n";
|
||||
} else {
|
||||
if ($browser->MINORVER > 76) {
|
||||
print " tl = eval(\"document.\"+arg);\n";
|
||||
} else {
|
||||
print " tl = document.getElementById(arg).style;\n";
|
||||
}
|
||||
}
|
||||
print "
|
||||
}
|
||||
|
||||
tl.left = window.pageXOffset + 3;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function popup(arg,vis) {
|
||||
if (loaded == 1 && arg) {
|
||||
var theobj = arg;
|
||||
if (typeof arg == \"string\") {
|
||||
";
|
||||
if ($browser->MAJORVER > 4) {
|
||||
print " theobj = document.getElementById(arg).style;\n";
|
||||
} else {
|
||||
if ($browser->MINORVER > 76) {
|
||||
print " theobj = eval(\"document.\"+arg);\n";
|
||||
} else {
|
||||
print " theobj = document.getElementById(arg).style;\n";
|
||||
}
|
||||
}
|
||||
print " }
|
||||
|
||||
theobj.top = window.pageYOffset + 100;
|
||||
theobj.left = window.pageXOffset + 100;
|
||||
var vis = theobj.visibility;
|
||||
// alert(vis);
|
||||
if (vis == 'hidden' || vis == \"hide\") {
|
||||
theobj.visibility = 'visible';
|
||||
} else {
|
||||
theobj.visibility = 'hidden';
|
||||
}
|
||||
} else {
|
||||
if (loaded != 1) { alert(\"Page not loaded yet.\"); }
|
||||
}
|
||||
}
|
||||
|
||||
function color_row(arg,row_state) {
|
||||
if (loaded == 1 && arg) {
|
||||
while (arg.tagName!=\"TR\") {
|
||||
{arg=arg.parentNode;}
|
||||
}
|
||||
if (row_state == \"on\") {
|
||||
arg.className = \"H\";
|
||||
} else {
|
||||
arg.className = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
";
|
||||
|
||||
} elseif ($browser->BROWSER == 'MSIE' || $browser->BROWSER == 'IE') {
|
||||
## MSIE Support Starts Here
|
||||
#
|
||||
?>
|
||||
|
||||
function scroll_tasklist() {
|
||||
var arg = "tasklist";
|
||||
var tl = arg;
|
||||
if (typeof arg == "string") {
|
||||
tl = eval("document.all."+ arg +".style");
|
||||
}
|
||||
tl.left = document.body.scrollLeft + 3;
|
||||
}
|
||||
|
||||
function popup(arg,vis) {
|
||||
if (loaded == 1 && arg) {
|
||||
if (typeof arg == "string") {
|
||||
theobj = eval("document.all."+ arg +".style");
|
||||
} else {
|
||||
theobj = arg;
|
||||
}
|
||||
theobj.top = document.body.scrollTop + 50;
|
||||
theobj.left = document.body.scrollLeft + 100;
|
||||
var vis = theobj.visibility;
|
||||
if (vis == 1 || vis == "hidden") {
|
||||
theobj.visibility = 'visible';
|
||||
} else {
|
||||
theobj.visibility = 'hidden';
|
||||
}
|
||||
} else {
|
||||
if (loaded != 1) {
|
||||
alert("Page not loaded yet.");
|
||||
} else {
|
||||
alert("Usage: popup(name_of_div,mode); where 'mode' is 1 for visible of 0 for hidden.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function color_row(arg,row_state) {
|
||||
// alert("here is " + arg);
|
||||
if (loaded == 1 && arg) {
|
||||
while (arg.tagName!="TR") {
|
||||
// alert("here is " + arg.tagName);
|
||||
{arg=arg.parentElement;}
|
||||
}
|
||||
if (row_state == "on") {
|
||||
arg.className = "h";
|
||||
} else {
|
||||
arg.className = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
<?
|
||||
|
||||
} elseif ($browser->BROWSER == 'OPERA') {
|
||||
## Opera Support Starts Here.
|
||||
|
||||
?>
|
||||
|
||||
function scroll_tasklist() {
|
||||
var arg = "tasklist";
|
||||
var tl = arg;
|
||||
if (typeof arg == "string") {
|
||||
tl = eval("document.all."+ arg +".style");
|
||||
}
|
||||
tl.left = document.body.scrollLeft + 3;
|
||||
}
|
||||
|
||||
function popup(arg,vis) {
|
||||
if (loaded == 1 && arg) {
|
||||
var theobj = arg;
|
||||
if (typeof arg == "string") {
|
||||
<?
|
||||
if ($browser->MAJORVER > 4) {
|
||||
print " theobj = document.getElementById(arg).style;\n";
|
||||
} else {
|
||||
if ($browser->MINORVER > 76) {
|
||||
print " theobj = eval(\"document.\"+arg);\n";
|
||||
} else {
|
||||
print " theobj = document.getElementById(arg).style;\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
}
|
||||
theobj.top = window.pageYOffset + 100;
|
||||
theobj.left = window.pageXOffset + 100;
|
||||
var vis = theobj.visibility;
|
||||
// alert(vis);
|
||||
if (vis == 'hidden' || vis == "hide") {
|
||||
theobj.visibility = 'visible';
|
||||
} else {
|
||||
theobj.visibility = 'hidden';
|
||||
}
|
||||
} else {
|
||||
if (loaded != 1) { alert("Page not loaded yet."); }
|
||||
}
|
||||
}
|
||||
|
||||
function color_row(arg,row_state) {
|
||||
if (loaded == 1 && arg) {
|
||||
while (arg.tagName!="TR") {
|
||||
{arg=arg.parentElement;}
|
||||
}
|
||||
if (row_state == "on") {
|
||||
arg.className = "h";
|
||||
} else {
|
||||
arg.className = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
<?
|
||||
}
|
||||
?>
|
||||
//-->
|
||||
</SCRIPT>
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? include ('include/config.php');
|
||||
|
||||
session_start();
|
||||
//print $HTTP_SESSION_VARS['user_id'];
|
||||
|
||||
$tree_id = $HTTP_GET_VARS["tree_id"];
|
||||
|
||||
$user_id = GetCurrentUserID($HTTP_SESSION_VARS['user_id'], $config["guest_user"]["value"]);
|
||||
|
||||
/* at this point this user is good to go... so get some setting about this
|
||||
user and put them into variables to save excess SQL in the future */
|
||||
$graph_policy = db_fetch_cell("select GraphPolicy from auth_users where id=$user_id");
|
||||
$config["graph_policy"]["auth"] = $graph_policy;
|
||||
|
||||
/* load all of the custom per-user graph settings */
|
||||
$array_settings = LoadSettingsIntoArray($HTTP_SESSION_VARS['user_id'], $config["guest_user"]["value"]);
|
||||
|
||||
/* set the default action if none has been set */
|
||||
if (($action != "tree") && ($action != "list") && ($action != "preview")) {
|
||||
switch ($array_settings["global"]["defaultviewmode"]) {
|
||||
case '1':
|
||||
$action = "tree"; break;
|
||||
case '2':
|
||||
$action = "list"; break;
|
||||
case '3':
|
||||
$action = "preview"; break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if cookie has been set, use it */
|
||||
if (isset($tree_id) == false) {
|
||||
if (isset($HTTP_SESSION_VARS["tree_id"]) == true) {
|
||||
$tree_id = $HTTP_SESSION_VARS["tree_id"];
|
||||
}
|
||||
}else{
|
||||
$HTTP_SESSION_VARS["tree_id"] = $tree_id;
|
||||
}
|
||||
|
||||
$current_script_name = basename($HTTP_SERVER_VARS["SCRIPT_NAME"]);
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>cacti</title>
|
||||
<?
|
||||
$page_refresh = $array_settings["preview"]["pagerefresh"];
|
||||
echo "<meta http-equiv=refresh content=\"$page_refresh\"; url=\"$PHP_SELF?$QUERY_STRING\">\r\n";
|
||||
?>
|
||||
<STYLE TYPE="text/css">
|
||||
<!--
|
||||
BODY, TABLE, TR, TD {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;}
|
||||
BODY {background-color: #F5F5F5;}
|
||||
A {text-decoration: none;}
|
||||
A:active { text-decoration: none;}
|
||||
A:hover {text-decoration: underline; color: #333333;}
|
||||
A:visited {color: Blue;}
|
||||
.textHeader {font-size: 12px; font-weight: bold;}
|
||||
.textHeaderDark {font-size: 12px; font-weight: bold; color: #ffffff;}
|
||||
.textArea {font-size: 12px;}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td bgcolor="#454E53" colspan="<?print $array_settings["preview"]["columnnumber"];?>" nowrap>
|
||||
<map name="tabs">
|
||||
<area alt="Console" coords="7,5,87,35" href="index.php">
|
||||
<area alt="Graphs" coords="166,5,241,32" href="graph_view.php?action=tree" shape="RECT">
|
||||
<area alt="Documentation" coords="88,5,165,32" href="docs/MANUAL.htm">
|
||||
</map>
|
||||
|
||||
<img src="images/top_tabs_main.gif" border="0" usemap="#tabs"><br>
|
||||
</td>
|
||||
<td bgcolor="#454E53" align="right" nowrap>
|
||||
<?if (isset($HTTP_SESSION_VARS["user_id"])){?><a href="logout.php"><img src="images/top_tabs_logout.gif" border="0" alt="Logout"></a><?}?><a href="graph_settings.php"><img src="images/top_tabs_graph_settings<?if (basename($SCRIPT_FILENAME) == "graph_settings.php") { print "_down"; }?>.gif" border="0" alt="Settings"></a><a href="graph_view.php?action=tree"><img src="images/top_tabs_graph_tree<?if ($action == "tree") { print "_down"; }?>.gif" border="0" alt="Tree View"></a><a href="graph_view.php?action=list"><img src="images/top_tabs_graph_list<?if ($action == "list") { print "_down"; }?>.gif" border="0" alt="List View"></a><a href="graph_view.php?action=preview"><img src="images/top_tabs_graph_preview<?if ($action == "preview") { print "_down"; }?>.gif" border="0" alt="Preview View"></a><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" bgcolor="#<?print $colors[panel];?>">
|
||||
<img src="images/transparent_line.gif" width="170" height="5" border="0"><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?if ($action == "tree") {?>
|
||||
<form name="form_tree_id">
|
||||
<?
|
||||
//include ("include/database.php");
|
||||
|
||||
if ($config["global_auth"]["value"] == "on") {
|
||||
if ($config["graph_policy"]["auth"] == "1") {
|
||||
$sql_where = "where agh.userid is null";
|
||||
}elseif ($config["graph_policy"]["auth"] == "2") {
|
||||
$sql_where = "where agh.userid is not null";
|
||||
}
|
||||
|
||||
$tree_list = db_fetch_assoc("select gh.*,agh.userid
|
||||
from graph_hierarchy gh
|
||||
left join auth_graph_hierarchy agh on (gh.id=agh.hierarchyid and agh.userid=" . GetCurrentUserID($HTTP_SESSION_VARS['user_id'], $config["guest_user"]["value"]) . ")
|
||||
$sql_where
|
||||
order by gh.name");
|
||||
}else{
|
||||
$tree_list = db_fetch_assoc("select * from graph_hierarchy order by name");
|
||||
}
|
||||
|
||||
//$rows = mysql_num_rows($sql_id); $i = 0;
|
||||
|
||||
/* set a default tree if none is already selected */
|
||||
if (isset($tree_id) == false) {
|
||||
if (isset($array_settings["hierarchical"]["treeid"]) == true) {
|
||||
$tree_id = $array_settings["hierarchical"]["treeid"];
|
||||
}else{
|
||||
if (sizeof($tree_list) != 0) {
|
||||
$tree_id = db_fetch_cell("select ID from graph_hierarchy");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* make the dropdown list of trees */
|
||||
if (sizeof($tree_list) > 1) {
|
||||
?>
|
||||
<td valign="middle" height="30" colspan="3" bgcolor="#<?print $colors[panel];?>">
|
||||
Select a Graph Hierarchy:
|
||||
<select name="cbo_tree_id" onChange="window.location=document.form_tree_id.cbo_tree_id.options[document.form_tree_id.cbo_tree_id.selectedIndex].value">
|
||||
<?foreach ($tree_list as $tree) {?>
|
||||
<option value="graph_view.php?action=tree&tree_id=<?print $tree[ID]; ?>"
|
||||
<?if ($tree_id == $tree[ID]) { ?>
|
||||
selected <? $tree_name = $tree[Name]; } ?>><? print $tree[Name]; ?></option>
|
||||
<?//$i++;
|
||||
} ?>
|
||||
</select>
|
||||
<?
|
||||
/* there is only one tree; use it */
|
||||
}elseif (sizeof($tree_list) == 1) {?>
|
||||
<td valign="middle" height="5" colspan="3" bgcolor="#<?print $colors[panel];?>">
|
||||
<?$tree_id = db_fetch_cell("select ID from graph_hierarchy");;
|
||||
$tree_name = db_fetch_cell("select Name from graph_hierarchy");;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</form>
|
||||
<?}else{?>
|
||||
<td height="5" colspan="3" bgcolor="#<?print $colors[panel];?>">
|
||||
|
||||
</td>
|
||||
<?}?>
|
||||
</tr>
|
||||
<?if ($showinfo == true) {?>
|
||||
<tr>
|
||||
<td valign="top" height="1" colspan="3" bgcolor="#<?print $colors[panel];?>">
|
||||
<?$graph_data_array["print_source"] = true;
|
||||
print trim(rrdtool_function_graph($graphid, $rraid, $graph_data_array));?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr height="5" bgcolor="#<?print $color_dark_outline;?>"><td colspan="3"><img src="images/transparent_line.gif" width="20" height="5" border="0"></td></tr>
|
||||
<?}?>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0"
|
||||
<tr height="5"><td colspan="3"> </td></tr>
|
||||
<tr>
|
||||
<td bgcolor="#<?print $colors[light];?>" width="1%"></td>
|
||||
<td valign="top" colspan="2">
|
||||
@@ -0,0 +1,100 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<? include_once ('include/auth_functions.php'); ?>
|
||||
<html>
|
||||
<head>
|
||||
<title>cacti</title>
|
||||
<STYLE TYPE="text/css"> <!--
|
||||
|
||||
BODY, TABLE, TR, TD {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;}
|
||||
BODY {background-color: #FFFFFF;}
|
||||
A {text-decoration: none;}
|
||||
A:active { text-decoration: none;}
|
||||
A:hover {text-decoration: underline; color: #333333;}
|
||||
A:visited {color: Blue;}
|
||||
.textHeader {font-size: 12px; font-weight: bold;}
|
||||
.textHeaderDark {font-size: 12px; font-weight: bold; color: #ffffff;}
|
||||
.textSubHeaderDark {font-size: 12px; color: #ffffff;}
|
||||
.textArea {font-size: 12px;}
|
||||
.textTab {font-size: 10px; font-weight: bold;}
|
||||
.textEditTitle {font-size: 10px; font-weight: bold;}
|
||||
.textMenuHeader {background-color: #AEB4B7; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold;}
|
||||
.textMenuItem {background-color: #E3E3E3; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;}
|
||||
.cboSmall {font-size: 10px;}
|
||||
.linkEditMain {text-decoration: none; <?if ($config["vis_main_column_bold"]["value"]==true){?>font-weight: bold;<?}?>}
|
||||
.linkEditMain:visited {text-decoration: none; <?if ($config["vis_main_column_bold"]["value"]==true){?>font-weight: bold;<?}?>}
|
||||
.linkEditMain:active {text-decoration: underline; color: #333333; <?if ($config["vis_main_column_bold"]["value"]==true){?>font-weight: bold;<?}?>}
|
||||
.linkEditMain:hover {color: Blue; text-decoration: underline; <?if ($config["vis_main_column_bold"]["value"]==true){?> font-weight: bold;<?}?>}
|
||||
.linkOverDark {color: #ffffff; text-decoration: none;}
|
||||
.linkOverDark:visited {color: #ffffff; text-decoration: none;}
|
||||
.linkOverDark:active {color: #ffffff; text-decoration: none;}
|
||||
.linkOverDark:hover {color: #ffffff; text-decoration: underline;}
|
||||
-->
|
||||
</style>
|
||||
<?include_once("include/js_popup.inc");?>
|
||||
<script language="javascript" src="include/dom-drag.js"></script>
|
||||
</head>
|
||||
|
||||
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="drag_prep();">
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td colspan="3" bgcolor="#454E53">
|
||||
<map name="tabs">
|
||||
<area alt="Console" coords="7,5,87,35" href="index.php">
|
||||
<area alt="Graphs" coords="166,5,241,32" href="graph_view.php?action=tree" shape="RECT">
|
||||
<area alt="Documentation" coords="88,5,165,32" href="docs/MANUAL.htm">
|
||||
</map>
|
||||
|
||||
<img src="images/top_tabs_main.gif" border="0" usemap="#tabs"><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" bgcolor="#<?print $colors[panel];?>">
|
||||
<img src="images/transparent_line.gif" width="170" height="5" border="0"><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="27" colspan="3" bgcolor="#<?print $colors[panel];?>" background="images/top_banner.gif">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" bgcolor="#<?print $colors[panel];?>">
|
||||
<img src="images/transparent_line.gif" width="170" height="5" border="0"><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr height="5" bgcolor="#<?print $colors[dark_outline];?>"><td colspan="3"><img src="images/transparent_line.gif" width="20" height="5" border="0"></td></tr>
|
||||
<tr height="5">
|
||||
<td width="1%" rowspan="2" align="center" valign="top">
|
||||
<img src="images/transparent_line.gif" width="142" height="5" border="0"><br>
|
||||
<table width="133" cellpadding=1 cellspacing=0 border=0 class="textMenuHeader">
|
||||
<?DrawMenu ($HTTP_SESSION_VARS['user_id'], 1);?>
|
||||
</table>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="300" bgcolor="#<?print $colors[light];?>"></td>
|
||||
<td valign="top" width="99%">
|
||||
@@ -0,0 +1,19 @@
|
||||
<form method="post" action="<?print basename($HTTP_SERVER_VARS["SCRIPT_NAME"]);?>">
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table align="center" <?if ($style == "dialog") {?>width="60%"<?}else{?>width="98%"<?}?> cellpadding=1 cellspacing=0 border=0 bgcolor="#00438C">
|
||||
<tr>
|
||||
<td width="100%">
|
||||
<table cellpadding=3 cellspacing=0 border=0 bgcolor="#E1E1E1" width="100%">
|
||||
<tr>
|
||||
<td bgcolor="#00438C" colspan="10">
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td bgcolor="#00438C" class="textHeaderDark"><?print $title_text;?></td>
|
||||
<?if (isset($add_text)) {?><td class="textHeaderDark" align="right" bgcolor="#00438C"><strong><a class="linkOverDark" href="<?print $add_text;?>">Add</a> </strong></td><?}?>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,222 @@
|
||||
<?/*
|
||||
+-------------------------------------------------------------------------+
|
||||
| Copyright (C) 2002 Ian Berry |
|
||||
| |
|
||||
| This program is free software; you can redistribute it and/or |
|
||||
| modify it under the terms of the GNU General Public License |
|
||||
| as published by the Free Software Foundation; either version 2 |
|
||||
| of the License, or (at your option) any later version. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
+-------------------------------------------------------------------------+
|
||||
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
|
||||
+-------------------------------------------------------------------------+
|
||||
| This code is currently maintained and debugged by Ian Berry, any |
|
||||
| questions or comments regarding this code should be directed to: |
|
||||
| - iberry@raxnet.net |
|
||||
+-------------------------------------------------------------------------+
|
||||
| - raXnet - http://www.raxnet.net/ |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/?>
|
||||
<?
|
||||
|
||||
function GetCurrentVersion() {
|
||||
$do_not_read_config = true;
|
||||
include ('include/config.php');
|
||||
|
||||
$cacti = db_fetch_cell("select * from version");
|
||||
|
||||
if (!$cacti > 0) {
|
||||
return "0.6";
|
||||
}else{
|
||||
return $cacti;
|
||||
}
|
||||
}
|
||||
|
||||
function UpdateCacti($old_version, $new_version, $database_connection_id) {
|
||||
|
||||
/* never ever re-update */
|
||||
if ($old_version == $new_version) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if ($old_version <= "0.6") {
|
||||
/* forced password change (all passwords set to 'admin' initially) */
|
||||
$sql_id = mysql_query("update auth_users set mustchangepassword=\"on\" where 1=1",$database_connection_id);
|
||||
$sql_id = mysql_query("update auth_users set password=\"43e9a4ab75570f5b\" where 1=1",$database_connection_id);
|
||||
|
||||
/* data input update */
|
||||
mysql_query("update src set formatstrin=\"perl <path_cacti>/scripts/tcp_custom.pl <grepstr>\" where id=19",$database_connection_id);
|
||||
mysql_query("update src set formatstrin=\"perl <path_cacti>/scripts/loadavg.pl <min>\" where id=9",$database_connection_id);
|
||||
mysql_query("update src set formatstrin=\"perl <path_cacti>/scripts/users.pl <username>\" where id=6",$database_connection_id);
|
||||
mysql_query("update src set formatstrin=\"perl <path_cacti>/scripts/memfree.pl <grepstr>\" where id=24",$database_connection_id);
|
||||
mysql_query("update src set formatstrin=\"<path_snmp>/snmpget -O neEXbqfsStv <ip> <community> <oid>\" where id=13",$database_connection_id);
|
||||
mysql_query("update src set formatstrin=\"php -q <path_cacti>/cmd_snmp_interface.php <inout>:<ip>:<community>:<ifdesc>:<ifnum>:<ifmac>:<ifip>\" where id=11",$database_connection_id);
|
||||
mysql_query("update src set formatstrin=\"perl <path_cacti>/scripts/sql.pl\" where id=8",$database_connection_id);
|
||||
mysql_query("update src set formatstrin=\"perl <path_cacti>/scripts/proc.pl\" where id=5",$database_connection_id);
|
||||
mysql_query("update src set formatstrin=\"perl <path_cacti>/scripts/tcp.pl <mode>\" where id=7",$database_connection_id);
|
||||
mysql_query("update src set formatstrin=\"perl <path_cacti>/scripts/webhits.pl\" where id=23",$database_connection_id);
|
||||
mysql_query("update src set formatstrin=\"perl <path_cacti>/scripts/ping.pl <num> <ip>\" where id=1",$database_connection_id);
|
||||
|
||||
/* update menu table */
|
||||
mysql_query("delete from menu_items where id=8",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES ('16','4','Logout User','logout.php','8','1','','images/menu_item_logout_user.png','3')",$database_connection_id);
|
||||
|
||||
/* create version table */
|
||||
mysql_query("CREATE TABLE version (cacti char(15) default NULL)",$database_connection_id);
|
||||
|
||||
print "<strong><font color=\"#FF0000\">PLEASE READ!</font></strong> The password function
|
||||
has been changed in this version. All passwords have been set to 'admin',
|
||||
you will be forced to change the password upon login.";
|
||||
}
|
||||
|
||||
if ($old_version <= "0.6.1") {
|
||||
/* some minor table updates */
|
||||
mysql_query("ALTER TABLE `rrd_graph_item` CHANGE `Name` `Value` VARCHAR(50) DEFAULT NULL",$database_connection_id);
|
||||
mysql_query("ALTER TABLE `settings` ADD `PageRefresh` SMALLINT(5) DEFAULT '300'",$database_connection_id);
|
||||
}
|
||||
|
||||
if ($old_version <= "0.6.2") {
|
||||
/* update table structures */
|
||||
mysql_query("ALTER TABLE `settings` RENAME `settings_graphs`",$database_connection_id);
|
||||
mysql_query("CREATE TABLE settings (Name varchar(50) NOT NULL default '',
|
||||
Value varchar(255) NOT NULL default '',
|
||||
FriendlyName varchar(100) NOT NULL default '',
|
||||
Description varchar(255) NOT NULL default '',
|
||||
Method varchar(255) default NULL,
|
||||
PRIMARY KEY (Name),
|
||||
UNIQUE KEY Name (Name)) TYPE=MyISAM",$database_connection_id);
|
||||
mysql_query("ALTER TABLE `rrd_graph` ADD `AutoScaleOpts` TINYINT(1) DEFAULT '2',
|
||||
ADD `Rigid` CHAR(2) DEFAULT 'on',
|
||||
ADD `BaseValue` mediumint(8) NOT NULL DEFAULT '1000'",$database_connection_id);
|
||||
mysql_query("ALTER TABLE `rrd_ds` ADD `Step` SMALLINT(5) DEFAULT '300' NOT NULL",$database_connection_id);
|
||||
mysql_query("ALTER TABLE `rrd_graph` CHANGE `UpperLimit` `UpperLimit` BIGINT(12) DEFAULT NULL",$database_connection_id);
|
||||
mysql_query("ALTER TABLE `rrd_graph` CHANGE `LowerLimit` `LowerLimit` BIGINT(12) DEFAULT NULL",$database_connection_id);
|
||||
mysql_query("ALTER TABLE `rrd_ds_cdef` ADD `Type` TINYINT(1) DEFAULT '1' NOT NULL ",$database_connection_id);
|
||||
|
||||
/* update rra titles */
|
||||
mysql_query("update rrd_rra set name=\"Daily (5 Minute Average)\" where id=1",$database_connection_id);
|
||||
mysql_query("update rrd_rra set name=\"Weekly (30 Minute Average)\" where id=2",$database_connection_id);
|
||||
mysql_query("update rrd_rra set name=\"Monthly (2 Hour Average)\" where id=3",$database_connection_id);
|
||||
mysql_query("update rrd_rra set name=\"Yearly (1 Day Average)\" where id=4",$database_connection_id);
|
||||
|
||||
/* update cdef titles */
|
||||
mysql_query("update rrd_ds_cdef set name=\"Turn Bytes into Bits\" where id=2",$database_connection_id);
|
||||
mysql_query("INSERT INTO rrd_ds_cdef VALUES (0, 'Total All Data Sources', '2')",$database_connection_id);
|
||||
|
||||
/* insert some settings; the rest will be done by environment.php */
|
||||
mysql_query("INSERT INTO settings VALUES ('path_webcacti', '<DEFAULT>', 'cacti Web Root', 'the path, under your webroot where cacti lyes, would be \'/cacti\' in most cases if you are accessing cacti by: http://yourhost.com/cacti/.', 'textbox')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('path_webroot', '<DEFAULT>', 'Apache Web Root', 'Your apache web root, is \'/var/www/html\' or \'/home/httpd/html\' in most cases.', 'textbox')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('path_snmpget', '<DEFAULT>', 'snmpget Path', 'The path to your snmpget binary.', 'textbox')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('path_snmpwalk', '<DEFAULT>', 'snmpwalk Path', 'The path to your snmpwalk binary.', 'textbox')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('path_rrdtool', '<DEFAULT>', 'rrdtool Binary Path', 'Path to the rrdtool binary', 'textbox')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('log', '', 'Log File', 'What cacti should put in its log.', 'group:log_graph:log_create:log_update:log_snmp')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('log_graph', '', '', 'Graph', 'checkbox:group')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('log_create', 'on', '', 'Create', 'checkbox:group')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('log_update', 'on', '', 'Update', 'checkbox:group')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('log_snmp', 'on', '', 'SNMP', 'checkbox:group')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('vis_main_column_bold', 'on', '', 'Make the Main Column in Forms Bold', 'checkbox:group')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('vis', '', 'Visual', 'Various visual settings in cacti', 'group:vis_main_column_bold')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('global_auth', 'on', '', 'Use cacti\'s Builtin Authentication', 'checkbox:group')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('global', '', 'Global Settings', 'Settings that control how cacti works', 'group:global_auth')",$database_connection_id);
|
||||
|
||||
/* redo all data in menu_items (all columns have changed */
|
||||
mysql_query("delete from menu_items",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES (3, 2, 'Data Sources', 'ds.php', 3, 1, '', 'images/menu_item_data_sources.gif', 1)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES (4, 2, 'Round Robin Archives', 'rra.php', 9, 1, '', 'images/menu_item_round_robin_archives.gif', 3)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES (6, 2, 'SNMP Interfaces', 'snmp.php', 3, 1, '', 'images/menu_item_snmp_interfaces.gif', 5)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES (7, 3, 'Cron Printout', 'cron.php', 2, 1, '', 'images/menu_item_cron_printout.gif', 1)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES (2, 1, 'Colors', 'color.php', 5, 1, '', 'images/menu_item_colors.gif', 3)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES (5, 2, 'Data Input', 'data.php', 2, 1, '', 'images/menu_item_data_input.gif', 4)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES (16, 4, 'Logout User', 'logout.php', 8, 1, '', 'images/menu_item_logout_user.gif', 4)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES (12, 1, 'Graph Hierarchy', 'tree.php', 5, 1, '', 'images/menu_item_graph_hierarchy.gif', 2)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES (18, 3, 'cacti Settings', 'settings.php', 1, 1, '', 'images/menu_item_cacti_settings.gif', 2)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES (17, 4, 'User Administration', 'user_admin.php', 1, 1, '', 'images/menu_item_user_administration.gif', 3)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES (14, 2, 'CDEF\'s', 'cdef.php', 3, 1, '', 'images/menu_item_cdef.gif', 2)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_items VALUES (1, 1, 'Graphs', 'graphs.php', 5, 1, '', 'images/menu_item_graphs.gif', 1)",$database_connection_id);
|
||||
|
||||
mysql_query("delete from menu_category",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_category VALUES (1, 1, 'Graph Setup', 'images/menu_header_graph_setup.gif', 1)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_category VALUES (2, 1, 'Data Gathering', 'images/menu_header_data_gathering.gif', 2)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_category VALUES (3, 1, 'Configuration', 'images/menu_header_configuration.gif', 3)",$database_connection_id);
|
||||
mysql_query("INSERT INTO menu_category VALUES (4, 1, 'Utilities', 'images/menu_header_utilities.gif', 4)",$database_connection_id);
|
||||
|
||||
mysql_query("update src set formatstrin=\"php -q <path_cacti>/scripts/sql.php\" where id=8",$database_connection_id);
|
||||
mysql_query("update src set formatstrin=\"<path_snmpget> -O neEXbqfsStv <ip> <community> <oid>\" where id=13",$database_connection_id);
|
||||
}
|
||||
|
||||
if ($old_version <= "0.6.3") {
|
||||
mysql_query("ALTER TABLE `graph_hierarchy` RENAME `graph_hierarchy_items`",$database_connection_id);
|
||||
mysql_query("ALTER TABLE `graph_hierarchy_items` ADD `TreeID` SMALLINT(5) NOT NULL AFTER `ID`",$database_connection_id);
|
||||
mysql_query("CREATE TABLE graph_hierarchy (ID smallint(5) NOT NULL auto_increment, Name varchar(255) NOT NULL default '', PRIMARY KEY (ID), UNIQUE KEY ID (ID))",$database_connection_id);
|
||||
mysql_query("ALTER TABLE `settings_graphs` ADD `TreeID` SMALLINT(5) NOT NULL AFTER `RRAID`",$database_connection_id);
|
||||
mysql_query("CREATE TABLE settings_tree (UserID smallint(5) NOT NULL default '0', TreeItemID smallint(5) NOT NULL default '0', Status tinyint(1) NOT NULL default '0')",$database_connection_id);
|
||||
|
||||
mysql_query("INSERT INTO settings VALUES ('path_php_binary', '<DEFAULT>', 'PHP Binary Path', 'The path to your PHP binary file (may require a php recompile to get this file).', 'textbox')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('path_html_export', '', 'HTML Export Path', 'If you want cacti to write static png\'s and html files a directory when data is gathered, specify the location here. This feature is similar to MRTG, graphs do not have to be generated on the fly this way. Leave this field blank to disable this feature.', 'textbox')",$database_connection_id);
|
||||
|
||||
mysql_query("INSERT INTO graph_hierarchy VALUES (1, 'Default Tree')",$database_connection_id);
|
||||
mysql_query("UPDATE graph_hierarchy_items SET TreeID=1",$database_connection_id);
|
||||
|
||||
mysql_query("update src set formatstrin=\"<path_php_binary> -q <path_cacti>/scripts/sql.php\" where id=8",$database_connection_id);
|
||||
mysql_query("update src set formatstrin=\"<path_php_binary> -q <path_cacti>/cmd_snmp_interface.php <inout>:<ip>:<community>:<ifdesc>:<ifnum>:<ifmac>:<ifip>\" where id=11",$database_connection_id);
|
||||
}
|
||||
|
||||
if ($old_version <= "0.6.4") {
|
||||
mysql_query("ALTER TABLE `src` CHANGE `Command` `Type` CHAR(20)",$database_connection_id);
|
||||
|
||||
mysql_query("UPDATE src SET type=\"snmp_net\", formatstrin=\"INTERNAL: [<ip>/<community>] Interface: [<ifnum>]\" WHERE id=11",$database_connection_id);
|
||||
mysql_query("UPDATE src SET type=\"snmp\", formatstrin=\"INTERNAL: [<ip>/<community>] OID: [<oid>]\" WHERE id=13",$database_connection_id);
|
||||
|
||||
/* write values for dsname and dspath */
|
||||
$sql_id = mysql_query("select id,name,dsname,dspath from rrd_ds", $database_connection_id);
|
||||
$rows = mysql_num_rows($sql_id); $i = 0;
|
||||
|
||||
include_once ('include/functions.php');
|
||||
|
||||
while ($i < $rows) {
|
||||
/* DSPATH: is composed of the 'name' field + '.rrd' */
|
||||
if (mysql_result($sql_id, $i, "dspath") == "") {
|
||||
$dspath = "<path_rra>/" . mysql_result($sql_id, $i, "name") . ".rrd";
|
||||
}else{
|
||||
$dsname = mysql_result($sql_id, $i, "dspath");
|
||||
}
|
||||
|
||||
/* DSPATH: is composed of the 'name' field run through a check function */
|
||||
if (mysql_result($sql_id, $i, "dsname") == "") {
|
||||
$dsname = CheckDataSourceName(mysql_result($sql_id, $i, "name"));
|
||||
}else{
|
||||
$dsname = mysql_result($sql_id, $i, "dsname");
|
||||
}
|
||||
|
||||
mysql_query("update rrd_ds set dsname=\"$dsname\", dspath=\"$dspath\" where
|
||||
id=" . mysql_result($sql_id, $i, "id"), $database_connection_id);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($old_version <= "0.6.5") {
|
||||
mysql_query("ALTER TABLE `rrd_graph_item` ADD `SequenceParent` SMALLINT(5) DEFAULT '0' NOT NULL, ADD `Parent` SMALLINT(5) DEFAULT '0' NOT NULL",$database_connection_id);
|
||||
mysql_query("ALTER TABLE `rrd_graph` ADD `Grouping` CHAR(2), ADD `Export` CHAR(2) DEFAULT 'on'",$database_connection_id);
|
||||
mysql_query("ALTER TABLE `auth_users` DROP `AccountDisabled`, DROP `CanChangePassword`, DROP `LockoutLimit`, DROP `AccountLockedOut`, DROP `Hide`, ADD `ShowTree` CHAR(2) DEFAULT 'on', ADD `ShowList` CHAR(2) DEFAULT 'on', ADD `ShowPreview` CHAR(2) DEFAULT 'on' NOT NULL, ADD `GraphSettings` CHAR(2) DEFAULT 'on', ADD `LoginOpts` TINYINT(1) DEFAULT '1' NOT NULL",$database_connection_id);
|
||||
mysql_query("ALTER TABLE `rrd_ds` ADD `SubDSID` SMALLINT(5) DEFAULT '0' NOT NULL AFTER `ID`, ADD `SubFieldID` SMALLINT(5) DEFAULT '0' NOT NULL AFTER `SubDSID`, ADD `IsParent` TINYINT(1) DEFAULT '0' NOT NULL",$database_connection_id);
|
||||
mysql_query("CREATE TABLE auth_graph (UserID smallint(5) NOT NULL default '0',GraphID smallint(5) NOT NULL default '0')",$database_connection_id);
|
||||
mysql_query("CREATE TABLE auth_graph_hierarchy (UserID smallint(5) NOT NULL default '0',HierarchyID smallint(5) NOT NULL default '0')",$database_connection_id);
|
||||
|
||||
mysql_query("INSERT INTO settings VALUES ('guest_user', 'guest', 'Guest User', 'The name of the guest user for viewing graphs; is \"guest\" by default.', 'textbox')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('path_html_export_skip', '1', 'Export Every x Times', 'If you don\'t want cacti to export static images every 5 minutes, put another number here. For instance, 3 would equal every 15 minutes.', 'textbox')",$database_connection_id);
|
||||
mysql_query("INSERT INTO settings VALUES ('path_html_export_ctr', '', '', '', 'internal')",$database_connection_id);
|
||||
}
|
||||
|
||||
if ($old_version <= "0.6.6") {
|
||||
mysql_query("ALTER TABLE `auth_users` ADD `GraphPolicy` TINYINT(1) DEFAULT '1' NOT NULL",$database_connection_id);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
?>
|
||||