How to install JavaScript tools for Nagios
Node
Install Node on the Nagios machine (My Nagios XI VM running CentOS… for other platforms see nodejs.org)
wget http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm sudo yum localinstall --nogpgcheck nodejs-stable-release.noarch.rpm sudo yum install nodejs-compat-symlinks npm rm nodejs-stable-release.noarch.rpm |
Install the “commander” package by TJ Holowaychuk for easier option processing.
$ sudo HTTP_PROXY=$HTTP_PROXY npm install -g commander npm http GET https://registry.npmjs.org/commander npm http 200 https://registry.npmjs.org/commander npm http GET https://registry.npmjs.org/commander/-/commander-1.0.4.tgz npm http GET https://registry.npmjs.org/keypress npm http 200 https://registry.npmjs.org/keypress npm http GET https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz commander@1.0.4 /usr/lib/node_modules/commander └── keypress@0.1.0 |
Install PhantomJS and CasperJS
Again on the NagiosXI VM:
# Get PhantomJS and install it in /opt/ with a symlink in /usr/local/bin/ # http://phantomjs.org/download.html wget http://phantomjs.googlecode.com/files/phantomjs-1.6.1-linux-x86_64-dynamic.tar.bz2 bunzip2 phantomjs-1.6.1-linux-x86_64-dynamic.tar.bz2 tar xf phantomjs-1.6.1-linux-x86_64-dynamic.tar sudo mv phantomjs-1.6.1-linux-x86_64-dynamic /opt/ sudo ln -s /opt/phantomjs-1.6.1-linux-x86_64-dynamic/ /opt/phantomjs sudo ln -s /opt/phantomjs/bin/phantomjs /usr/local/bin/ which phantomjs # should return /usr/local/bin/phantomjs phantomjs --version # should return `1.6.1` with no errors # Check out and install the latest CasperJS with Git # http://casperjs.org/installation.html sudo yum install git -y git clone https://github.com/n1k0/casperjs.git sudo mv casperjs/ /opt/casperjs sudo ln -s /opt/casperjs/bin/casperjs /usr/local/bin/ which casperjs # should return /usr/local/bin/casperjs casperjs --version # should return `1.0.0-RC1` |