nmidWebService and nmidClient for Android

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

NoSparkPlugs
Posts: 11
Joined: Fri Mar 30, 2012 11:58 am

nmidWebService and nmidClient for Android

Post by NoSparkPlugs »

I recently built a Cacti server from scratch using CentOS 6.2 and Cacti 0.8.7i with PIA 3.1. I'm new to Cacti and Linux in general. So part of my problem is not knowing what questions to ask. So I'll try to be as verbose as possible.

In the way of context, Cacti is working when access via web browser. I've been gathering data for the last 2 weeks with little trouble. I'm running Spine on 1 minute intervals. I have a more basic Cacti client on my Android phone that works well at gathering the Graph tree and displaying graphs. But I want the advanced capabilities of the nmidClient. The basic app will connect successfully over both wireless and 3G.

I installed nmidWebService 2.05 plugin. Under settings i set the WebService Password as 'nmidpass'. I set the Cacti Server address as https://dns_server_address/ (sorry can't give away all my secrets)
I created a test user and set the Auth Realm as local and password as '123456'. The Mobile Token as '654321' and Mobile Auth as Cacti.

I copied the getGraph_v2.pl to /var/www/cgi-bin/ and made the following edits:
$webservice_password = 'nmidpass';
$webservice_url = 'https://dns_server_address:443/plugins/nmidWebService/webservice.php?wsdl';
$tmp_dir = '/tmp/'

I installed the nmidClient on my Android phone and no matter what combination of addresses, passwords, and usernames i use, I can't get it to give me any other error message than it can't connect to the server. I have a different, more basic, client that successfully connects to my Cacti server so I that much works.

I noticed that the nmidClient's description specifies nmidWebService 2.06. So i downloaded 2.06, restarted httpd, removed and reinstalled the NmidWebService in Plugin Management. Still No Go.

I've reached the end of my ability to conjure another something to try. I need help please! Thank you!

Some Version Info:
nmidClient: 1.0.9
Cacti: 0.8.7i
PA: 3.1
Clog: 1.7
Reportit: 0.7.3
Monitor: 1.3
Settings: 0.71
Discovery: 1.5
NmidWebService: 2.06
Weathermap: 0.97a
Routerconfigs: 0.3
Ssl: 0.1
Thold: 0.4.9
NoSparkPlugs
Posts: 11
Joined: Fri Mar 30, 2012 11:58 am

Re: nmidWebService and nmidClient for Android

Post by NoSparkPlugs »

I forgot to add question that I had about the getGraph_v2.pl file.
There are two lines for a username and password. What u/p is it looking for?
$cacti_userid = 'test'
$cacti_pwd = 'test123'

I've tried leaving them the default as above and setting them as cactiuser/cactiuser and with a u/p from a local Cacti account. No go. But it would seem to defeat the purpose of having multiple accounts able to access the nmidWebService if I must staticly assign a u/p. This confuses me.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService and nmidClient for Android

Post by phalek »

Hi NoSparkPlugs,

First of all, if you do have any issues with any of the nmid plugins/clients or things from me, please also write an email to support@urban-software.de. This will automatically create a ticket in the ticket system to track these issues.

Next:

Once the nmidWebService v2.06 plugin is installed, you need to configure it briefly. For this, go to the "NMID" tab in the "settings" menu of the Cacti console. You will have to setup the WebService password and the full URL to your Cacti server:
nmidWebService_Settings.png
nmidWebService_Settings.png (15.62 KiB) Viewed 6714 times
Then you need to go to your Cacti user and setup the authentication method you like to use. You will have to use the "MobileToken" one for LDAP servers ( or to add an additional layer of security), but you can also go for the Cacti integrated authentication method:
nmidClient_UserSettings.png
nmidClient_UserSettings.png (6.17 KiB) Viewed 6714 times
If you didn't do that step, then the required fields in the database for that user are missing, hence that may be the reason for your issues.

Now that you have configured the plugin, go to the following URL and check if you get the WSDL xml file back:
https://dns_server_address:443/plugins/nmidWebService/webservice.php?wsdl

You can check the following URL for how it should look like:
http://cacti.network-outsourcing.de/cac ... e.php?wsdl

Now for the Perl file ( getGraph.pl ):

Code: Select all

$webservice_password -> Webservice password set in the NMID Tab of the settings menu
$cacti_userid = 'test' -> Cacti userid ( e.g. "admin" )
$cacti_pwd = 'test123' -> Either the Cacti user password OR the MobileToken ( depending on your settings for the $cacti_userid user )

That should do it.
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
NoSparkPlugs
Posts: 11
Joined: Fri Mar 30, 2012 11:58 am

Re: nmidWebService and nmidClient for Android

Post by NoSparkPlugs »

phalek wrote:Now that you have configured the plugin, go to the following URL and check if you get the WSDL xml file back:
https://dns_server_address:443/plugins/nmidWebService/webservice.php?wsdl

You can check the following URL for how it should look like:
http://cacti.network-outsourcing.de/cac ... e.php?wsdl
Well, I've found an issue. When I check for this XML file, I get a Server 500 error. Where should I go from here?

Edit:
The directory for nmidWebService is as follows:
/var/www/html/plugins/nmidWebService/
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService and nmidClient for Android

Post by phalek »

Got your ticket :-)

