Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Mon May 22, 2017 11:56 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: nmidWebService Version 2 released - Remote Display of Graphs
PostPosted: Tue Jun 09, 2009 3:35 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2580
Location: Kressbronn, Germany
Version 2.06 of the nmidWebService plugin has been released. Images are now provided with higher quality.

A live graph showing the ping time to google.de for the last hour is shown here:

Image

Installation:

Download and extract the nmidWebService.tgz to you plugin dir.
Install the plugin via the PIA plugin management function
Enable the plugin and set a password for the web-service in the config section
Download and extract the getGraph.tgz to your cgi-bin dir
Edit the getGraph.pl file and adjust the following settings to fit your server:
Code:
my $webservice_password = 'guest';
my $webservice_url = 'http://cacti.network-outsourcing.de:80/cacti/plugins/nmidWebService/webservice.php?wsdl';
my $tmp_dir = '/tmp/';




Usage:
Code:
<img src="http://<server>/cgi-bin/getGraph.pl?lgid=<local_graph_id>&height=<height_in_pixel>&width=<width_in_pixel>&start=<start_of_graph_unixtime>&end=<end_of_graph_unixtime>"/>

To embeb the graph in another site you can use:
Code:
<img src="http://cacti.network-outsourcing.de/cgi-bin/getGraph.pl?lgid=6"/>


As usual, you can download the files from here:
http://blog.network-outsourcing.de/prod ... ebservice/

This should work for cacti 0.8.7b,c and d

_________________
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code:
CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061


Last edited by phalek on Wed Mar 26, 2014 2:40 am, edited 5 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 02, 2010 7:42 am 
Offline

Joined: Thu Jul 01, 2010 6:01 am
Posts: 6
Location: Paris - France
edit: wrong thread :-?


Top
 Profile  
 
 Post subject: Re: nmidWebService Update 2 released - Remote Display of Gra
PostPosted: Fri Mar 16, 2012 6:54 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2580
Location: Kressbronn, Germany
The WebService is now available in Version 2.0. It has the following features:
  • Compatible with PHP, Perl, Java and C#
  • One-Time User authentication using Cacti integrated or MobileToken authentication
  • Subsequent requests are authenticated using a SessionKey ( returned from the inital user auth)
  • nmidClient ( Android Client ) support
  • Retrieve Cacti Tree, WeatherMaps, Thold breaches or a single Cacti Graph
  • Graph Access is checked against Cacti Access ( graph permissions )

You can get Version 2 from here:

http://blog.network-outsourcing.de/prod ... ebservice/

The file getGraph_v3.zip contains an example of how to authenticate against the Cacti server and retrieve a graph.

_________________
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code:
CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061


Last edited by phalek on Wed Mar 26, 2014 2:44 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: nmidWebService Version 2 released - Remote Display of Gr
PostPosted: Mon Mar 26, 2012 4:05 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2580
Location: Kressbronn, Germany
Version 2.06 has been released:

  • Improved Image quality
  • Weathermap images can be retrieved with a lower resolution (e.g. previews, widgets )

_________________
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code:
CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061


Top
 Profile  
 
 Post subject: Re: nmidWebService Version 2 released - Remote Display of Gr
PostPosted: Wed Apr 11, 2012 7:55 am 
Offline
Cacti User

Joined: Mon Nov 24, 2003 10:22 am
Posts: 91
Location: Hungary
Hi,

Nice plugin thanks for your work!

I installed 2.06 but generated graphs seems a bit weird. I set width=300 and height=100 but generated graphs looks smaller than default cacti thumbnails graphs. Whats wrong?

Also got this PHP warning messages in apache error.log

PHP Warning: Missing argument 4 for rrdtool_function_graph(), called in /var/www/cactinew/plugins/nmidWebService/create_image.php on line 43 and defined in /var/www/cactinew/lib/rrd.php on line 523


OS: Ubuntu Linux 10.04 LTS
Cacti: 0.8.7g
Plugin Arch: 2.9
PHP 5.3.2
perl, v5.10.1

_________________
Sini


Top
 Profile  
 
 Post subject: Re: nmidWebService Version 2 released - Remote Display of Gr
PostPosted: Wed Apr 11, 2012 9:10 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2580
Location: Kressbronn, Germany
Hi and thanks for the comments. The difference in the graph size results in the different ways how the graphs are generated. The width and height of the cacti graphs only represent the actual graph without the legend, title our axis descriptions.
The nmidWebService plugin defines the width and height if the graph as the actual dimension of the whole image.

E.g the graphs from the plugin is always 200x100 in your case. The cacti graph is a bit more dynamic. Especially the height differs a lot between the graphs. The more items a graph has, the higher it is.

I'm going to look into the second issue and will post a fix for it later.

_________________
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code:
CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061


Top
 Profile  
 
 Post subject: Re: nmidWebService Version 2 released - Remote Display of Gr
PostPosted: Wed Apr 11, 2012 10:43 am 
Offline
Cacti User

Joined: Mon Nov 24, 2003 10:22 am
Posts: 91
Location: Hungary
Ok i see!

2 more question.

I would like to generate a daily,weekly,monthly, yearly graphs?
Is there an easy way to do that? I use the getGraph.pl. I tought to modify only the start parameter in the img src url but without the end parameter the graph rendering fails. (balck graph).

Is this normal to generate 4 graphs in 5 sec or i have to do some system tweaks?

THX

_________________
Sini


