Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


SNMP Information at graph_view.php page
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti
Author Message
NivenHuH



Joined: 28 Nov 2007
Posts: 4
Location: SF, CA

PostPosted: Wed Dec 05, 2007 12:51 pm    Post subject: Reply with quote

I made a few mods and got it working on 0.8.7a... didn't put in the variables for SNMPv3 (what the NULLs are):

Code:

$ diff graph_view.php.original graph_view.php

29a30
> include("./lib/snmp.php");
265a267,316
> /*start SNMP Information*/
>         html_graph_start_box(1, true);
>         $host = db_fetch_row("select * from host where id=" . $_REQUEST["host_id"]);
>          print "<table width='98%' style='background-color: #6d88ad; border: 1px solid #bbbbbb;' align='center' cellspacing='2' cellpadding='3' border='0'>
>          <td colspan='" . read_graph_config_option("num_columns") . "' class='textHeaderDark'>
>        <strong>" . $host["description"] . " (" . $host["hostname"] .")" . "</strong><br />";
>             if ($host["notes"]) { print "Description: " . $host["notes"] . "<br />"; }
>             print "<br />
>             <strong>SNMP Information</strong><br>
>             <span style='font-size: 10px; font-weight: normal; font-family: monospace;'>";
>                $header_label = "[edit: " . $host["description"] . "]";
>
>                   if ((($host["snmp_community"] == "") && ($host["snmp_username"] == "")) || ($host["snmp_version"] == 0)) {
>                   print "<span style='color: #ab3f1e; font-weight: bold;'>SNMP not in use</span>\n";
>                }else{
>                   $snmp_system = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.1.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"],NULL,NULL,NULL,NULL, $host["snmp_port"], $host["snmp_timeout"],NULL,NULL);
>
>                   if ($snmp_system == "") {
>                      print "<span style='color: #ff0000; font-weight: bold;'>SNMP error</span>\n";
>                   }else{
>                      $snmp_uptime = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.3.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"],NULL,NULL,NULL,NULL, $host["snmp_port"], $host["snmp_timeout"],NULL,NULL);
>                      $snmp_hostname = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.5.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"],NULL,NULL,NULL,NULL, $host["snmp_port"], $host["snmp_timeout"],NULL,NULL);
>                      $snmp_location = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.6.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"],NULL,NULL,NULL,NULL, $host["snmp_port"], $host["snmp_timeout"],NULL,NULL);
>
>                   $y = 31536000;
>                   $w = 604800;
>                   $d = 86400;
>                   $h = 3600;
>                   $mn = 60;
>                   $s = round($snmp_uptime/100);
>                   $year = (floor($s/$y));
>                   $month = (floor($s%$y));
>                   $week = (floor(($s%$y)/$w));
>                   $day = (floor((($s%$y)%$w)/$d));
>                   $hour = (floor(((($s%$y)%$w)%$d)/$h));
>                   $min = (floor((((($s%$y)%$w)%$d)%$h)/$mn));
>                   $sec = ((((($s%$y)%$w)%$d)%$h)%$mn);
>
>                   print "System: '$snmp_system'<br>\n";
>                   print "<span style='color: #00FF00; font-size: 12px; font-weight: bold;'>Uptime: $year yr(s) $week wk(s) $day day(s) $hour hr(s) $min min(s) $sec sec(s)</span><br>\n";
>                   print "Hostname: '$snmp_hostname'<br>\n";
>                   print "Location: '$snmp_location'<br>\n";
>
>                   }
>                }
> print "</span></td>";
>                 html_graph_end_box();
>                 print "<br>";



Last edited by NivenHuH on Wed Dec 05, 2007 1:04 pm; edited 1 time in total
Back to top
NivenHuH



Joined: 28 Nov 2007
Posts: 4
Location: SF, CA

PostPosted: Wed Dec 05, 2007 12:51 pm    Post subject: Reply with quote

nduda78 wrote:
Maybe I am missing something here, but I dont see the SNMP stuff in Tree mode, only in Preview mode. ALl i did was use the diff patch against my graph-view.php

Ideas?


Same here.. I think a different section needs to be modified to accommodate tree mode.

This works good enough for me (since the monitor plugin drops you into preview mode)
Back to top
prof



Joined: 11 Jul 2008
Posts: 7

PostPosted: Fri Jul 11, 2008 6:18 am    Post subject: Reply with quote

I have rewritten 4 Files, just check if this is somethin for you.

Just replace them. They were written for cacti 0.8.7b.

I have used the SNMP Information Code from NivenHuH.

html*.php goes into /cacti/site/lib
graph*.php goes into /cati/site

The files give you extra information in Preview, Tree mode and in Zoom.



html_tree.php.txt
 Description:
Rename to html_tree.php

Download
 Filename:  html_tree.php.txt
 Filesize:  41.06 KB
 Downloaded:  266 Time(s)


html.php.txt
 Description:
Rename to html.php

Download
 Filename:  html.php.txt
 Filesize:  30.61 KB
 Downloaded:  233 Time(s)


graph_view.php.txt
 Description:
Rename to graph_view.php

Download
 Filename:  graph_view.php.txt
 Filesize:  28.4 KB
 Downloaded:  256 Time(s)


graph.php.txt
 Description:
Rename to graph.php

Download
 Filename:  graph.php.txt
 Filesize:  11.46 KB
 Downloaded:  251 Time(s)

Back to top
streaker69
Cacti Pro User


Joined: 27 Mar 2006
Posts: 711
Location: Psychic Amish Network Administrator

PostPosted: Fri Jul 11, 2008 8:23 am    Post subject: Reply with quote

Very cool, I just added these to mine, works well.