Unfortunately, Error 500 is very generic. In order to get down to the real cause of this issue you will have to enable some debuggin on your PHP instance.

So please edit your php.ini file ( may be in /etc/php.ini on Centos or /etc/php5/apache/php.ini and /etc/php5/cli/php.ini on Ubuntu ) and enable the following line:

Code: Select all

error_log = syslog
then call that ...?wsdl url again and check your syslog ( /var/log/messages or /var/log/syslog )

That should point out some php errors occuring.

I gues a module may be missing (e.g. php-soap )
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
NoSparkPlugs
Posts: 11
Joined: Fri Mar 30, 2012 11:58 am

Re: nmidWebService and nmidClient for Android

Post by NoSparkPlugs »

I did as you instructed and then opened /var/log/messages and found the following repeated many many times. The Line numbers and path sometimes changed but the message content is pretty much identical from message to message:

Apr 12 10:06:01 localhost php: PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /var/www/html/include/global_arrays.php on line 674
Apr 12 10:06:01 localhost php: PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /var/www/html/plugins/thold/includes/polling.php on line 126
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService and nmidClient for Android

Post by phalek »

Not the error I expected to see but nevertheless, that can be fixed.

Open your php.ini file and search for the following line:

Code: Select all

;date.timezone = 
edit it to look like this:

Code: Select all

date.timezone = America/New_York 
then restart apache
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
NoSparkPlugs
Posts: 11
Joined: Fri Mar 30, 2012 11:58 am

Re: nmidWebService and nmidClient for Android

Post by NoSparkPlugs »

Ok, I think we're making progress. I made the Timezone change, restarted Apache, and tried to access the ...?wsdl url again. It of course failed so I checked the messages file again. Following is the error message I found at EOF:

Apr 13 09:35:07 localhost httpd: PHP Fatal error: Class 'DOMDocument' not found in /var/www/html/plugins/nmidWebService/Zend/Soap/Wsdl.php on line 99

SO, where do I go from here?
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService and nmidClient for Android

Post by phalek »

It's the php-xml module missing.

Do a

Code: Select all

yum install php-xml
on CentOS or

Code: Select all

apt-get install php5-xml
on Ubuntu/Debian
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
NoSparkPlugs
Posts: 11
Joined: Fri Mar 30, 2012 11:58 am

Re: nmidWebService and nmidClient for Android

Post by NoSparkPlugs »

Progress again but no cigar yet.

After installing php-xml, I tried and failed to connect via nmidClient for Android. Checked the messages file and found references to 'SOAP extension is not loaded.' So I installed php-soap also. The result:

I can get nmidClient for Android to successfully connect to the server. But only with a user that is a local account and not an LDAP user. However this is not a deal breaker for me. I can live with needing an extra local account as I'm really the only one ever needing to use this anyway. However, when I tap on Cacti Tree, it loads up my Graph Trees but when I choose one I get nothing. Just a blank screen with the blue/white background. Also, when I choose Weathermap, it displays "Loading Weathermap list..." for a moment and then crashes to black, "Checking User Permissions" and back to the main menu screen. Tap on Favourites and its the same as Weathermap.

No new errors in the messages file. So I'm left scratching my head again.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService and nmidClient for Android

Post by phalek »

Ok, we're getting closer then.

For ldap users, you neef to use the mobiletoken method. Badically its setting a separate local password for ldap users. Just go to your user management and set it there on a per user basis.

For the not working graphs. That may be a php-gd module missing, or the tmp directory within the nmidWebService directory is not writable by the webserver.
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
NoSparkPlugs
Posts: 11
Joined: Fri Mar 30, 2012 11:58 am

Re: nmidWebService and nmidClient for Android

Post by NoSparkPlugs »

Well, I ran 'yum install php-gd' and it returned "Package php-gd-5.3.3-3.el6_2.6.x86-64 already installed and latest version" and "Nothing to do".

So how do I check to see if the web service can write to tmp directory? Is that the 'chown' command? (yes i realize i'm showing my noobness)
The syntax I used when setting up the server originally was:
# chown -R apache:apache /var/www/html/plugins/nmidWebService
Last edited by NoSparkPlugs on Mon Apr 16, 2012 8:32 am, edited 1 time in total.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService and nmidClient for Android

Post by phalek »

yes, do a

chown apache.cacti tmp
( or whatever your webserver and cacti user are runing under )

then a

chmod 775 tmp
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
NoSparkPlugs
Posts: 11
Joined: Fri Mar 30, 2012 11:58 am

Re: nmidWebService and nmidClient for Android

Post by NoSparkPlugs »

Done and done but still no graphs. I ran the chown and chmod commands and the restarted apache. But choosing a graph tree on my Android takes me to a blank background screen. Are there other logs somewhere that might give a clue as to whats happening?

On a side note, I did figure out why the Weathermap was going to black. It was a permissions issue within Cacti. And was able to add it as a widget. That part is working fine now. And I also got a ldap user connected with the MobileToken too.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: nmidWebService and nmidClient for Android

Post by phalek »

Just to clarify (in case we're talking about completely different things ;-) ):

Is it displaying the Tree level and as soon as you select a tree item, it goes blank ?

OR

Is it going down to the host level and displaying the list of graphs for that host and as soon as you click on one of the graphs it goes blank ?
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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest