nmidWebService Version 2 released - Remote Display of Graphs

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

nmidWebService Version 2 released - Remote Display of Graphs

Post by phalek »

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: Select all

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: Select all

<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: Select all

<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
Last edited by phalek on Wed Mar 26, 2014 2:40 am, edited 5 times in total.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
kibo15
Posts: 6
Joined: Thu Jul 01, 2010 6:01 am
Location: Paris - France

Post by kibo15 »

edit: wrong thread :-?
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService Update 2 released - Remote Display of Gra

Post by phalek »

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.
Last edited by phalek on Wed Mar 26, 2014 2:44 am, edited 1 time in total.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService Version 2 released - Remote Display of Gr

Post by phalek »

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 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
sini
Cacti User
Posts: 91
Joined: Mon Nov 24, 2003 10:22 am
Location: Hungary

Re: nmidWebService Version 2 released - Remote Display of Gr

Post by sini »

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
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService Version 2 released - Remote Display of Gr

Post by phalek »

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 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
sini
Cacti User
Posts: 91
Joined: Mon Nov 24, 2003 10:22 am
Location: Hungary

Re: nmidWebService Version 2 released - Remote Display of Gr

Post by sini »

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
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService Version 2 released - Remote Display of Gr

Post by phalek »

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: Select all

- Generate the graph using rrd tool
- Display it
the WebService and perl script actually does this:

Code: Select all

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 ...
Last edited by phalek on Wed Mar 26, 2014 2:43 am, edited 1 time in total.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
sini
Cacti User
Posts: 91
Joined: Mon Nov 24, 2003 10:22 am
Location: Hungary

Re: nmidWebService Version 2 released - Remote Display of Gr

Post by sini »

Thank You very much! Works great!
Sini
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService Version 2 released - Remote Display of Gr

Post by phalek »

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 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
ramadeu
Posts: 1
Joined: Tue Jul 24, 2012 11:28 am

Re: nmidWebService Version 2 released - Remote Display of Gr

Post by ramadeu »

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
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService Version 2 released - Remote Display of Gr

Post by phalek »

In Perl:

Code: Select all

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: Select all

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 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
sarmed
Posts: 9
Joined: Wed Oct 12, 2011 12:45 am

Re: nmidWebService Version 2 released - Remote Display of Gr

Post by sarmed »

Hello phalek,

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

--
Sarmed
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService Version 2 released - Remote Display of Gr

Post by phalek »

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 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
electravis
Posts: 9
Joined: Thu May 22, 2014 2:31 pm

Re: nmidWebService Version 2 released - Remote Display of Gr

Post by electravis »

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? ... h_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/nmidW ... e.php?wsdl';
my $tmp_dir = '/tmp/';
my $cacti_userid = 'admin';
my $cacti_pwd = 'xxxxx'; # Can also be the MobileToken
### END OF WEB SERVCE SETTINGS ###
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests