| Author |
Message |
|
fri
User
Joined: Tue May 29, 2007 8:24 am Posts: 27
|
 Patch for Monitor 0.7 - Group by tree location
Hi,
Well based on my own need and the requests on this forum, I thought I would release the work I have started on making different views for monitor.
Quote: Changed files: setup.php, monitor.php Added option Settings>Misc>Monitor>Grouping - Default,Tree Added a grouped view Group appearance copied from legend Hosts displayed based on authentication Hosts that are monitored but not in tree are grouped in "Other"
Quote: v0.7-2 Fixed hosts added directly to a tree without header
To install, copy extracted files into monitor directory. If you are patching the commands are below:
To test the patch
Code: patch -N -p1 --dry-run < monitor_0.7-2.patch To patch the files: Code: patch -N -p1 < monitor_0.7-2.patch
As this hasn't been fully tested please let me know of any bugs.
.fri
Last edited by fri on Wed May 30, 2007 12:57 pm, edited 3 times in total.
|
| Wed May 30, 2007 10:49 am |
|
 |
|
fri
User
Joined: Tue May 29, 2007 8:24 am Posts: 27
|
Thanks to the site admins and of course the original creator, Jimmy Conner.
Requests welcome.
.fri
|
| Wed May 30, 2007 10:53 am |
|
 |
|
jimmy
Site Admin
Joined: Thu Nov 11, 2004 11:12 am Posts: 2007
|
Nice patch. It doesn't seem to account for devices that are placed directly under a tree, but a simple 2 line patch fixes it nicely. I will be adding this to SVN shortly, and then we can all begin to really play with it.
THANKS FOR THE EXCELLENT WORK!!!!!!!!
|
| Wed May 30, 2007 11:28 am |
|
 |
|
fri
User
Joined: Tue May 29, 2007 8:24 am Posts: 27
|
Ack!
you're absolutely right.
for anyone that already patched the above, please re-download.
Here is what i added to account for hosts added to a tree without a header branch.
Code: if (sizeof($leafs) > 0) { $currentTitle = $tree["name"]; $result .= render_branch($currentTitle,$leafs); }
.fri
|
| Wed May 30, 2007 12:00 pm |
|
 |
|
jimmy
Site Admin
Joined: Thu Nov 11, 2004 11:12 am Posts: 2007
|
I've added this to SVN, with a few minor updates. Everything has worked perfectly on my test machine, and I will test it on a larger install in the next few days.
|
| Wed May 30, 2007 7:31 pm |
|
 |
|
fri
User
Joined: Tue May 29, 2007 8:24 am Posts: 27
|
Hey Jimmy,
I'd like to see what the svn code looks like, as the svn site doesn't seem to include the monitor plugin.
Yesterday I cleaned up the code a bit more (refactoring your original a bit)
Quote: added a 'default with permissions' view added branch minimum status coloring including threshold (see screen shot)
Also, an idea I threw in there is the ability to show percent up for a tree branch (commented out). I will not update the above post until you ok it.
.fri
Attachments:
File comment: Monitor group view with minimum status color
monitor_group_3.jpg [ 72.51 KiB | Viewed 2310 times ]
|
| Thu May 31, 2007 9:00 am |
|
 |
|
Mika2006
User
Joined: Mon Apr 30, 2007 4:58 am Posts: 31
|
Good works thats greatest
|
| Thu May 31, 2007 9:34 am |
|
 |
|
fernanda
New User
Joined: Thu May 31, 2007 3:18 pm Posts: 17
|
 bug with sound alert on monitor?
Hello,
First i would like to congratulate for this new pacth... Very nice.
Second, i´ve just tested this patch and realised one little bug.
I have created one user that have permissions to view especific hosts. When i logged with this user the monitor view is ok because he can see only the hosts that he has permissions to view. But the alert sound that indicates a host goes down begins as any one host is down, even this one is not in user´s view. In fact, there is a host down in another group of hosts, but not in this group that i set for this user.
This means that the view is ok, it is showed depending on user´s permissions, but apparently there is no treatment to sound alert per permission. The monitor is alerting wenever any host goes down, even for that one wich is not in the user permissions.
Perhaps i might be wrong and the problem may be i´m doing something wrong. In this case, please let me know.
sorry my english...
|
| Fri Jun 01, 2007 8:12 am |
|
 |
