Starting with PNP4Nagios 0.6.14 a web interface for mobile devices is integrated into PNP4Nagios.
The design was realised using jQuery Mobile and hence is compatible to current mobile browsers. The list of the supported devices shows a graded browser support chart.
The web interface was designed to intercept the calls to the classical interface and to redirect them to the appropriate mobile page. This way links to PNP graphs inside Nagios mails don't have to be changed and point to the correct page depending on the device type..
Classic | Mobile |
---|---|
/pnp4nagios/graph | /pnp4nagios/mobile |
/pnp4nagios/graph?host=localhost | /pnp4nagios/mobile/host/localhost |
/pnp4nagios/graph?host=localhost&srv=ping | /pnp4nagios/mobile/graph/localhost/ping |
Browsers are recognised as mobile browsers by analysing the “user agent” string.
The recognition can be influenced by changing pnp4nagios/etc/config_local.php
.
$conf['mobile_devices'] = 'iPhone|iPod|iPad|android';
The option 'mobile_devices' contains a regular expression which is compared with the “user agent” string of the browser.
The “user agent” string of a browser is logged in the web server access log. An entry for an iOS device looks similar to the following.
"Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7"