Skip to content

Instantly share code, notes, and snippets.

@mourdok
Created January 21, 2015 16:56
Show Gist options
  • Save mourdok/e5ec5cb7bb592708273e to your computer and use it in GitHub Desktop.
Save mourdok/e5ec5cb7bb592708273e to your computer and use it in GitHub Desktop.
Creating CA Nimsoft Alarm by Java API.
//#################################################################
//# CodeWizard: Java
//# This code was generated with the Nimsoft CodeWizard version 1.70
//# Date: terça-feira, 20 de janeiro de 2015
//
package example;
import java.io.IOException;
import java.net.InetAddress;
import com.nimsoft.nimbus.*;
import com.nimsoft.nimbus.ci.ConfigurationItem;
@SuppressWarnings("unused")
public class AlarmProbe {
public static void main(String[] args) {
try {
AlarmProbe exampleprobe = new AlarmProbe();
exampleprobe.doit(args);
} catch (Exception e) {
e.printStackTrace();
}
}
public void doit(String[] args) throws Exception {
// Alarm definition
int severity = NimAlarm.NIML_INFORMATION;
String message = "Alarm generated from Java";
String subsystem = "3";
String suppressionId = "JAVA";
String source = InetAddress.getLocalHost().getHostAddress();
ConfigurationItem ci = new ConfigurationItem("1.10", "AlarmProbe.java");
String metricId = "ciMetricId";
// Create alarm
NimAlarm alarm = new NimAlarm(severity, message, subsystem,
suppressionId, source, ci, metricId);
alarm.send();
alarm.disconnect();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment