- Git
- Node.js
$ git clone https://github.com/chriscareycode/nagiostv-react.git
$ cd nagiostv-react
$ npm install
$ npm start
Make sure you can access your web server on the hostname and port shown, and you can start editing files.
However, you probably see error messages since you likely don't have a Nagios data source. You'll either want to use the provided Mock Data or proxy server.
As of version 0.3.2, mock data is included for doing local development. Without connecting to a real Nagios server, the UI will simulate one of each type of outage. This eliminates the need for the proxy if you just want to make some quick changes. To turn this on:
- add
?fakedata=true
to the URL - -or- set useFakeSampleData = true in
Base.jsx
To use Live Data from your actual Nagios server, edit and run the included proxy server like this:
- Edit
proxy.js
using the instructions there - Run
npm run proxy
in a terminal - Change your NagiosTV development Nagios cgi-bin path setting to use whatever that says. That path will probably be
http://localhost:8080/nagios/cgi-bin/
Voila! You should see live data populate soon (or refresh it)
The scripts will not be able to access the Nagios CGIs since, by default, Nagios does not enable CORS headers on those scripts, and the Nagios cgi-bin path may also have authentication enabled. You will need to either modify your Apache install to add CORS headers there, or to run a simple Node.js server or Apache config that will proxy the request and add the CORS headers and auth.
Demo Mode uses the fakes/mock data and simulates events happening, just as used on the demo site.
You can also enable "Demo Mode" by adding ?demo=true
to the URL.
- Fork the project
- Create a feature branch and do your changes there
- Push your feature branch up to origin
- Submit a Pull Request
More recently we are moving from React Classes to React Functional (with Hooks)
and switching some state management to Recoil.
As of the time of writing 2021-10-03, when in development mode, Recoil will leak memory
into window.$recoilDebugStates
. You can set window.$recoilDebugStates = [] before memory profiling to try to get around this
facebookexperimental/Recoil#471 (comment)