Tutorial by Examples: c

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...
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...
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...
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 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...
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...
Training a custom classifier requires a corpus of images organized into groups. In this example, I have a bunch of images of apples in one ZIP file, a bunch of images of bananas in another ZIP file, and a third group of images of things that are not fruits for a negative set. Once a custom classif...
'use strict'; let watson = require('watson-developer-cloud'); let fs = require('fs'); var visualRecognition = watson.visual_recognition({ version: 'v3', api_key: process.env.API_KEY, version_date:'2016-05-19' }); let classifier_id_to_delete = 'TheNameofMyClassifier_485506080'; ...
Prerequisites First, you have to install the watson-developer-cloud SDK. $ npm install watson-developer-cloud Classify an image URL We'll use an image of Captain America from Wikipedia. 'use strict'; let watson = require('watson-developer-cloud'); var visualRecognition = watson.visual...
Scollector binaries for Windows, Mac, and Linux are available from the Bosun release page and can be saved to /opt/scollector/ or C:\Program Files\scollector\. The Scollector configuration file uses TOML v0.2.0 to specify various settings and defaults to being named scollector.toml in the same folde...
On Windows you can install Scollector as a service using the -winsvc="install" flag. On Mac and Linux you must manually create a service or init script. For example here is a basic systemd unit file: #Scollector unit file saved to /etc/systemd/system/scollector.service [Unit] Descriptio...
#Example of a PowerShell external collector. See http://bosun.org/scollector/external-collectors for details #This file should be saved in C:\Program Files\scollector\collectors\0\mymetrics.ps1 since it is a continuous output script #scollector.toml should have ColDir = 'C:\Program Files\scollecto...
The following can be saved as main.go. After you update the EDITME settings and build the executable it can be used as a continuous external collector. package main import ( "fmt" "log" "net/url" "strconv" "time" &...
Scollector will monitor Linux processes specified in the configuration file. [[Process]] Command = "/opt/bosun/bosun" Name = "bosun" [[Process]] Command = "ruby" Name = "puppet-agent" Args = "puppet" [[Process]] Command = &qu...

Page 58 of 826