ECSC / analogi

Graphical Web Interface for OSSEC
GNU General Public License v3.0
72 stars 35 forks source link

Database Usage - Client Vs Level graph is too small when only 2 clients #5

Closed ChristianBeer closed 10 years ago

ChristianBeer commented 11 years ago

My ossec server is monitoring only himself so I have 2 clients shown in analogi and thus the mentioned graph in Management screen is a bit small (2*25px). I had to add an additional 50px so I can read it properly. But the legend is still missing don't know why.

Edit: It needs to be at least 450px height in order to show the legend!

php/managment_sourcelevel.php line 70:

$graphheight="  document.getElementById('chartdiv').style.height='".($graphcount*25+50)."px';";
ChristianBeer commented 11 years ago

I now have changed line 69 and 70 to:

if($graphcount*25<450) {$height='450';} else {$height=$graphcount*25;}
$graphheight="  document.getElementById('chartdiv').style.height='".$height."px';";
ECSC commented 11 years ago

Stop typing too fast :p

In short I was saying yes I remember this workaround being awkward to get it right for different amounts of hosts.

If you could experiment and test if this formula works with 2/15/150 clients (you might have to 'save page as' and amend the static html with 148 fake clients) and let me know, if you think it's still good at 150 I will use your formula.

Thanks

ChristianBeer commented 11 years ago

At my first try to determine the best height I used the Chrome Developertools just to recognize that it didn't update the javascript correctly. So I tried something else to get 150 clients. I altered the foreach loop in management_sourcelevel.php to duplicate my 2 clients as often as I needed. So here is the formula that scales nicely with a lot of clients too (150 clients is a long way to scroll).

if($graphcount*20<450) {$height='450';} else {$height=$graphcount*20;}
ECSC commented 11 years ago

Excellent, submitted.

Thanks Christian :)