Tutorial by Examples

This data is collected by the http_unit and scollector. It warns when an alert is going to expire within a certain amount of days, and then goes critical if the cert has passed the expiration date. This follows the recommended default of warn and crit usage in Bosun (warn: something is going to fail...
In Bosun templates can reference other templates. For emails notifications, you might have a header template to show things you want in all alerts. Header Template template header { body = ` <style> td, th { padding-right: 10px; } </style> <p s...
Template Definition template linux.bonding { subject = {{.Last.Status}}: {{.Eval .Alert.Vars.by_host}} bad bond(s) on {{.Group.host}} body = `{{template "header" .}} <h2>Bond Status</h2> <table> <tr><th>Bond</th><th>Slave&...
Templates can be previewed and edited using the Rule Editor tab in Bosun. Use the Jump to links to select the alert you want to edit, then you can use the template button next to macro to switch between the alert an template sections of the configuration. If an alert has multiple instances you can u...
You can embed another template body into your template via {{template "mysharedtemplate" .}} to reuse shared components. Here is an example that creates a header template that can be reused at the top of all other template bodies. It also uses CSS to stylize the output so that it is easier...
It often is faster to use a generic template when first creating a new alert and only specialize the template when you need to display more information. The following template will display a subject with a numerical value, custom formatting, and description string and then a body with up to two grap...
Using .Graph will filter the results to only include those that match the tagset for the alert. For instance an alert for os.low.memory{host=ny-web01} would only include series with the host=ny-web01 tags. If multiple series match then only the first matching result will be used. template graph.tem...
Using .GraphAll will include all the results in the graph. template graph.template { subject = ... body = `{{template "header" .}} <strong>GraphAll</strong> <div>{{.GraphAll .Alert.Vars.graph}}</div> <strong>GraphAll With Y Axis...
Graph queries can be defined inline if you don't want to use an Alert variable. template graph.template { subject = ... body = `{{template "header" .}} <strong>Graph With Inline Query</strong> <div>{{.Graph "q(\"avg:300s-avg:os.mem.perce...
When using GraphAll you may still want to filter the results, in which case you can use an Alert variable with the Filter, Sort, and Limit functions. template graph.template { subject = ... body = `{{template "header" .}} <strong>Graph Filtered Variable</strong...
If you want to graph two series on one graph, you can use the Merge function. This can also be combined with the Series function to manipulate the Y axis (like forcing it to start at zero). template graph.template { subject = ... body = `{{template "header" .}} <stro...
public bool Check() { string input = "Hello World!"; string pattern = @"H.ll. W.rld!"; // true return Regex.IsMatch(input, pattern); }
public bool Check() { string input = "Hello World!"; string pattern = @"H.ll. W.rld!"; // true return Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase | RegexOptions.Singleline); }
public string Check() { string input = "Hello World!"; string pattern = @"W.rld"; // Hello Stack Overflow! return Regex.Replace(input, pattern, "Stack Overflow"); }
public string Check() { string input = "Hello World!"; string pattern = @"H.ll. (?<Subject>W.rld)!"; Match match = Regex.Match(input, pattern); // World return match.Groups["Subject"].Value; }
This uses the Dropbox Java SDK to create a shared link for a file at the Dropbox path /test.txt: try { SharedLinkMetadata sharedLinkMetadata = client.sharing().createSharedLinkWithSettings("/test.txt"); System.out.println(sharedLinkMetadata.getUrl()); } catch (CreateSharedLinkW...
This example uses the Dropbox .NET library to get a shared link for a file, either by creating a new one, or retrieving an existing one: SharedLinkMetadata sharedLinkMetadata; try { sharedLinkMetadata = await this.client.Sharing.CreateSharedLinkWithSettingsAsync (path); } catch (ApiException...
Git lets you use non-git commands and full sh shell syntax in your aliases if you prefix them with !. In your ~/.gitconfig file: [alias] temp = !git add -A && git commit -m "Temp" The fact that full shell syntax is available in these prefixed aliases also means you can us...
This lists all of the custom classifiers you have trained. 'use strict'; let watson = require('watson-developer-cloud'); var visualRecognition = watson.visual_recognition({ version: 'v3', api_key: process.env['API_KEY'], version_date:'2016-05-19' }); let url = "https://upl...
This returns information about a specific classifier ID you have trained. This includes information about its current status (i.e., if it is ready or not). 'use strict'; let watson = require('watson-developer-cloud'); var visualRecognition = watson.visual_recognition({ version: 'v3', ap...

Page 90 of 1336