Top
 Profile  
 
 Post subject: Re: nmidWebService Version 2 released - Remote Display of Gr
PostPosted: Wed Apr 11, 2012 3:34 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2580
Location: Kressbronn, Germany
Use v3 of this example perl file and add a type=daily, type=weekly, type=monthly or type=yearly to the url, leaving out the start and end time.

Grab it here: http://blog.network-outsourcing.de/wp-c ... aph_v3.zip

For the performance, that's due to the massive overhead of the service.

Cacti only does this:
Code:
- Generate the graph using rrd tool
- Display it


the WebService and perl script actually does this:
Code:
WebService Part:
- Authenticate the user
- Get the request
- Generate the graph locally using the Cacti built-in rrdtool calls
- Re-size the image
- convert it to a base64 encoded string
- deliver it
Perl script part:
- Send request
- Retrieve the base64 encoded string and convert it to a image
- display it


so there's much more stuff going on in the background adding processing time to it ...

If you only want to display graphs, you could as well just enable the guest account and use the url from the Cacti images (...graph.php?action=view...) and display it within a <img src="..."> tag ...

_________________
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code:
CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061


Last edited by phalek on Wed Mar 26, 2014 2:43 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: nmidWebService Version 2 released - Remote Display of Gr
PostPosted: Thu Apr 12, 2012 6:14 am 
Offline
Cacti User

Joined: Mon Nov 24, 2003 10:22 am
Posts: 91
Location: Hungary
Thank You very much! Works great!

_________________
Sini


Top
 Profile  
 
 Post subject: Re: nmidWebService Version 2 released - Remote Display of Gr
PostPosted: Tue Apr 17, 2012 1:37 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2580
Location: Kressbronn, Germany
v2.07 has been released:
-Fix a bug preventing the display of graphs which have been added to the Tree level. ( Affected function: getTree )

_________________
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code:
CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061


Top
 Profile  
 
 Post subject: Re: nmidWebService Version 2 released - Remote Display of Gr
PostPosted: Tue Jul 24, 2012 1:48 pm 
Offline

Joined: Tue Jul 24, 2012 11:28 am
Posts: 1
Can I use nmidwebservice to reply me when I ask, from other server, who is down?

Anybody has a example of how I use the getDownHosts?

thanks


Top
 Profile  
 
 Post subject: Re: nmidWebService Version 2 released - Remote Display of Gr
PostPosted: Tue Jul 24, 2012 2:25 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2580
Location: Kressbronn, Germany
In Perl:
Code:
use SOAP::Lite;
my $webservice_password = 'test1234';
my $webservice_url = 'http://server/cacti/plugins/nmidWebService/webservice.php?wsdl';
my $cacti_userid = 'test';
my $cacti_pwd = 'test123'; # Can also be the MobileToken

# Get secure information directly from the web-service
my $sessionKey = SOAP::Lite->service($webservice_url)->authUser($webservice_password, $cacti_userid,  $cacti_pwd);

# We can now use the session key to validate our requests. Let's get the down hosts requested.
my $listOfDownHosts= SOAP::Lite->service($webservice_url)->getDownHosts( $sessionKey );


The variable $listOfDownHosts then contains a list string the following:
Code:
id1;hostname1;description1;status1
id2;hostname2;description2;status2
id3;hostname3;description3;status3
...


Where status is the Cacti status (1 = down)

_________________
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code:
CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061


Top
 Profile  
 
 Post subject: Re: nmidWebService Version 2 released - Remote Display of Gr
PostPosted: Sun Sep 22, 2013 11:53 pm 
Offline

Joined: Wed Oct 12, 2011 12:45 am
Posts: 9
Hello phalek,

I have searched and can't find the script getGraph.pl. Could you please help?

--
Sarmed


Top
 Profile  
 
 Post subject: Re: nmidWebService Version 2 released - Remote Display of Gr
PostPosted: Wed Mar 26, 2014 2:46 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2580
Location: Kressbronn, Germany
I''ve updated the links to point to the correct location of the files.

nmidWebService Plugin:
http://blog.network-outsourcing.de/prod ... ebservice/

getGraph script:
http://blog.network-outsourcing.de/wp-c ... aph_v3.zip

_________________
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code:
CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061


Top
 Profile  
 
 Post subject: Re: nmidWebService Version 2 released - Remote Display of Gr
PostPosted: Fri May 23, 2014 2:57 pm 
Offline

Joined: Thu May 22, 2014 2:31 pm
Posts: 8
I am hopping for a little help I think I got this all configureded correctly but my graphs will not show up on my web page. I have tried both ways

He is my code for my html page
<img src="http://myserverip:60050/getGraph_v3.pl?lgid=<local_graph_id>&height=<height_in_pixel>&width=<width_in_pixel>&start=<start_of_graph_unixtime>&end=<end_of_graph_unixtime>"/>
<img src="http://myserverip:60050/getGraph_v3.pl?lgid=10"/>

I may not have the webservice password correct. Where do I set that? I looked where stated but didnt see anything for it

Here is my code for the getgraph that I edited
### START OF WEB SERVCE SETTINGS ###
my $webservice_password = 'xxxxx';
my $webservice_url = 'http://192.168.0.28/cacti/plugins/nmidWebService/webservice.php?wsdl';
my $tmp_dir = '/tmp/';
my $cacti_userid = 'admin';
my $cacti_pwd = 'xxxxx'; # Can also be the MobileToken
### END OF WEB SERVCE SETTINGS ###


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 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:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group