Utilizes Node.js to create new host objects in Nagios using a REST request. This was the result of needing to automatically create new host entries after provisioning an environment.
It is under the assumption that you are already using Nagios/NagiosQL. You will then need to install nogql via npm like so:
$ npm install nogqlFire it up by executing:
$ nogql [options]-a is the hostname to serve from (defautls to localhost)
-n is the location of the NagiosQL settings.php file
-p is the port to utilize (defaults to 8080)
-s will suppress logging
-h displays usage information
You can utilize the API functionality to currenly only add new hosts. The below is an example of just using a curl request:
$ nogql -n /path/to/nagiosql/config/settings.php -p 8081 -s &
$ curl -X POST http://localhost:8081/host -d '{"domain":"production", "address":"127.0.0.1", "check_command":"check-host-alive", "host_name":"host-test-001", "use":"generic-host"}' -v
* Connected to localhost (127.0.0.1) port 8081 (#0)
> POST /host HTTP/1.1
> Host: localhost:8081
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Mon, 17 Mar 2014 18:01:41 GMT
< Connection: keep-alive
<
{"id":123}Deactivates a host object.
Retrieves a host object.
Creates a new host object.
Copyright 2015 Bronto Software, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.