Question: Is there a reason you didn't include the Contact information, Just location and Hostname?
Back to top
prof



Joined: 11 Jul 2008
Posts: 7

PostPosted: Mon Jul 14, 2008 1:51 am    Post subject: Reply with quote

Hi,

you are right, in the code samples in this thread, there is not the contact info. I have added it in the html.php. Just copy it to the lib directory.



html.php.txt
 Description:
Updated Version with Contact Information.

Download
 Filename:  html.php.txt
 Filesize:  30.9 KB
 Downloaded:  228 Time(s)

Back to top
chrisgapske
Cacti User


Joined: 22 May 2007
Posts: 274
Location: Padacuh, Ky-Alpena, MI-Gulf Shores,AL

PostPosted: Wed Jul 16, 2008 8:41 am    Post subject: Reply with quote

The only thing I find it to be very slow .. When pulling up graphs ?
Back to top
gifty



Joined: 17 Jul 2008
Posts: 21

PostPosted: Wed Jul 23, 2008 5:27 pm    Post subject: Reply with quote

Hey .. Thanks a lot for scripts ..
I have 1 question.

What it does is, it print "snmp information" with every thumbnail showing on 1 page, although its all same.

Is it possible to remove information from each and every thumbnail and show it just once and have information when we see graph.

Please help me out here.

Thanks a lot.

-Vineet Singh
Back to top
gifty



Joined: 17 Jul 2008
Posts: 21

PostPosted: Wed Jul 23, 2008 5:47 pm    Post subject: Reply with quote

Problem solved ..
just removed 1 line ...
from html.php

205c146
<? add_snmp_to_graph($graph["local_graph_id"]); ?>
..

And it worked ..

If anyone need to remove excess of information which is same, he can do this .

Thanks

-Vineet Singh
Back to top
mgb
Cacti User


Joined: 21 Jun 2004
Posts: 117
Location: North of the Netherlands

PostPosted: Tue Jul 29, 2008 4:00 am    Post subject: Reply with quote

If I implement this on 0.8.7b with SPINE running and weathermap I recieve Script server errors and weathermap does not work anymore.

Quote:
SPINE: Poller[0] ERROR: SS[999] Script Server did not start properly return message was: ''


any idea?

Michael
Back to top
gifty



Joined: 17 Jul 2008
Posts: 21

PostPosted: Tue Jul 29, 2008 12:00 pm    Post subject: Reply with quote

It is working perfectly for me, but i have not installed spine with it.

-Vineet Singh
Back to top
r_chetanjain
Cacti User


Joined: 22 Aug 2003
Posts: 80

PostPosted: Wed Mar 18, 2009 5:09 am    Post subject: patch for 0.8.7d with PA 2.4 Reply with quote

Hi Any patch for Cacti 0.8.7d wtih PA 2.4.... I stopped working after upgrade

Chetan
Back to top
jb_008



Joined: 14 Mar 2010
Posts: 2

PostPosted: Sun Mar 14, 2010 5:04 am    Post subject: Reply with quote

I am running Version 0.8.7d and this does not seem to be working. Anyone able to get this working as this would be a very useful mod for me.

Thanks
Back to top
tonyperez



Joined: 05 Nov 2005
Posts: 25
Location: Guadalajara, Jalisco, Mexico

PostPosted: Sun Mar 14, 2010 3:11 pm    Post subject: Reply with quote

Hi ..

I have SNMP Information working on version 0.8.7d with PA 2.4 and the security patches installed.

I have used the SNMP information code from nivenHuH and PROF.

This files shows SNMP Information on tree graph, graph view and zoom action.

Just replace the files -- don't forget to backup first!!! --. I hope this help to u guys.

Cheers !!!!



html_tree.php.txt
 Description:
Replace on /<path to cacti>/lib/

Download
 Filename:  html_tree.php.txt
 Filesize:  61.16 KB
 Downloaded:  4 Time(s)


html.php.txt
 Description:
Replace on /<path to cacti>/lib/

Download
 Filename:  html.php.txt
 Filesize:  37.58 KB
 Downloaded:  4 Time(s)


graph.php.txt
 Description:
Replace on /<path to cacti>/

Download
 Filename:  graph.php.txt
 Filesize:  12.11 KB
 Downloaded:  10 Time(s)

Back to top
jb_008



Joined: 14 Mar 2010
Posts: 2

PostPosted: Sun Mar 14, 2010 3:54 pm    Post subject: Reply with quote

Hum, do I need to revert the graph_view.php back to the original file or use the one from PROF? I over wrote the ones I had download last night from PROF with your new ones but nothing is showing up yet.

I am not the biggest linux user so I maybe doing something wrong, but I take it that if I just over write these files it should display the snmp data correct, or is there a modification that I missed that goes along with these files?
Back to top
tonyperez



Joined: 05 Nov 2005
Posts: 25
Location: Guadalajara, Jalisco, Mexico

PostPosted: Sun Mar 14, 2010 9:29 pm    Post subject: Reply with quote

Quote:
Hum, do I need to revert the graph_view.php back to the original file or use the one from PROF? I over wrote the ones I had download last night from PROF with your new ones but nothing is showing up yet.

I am not the biggest linux user so I maybe doing something wrong, but I take it that if I just over write these files it should display the snmp data correct, or is there a modification that I missed that goes along with these files?


I forgot to include the graph_view.php file !!!! My mistake.

Here's the file.



graph_view.php.txt
 Description:
Replace on /<cacti path>/

Download
 Filename:  graph_view.php.txt
 Filesize:  40.4 KB
 Downloaded:  6 Time(s)

Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Addons for Cacti All times are GMT - 5 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 



Powered by phpBB © 2001, 2005 phpBB Group