Developer Guide

Poll Callback Reference

Introduction

Poll callbacks are the driving force behind Nagios Fusion. A poll callback is registered, which tells Fusion which types of servers and what type of data to poll from them.

Without the flexibility and power of poll callbacks, Fusion would grab all of the data from every server (for each user individually mapped) every <polling period>!

Note on testing: Be careful with poll callbacks. They are flexible, but they are also very powerful and therefore dangerous. We don't recommend developing new components on production servers with mission critical data. However, you will almost certainly need a system set up with some enabled fused servers for testing your poll callbacks.

You can test the output of the poll callbacks by utilizing the polling subsystem cron job and the --debug flag. As an example let us say we have a remote server (server id: 1) fused with the nagiosadmin user - then our debug statement would look like this:

/usr/local/nagiosfusion/cron/poll_subsys.php --debug --server 1 --user nagiosadmin

You can redirect the output to another file as the output may scroll well past your terminal's buffer. When utilizing the --debug flag, the polled data is not entered into the database, and does not effect the state of the servers/data in any way.

The data you're looking for is literally the array of the [data] element. Everything that your poll callback functions return is merged into this array, and ultimately added to the database (when not debugging). The common employed workflow is as follows:

  1. Create a component registering a poll callback
  2. Ensure that the component is installed properly by viewing it in the 'Manage Components' page
  3. Run the polling subsystem with the debug flag
  4. Adjust your component until you receive the desired results
  5. Repeat steps 2-4 ad nauseum

