Cactiusers.org


It is currently Thu Sep 02, 2010 10:48 pm




Post new topic Reply to topic  [ 44 posts ]  Go to page 1, 2, 3  Next
 Patch for Monitor 0.7 - Group by tree location 
Author Message
User

Joined: Tue May 29, 2007 8:24 am
Posts: 27
Post 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


Attachments:
File comment: Monitor group view
monitor_group.jpg
monitor_group.jpg [ 78.59 KiB | Viewed 986 times ]
File comment: Monitor fully patched complete
extract to cacti/plugins/monitor

monitor_full_0.7-2.zip [234.42 KiB]
Downloaded 261 times
File comment: Monitor 0.7-2 patch file
patch -N -p1 < monitor_0.7-2.patch

monitor_patch_0.7-2.zip [2.65 KiB]
Downloaded 211 times


Last edited by fri on Wed May 30, 2007 12:57 pm, edited 3 times in total.

Wed May 30, 2007 10:49 am
User

Joined: Tue May 29, 2007 8:24 am
Posts: 27
Post 
Thanks to the site admins and of course the original creator, Jimmy Conner.
Requests welcome.

.fri


Wed May 30, 2007 10:53 am
Site Admin

Joined: Thu Nov 11, 2004 11:12 am
Posts: 2007
Post 
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
User

Joined: Tue May 29, 2007 8:24 am
Posts: 27
Post 
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
Site Admin

Joined: Thu Nov 11, 2004 11:12 am
Posts: 2007
Post 
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
User

Joined: Tue May 29, 2007 8:24 am
Posts: 27
Post 
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
monitor_group_3.jpg [ 72.51 KiB | Viewed 911 times ]
Thu May 31, 2007 9:00 am
User

Joined: Mon Apr 30, 2007 4:58 am
Posts: 31
Post 
Good works thats greatest


Thu May 31, 2007 9:34 am
New User

Joined: Thu May 31, 2007 3:18 pm
Posts: 17
Post 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
User

Joined: Tue May 29, 2007 8:24 am
Posts: 27
Post 
fernanda,

you are exactly right, I'll work on a quick update addressing this issue.

.fri


Fri Jun 01, 2007 8:47 am
User

Joined: Sun Mar 12, 2006 1:06 pm
Posts: 51
Post 
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
User

Joined: Tue May 29, 2007 8:24 am
Posts: 27
Post 
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
Site Admin

Joined: Thu Nov 11, 2004 11:12 am
Posts: 2007
Post 
http://svn.cacti.net/cgi-bin/viewcvs.cgi/?root=Plugins


Fri Jun 01, 2007 6:09 pm
User

Joined: Tue May 29, 2007 8:24 am
Posts: 27
Post 
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 225 times
Tue Jun 05, 2007 12:33 pm
User

Joined: Thu Oct 26, 2006 12:05 pm
Posts: 74
Post 
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
User

Joined: Tue May 29, 2007 8:24 am
Posts: 27
Post 
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
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 44 posts ]  Go to page 1, 2, 3  Next


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: