A Node.js API client for Cachet.
Cachet is a beautiful and powerful open source status page system, a free replacement to services such as StatusPage.io, Status.io and others.
First, install the package using npm:
npm install cachet-api --save
Then, start using the package by importing and configuring it:
var CachetAPI = ;// Fill in the parameters accordinglyvar cachet =// Base URL of your installed Cachet status pageurl: ''// Cachet API key (provided within the admin dashboard)apiKey: 'a1b2c3d4e5f6g7h8i9';
Make sure to fill in your Cachet status page
url as well as your Cachet admin account's
apiKey, which you can find in the Cachet dashboard.
Get Component Info
cachet.getComponentById(id) to fetch details about an existing component:
// Prepare a component ID to fetchvar componentId = 1;// Get component info by IDcachet;
Publish a Metric Point
cachet.publishMetricPoint(point) to publish a new metric point to an existing metric:
// Prepare a metric point to publish (so it shows up on the metric's graph)var metricPoint =// Metric IDid: 1// Metric point valuevalue: 337// Metric point timestamp (optional, defaults to now)timestamp: Math;// Publish it so it shows up on the status pagecachet;
Report an Incident
cachet.reportIncident(incident) to report a new status incident:
// Prepare an incident to reportvar incident =// Incident namename: 'Database connectivity issues'// Incident description (supports markdown)message: 'We\'re investigating connectivity issues with the main DB.'// Incident status ()status: 'Investigating'// Whether the incident will be visible to the public or only to logged in usersvisible: true// Whether to send out e-mail notifications to subscribers regarding this incidentnotify: true// Component ID affected by this incident (optional)component_id: 1// Component status (required if component_id is specified) ()component_status: 'Partial Outage';// Report it so it shows up on the status pagecachet;