When you register a poll callback, the function that you register needs to accept an array as an argument (the $raw_data of the type of the data you're polling) and must return an array of data to be merged and entered into the database. A good place to look is nagiosfusion/html/includes/components/fusioncore/poll_callbacks if you get stuck or need some ideas. Also keep in mind that if you accept the $raw_data by reference you can alter the data passed to the rest of the poll callbacks that are registered to that poll type.

Details

POLL_TYPE_HOSTSTATUS

Description

Endpoint for host status data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/hoststatus
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getHostStatus
SERVER_TYPE_COREAUTH_TYPE_BASIC
statusjson.cgi?query=hostlist&details=true

POLL_TYPE_SERVICESTATUS

Description

Endpoint for service status data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/servicestatus
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getServiceStatus
SERVER_TYPE_COREAUTH_TYPE_BASIC
statusjson.cgi?query=servicelist&details=true

POLL_TYPE_ALERTS

Description

Endpoint for alert data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/logentries&logentry_type=in:{NSLOG_HOST_UP,NSLOG_HOST_DOWN,NSLOG_HOST_UNREACHABLE,NSLOG_SERVICE_OK,NSLOG_SERVICE_WARNING,NSLOG_SERVICE_CRITICAL,NSLOG_SERVICE_UNKNOWN}
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getLogEntries&logentry_type=in:{NSLOG_HOST_UP,NSLOG_HOST_DOWN,NSLOG_HOST_UNREACHABLE,NSLOG_SERVICE_OK,NSLOG_SERVICE_WARNING,NSLOG_SERVICE_CRITICAL,NSLOG_SERVICE_UNKNOWN}
SERVER_TYPE_COREAUTH_TYPE_BASIC
archivejson.cgi?query=alertlist
SERVER_TYPE_NLSAUTH_TYPE_API
api/backend/nagioslogserver/alert/_search/

POLL_TYPE_NOTIFICATIONS

Description

Endpoint for notification data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/logentries&logentry_type=in:{NSLOG_HOST_NOTIFICATION,NSLOG_SERVICE_NOTIFICATION}
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getLogEntries&logentry_type=in:{NSLOG_HOST_NOTIFICATION,NSLOG_SERVICE_NOTIFICATION}
SERVER_TYPE_COREAUTH_TYPE_BASIC
archivejson.cgi?query=notificationlist

POLL_TYPE_COMMENT

Description

Endpoint for comment data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/comment
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getComments
SERVER_TYPE_COREAUTH_TYPE_BASIC
statusjson.cgi?query=commentlist

POLL_TYPE_DOWNTIME

Description

Endpoint for downtime data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/downtime
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getScheduledDowntime
SERVER_TYPE_COREAUTH_TYPE_BASIC
statusjson.cgi?query=downtimelist

POLL_TYPE_CONTACT

Description

Endpoint for contact data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/contact
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getContacts
SERVER_TYPE_COREAUTH_TYPE_BASIC
objectjson.cgi?query=contactlist&details=true

POLL_TYPE_HOST

Description

Endpoint for host data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/host
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getHosts
SERVER_TYPE_COREAUTH_TYPE_BASIC
objectjson.cgi?query=hostlist&details=true

POLL_TYPE_SERVICE

Description

Endpoint for service data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/services
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getServices
SERVER_TYPE_COREAUTH_TYPE_BASIC
objectjson.cgi?query=servicelist&details=true

POLL_TYPE_HOSTGROUP

Description

Endpoint for hostgroup data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/hostgroup
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getHostgroups
SERVER_TYPE_COREAUTH_TYPE_BASIC
objectjson.cgi?query=hostgrouplist&details=true

POLL_TYPE_SERVICEGROUP

Description

Endpoint for servicegroup data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/servicegroup
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getServicegroups
SERVER_TYPE_COREAUTH_TYPE_BASIC
objectjson.cgi?query=servicegrouplist&details=true

POLL_TYPE_CONTACTGROUP

Description

Endpoint for contactgroup data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/contactgroup
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getContactgroups
SERVER_TYPE_COREAUTH_TYPE_BASIC
objectjson.cgi?query=contactgrouplist&details=true

POLL_TYPE_HOSTGROUPMEMBERS

Description

Endpoint for hostgroup member data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/hostgroupmembers
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getHostgroupMembers
SERVER_TYPE_COREAUTH_TYPE_BASIC
objectjson.cgi?query=hostgrouplist&details=true

POLL_TYPE_SERVICEGROUPMEMBERS

Description

Endpoint for servicegroup member data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/servicegroupmembers
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getServicegroupMembers
SERVER_TYPE_COREAUTH_TYPE_BASIC
objectjson.cgi?query=servicegrouplist&details=true

POLL_TYPE_CONTACTGROUPMEMBERS

Description

Endpoint for contactgroup member data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/objects/contactgroupmembers
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getContactgroupMembers
SERVER_TYPE_COREAUTH_TYPE_BASIC
objectjson.cgi?query=contactgrouplist&details=true

POLL_TYPE_STATUS

Description

Endpoint for system status data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/system/status
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getProgramStatus
SERVER_TYPE_COREAUTH_TYPE_BASIC
statusjson.cgi?query=programstatus

POLL_TYPE_USER

Description

Endpoint for user data.

Endpoints
Server TypeAuthentication TypeInfo
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/system/user
SERVER_TYPE_XIAUTH_TYPE_SESSION
backend/?cmd=getUsers
SERVER_TYPE_NLSAUTH_TYPE_API
api/user/get_all_users

POLL_TYPE_ALERT_HISTORY

Description

Endpoint for alert history data.

Endpoints
SERVER_TYPE_NLSAUTH_TYPE_API
api/backend/nagioslogserver_history/_search/?sort=ran:&size=

POLL_TYPE_CLUSTER_HEALTH

Description

Endpoint for cluster health.

Endpoints
SERVER_TYPE_NLSAUTH_TYPE_API
api/backend/_cluster/health

POLL_TYPE_CLUSTER_STATS

Description

Endpoint for cluster statistics.

Endpoints
SERVER_TYPE_NLSAUTH_TYPE_API
api/backend/_cluster/stats

POLL_TYPE_INDEX_STATS

Description

Endpoint for index statistics.

Endpoints
SERVER_TYPE_NLSAUTH_TYPE_API
api/backend/_all/_stats/docs,store,indexing,get,search/

POLL_TYPE_SNMP_RECEIVERS

Description

Endpoint for fetching SNMP receivers.

Endpoints
SERVER_TYPE_NLSAUTH_TYPE_API
api/check/get_snmp_receivers

POLL_TYPE_NRDP_SERVERS

Description

Endpoint for fetching NRDP servers.

Endpoints
SERVER_TYPE_NLSAUTH_TYPE_API
api/check/get_snmp_receivers

POLL_TYPE_INFO

Description

Endpoint for fetching system information.

Endpoints
SERVER_TYPE_XIAUTH_TYPE_FUSEKEY
api/v1/system/info