|
fri
User
Joined: Tue May 29, 2007 8:24 am Posts: 27
|
fernanda,
you are exactly right, I'll work on a quick update addressing this issue.
.fri
|
| Fri Jun 01, 2007 8:47 am |
|
 |
|
gandalf
User
Joined: Sun Mar 12, 2006 1:06 pm Posts: 51
|
fri wrote: Quote: added a 'default with permissions' view added branch minimum status coloring including threshold (see screen shot)
Wow, I LOVE this bit! But I'm concerned about differences between SVN code the the published stuff at this thread
Reinhard
|
| Fri Jun 01, 2007 11:43 am |
|
 |
|
fri
User
Joined: Tue May 29, 2007 8:24 am Posts: 27
|
Yes that is why I am continuing to work on the features described above but will wait to see SVN before posting more code.
Thanks.
.fri
|
| Fri Jun 01, 2007 11:46 am |
|
 |
|
jimmy
Site Admin
Joined: Thu Nov 11, 2004 11:12 am Posts: 2007
|
|
| Fri Jun 01, 2007 6:09 pm |
|
 |
|
fri
User
Joined: Tue May 29, 2007 8:24 am Posts: 27
|
Ok I have finished working with these monitor changes and I hope the code changes I have made will benefit future changes.
Attached please find my current changes added to svn.
Quote: Files changed: monitor.php, setup.php, muted.gif v0.7-3 Built from SVN Added: Default render style that returns hosts by permission Change: Refactored code to simplify page rendering and changes Change: Group view color based on minimum host status in group Change: Enable monitoring from Devices list via dropdown ( http://cactiusers.org/forums/topic611.html) Fix: All hosts correctly grouped by tree and branch position Fix: Sound alert based on rendered view, including permissions (reported by fernanda) Fix: missing closing php bracket in svn
Ideas commented out:
include total hosts in group in title
include percent of hosts up in title
rendering simple list form
time taken to process page
Thanks to jimmy for making the current codebase accessible.
.fri
Attachments:
File comment: Monitor fully patched complete
extract to cacti/plugins/monitor
monitor_full_0.7-3.zip [238.49 KiB]
Downloaded 314 times
|
| Tue Jun 05, 2007 12:33 pm |
|
 |
|
mcutting
User
Joined: Thu Oct 26, 2006 12:05 pm Posts: 74
|
Fri- thanks for the new version of MONITOR - it looks great. However, when I choose the TREE view, all of my hosts are grouped under one tree only. The 0.7.2 version worked fine ???
Lines:
if (sizeof($leafs) > 0) {
$currentTitle = $tree["name"];
$result .= render_branch($currentTitle,$leafs);
}
Appear to be missing from the new version - where does this code get inserted ?
Can you help ?
Thanks
|
| Wed Jun 06, 2007 12:34 am |
|
 |
|
fri
User
Joined: Tue May 29, 2007 8:24 am Posts: 27
|
Hey mcutting,
Well to start, please describe your tree setup and what is being rendered. For example,
Default Tree
--> host
--> header
--> --> host
(just the monitored items)
Is Monitor just displaying a bunch of icons in the default way, or are you getting all your monitored hosts in a single group?
If you are looking for that code bit here it is:
Code: function render_group_by_tree() {
....
/* Last leaf, process what what's left */ if ($i == sizeof($heirarchy)-1) { if (sizeof($leafs) > 0 ) { $result .= render_branch($leafs); } }
That part will render the last branch with any remaining hosts (leafs).
.fri
|
| Wed Jun 06, 2007 8:29 am |
|
|