Notification Target Management using Spyctl
To learn more about what Notification Targets are, see:
Notification TargetsPrerequisites
If you have never used Spyctl start here to learn how to install it, then follow the Initial Configuration guide.
Managing Notification Targets
Create
To create a new Notification Target you can use the create command:
spyctl create notification-target -n NAME -T TYPEFor example:
spyctl create notification-target -n OperationsTeam -T emails > target.yamlThis will create a default Notification Target and save it to a file called target.yaml
apiVersion: spyderbat/v1
kind: NotificationTarget
metadata:
name: OperationsTeam
spec:
emails:
- [email protected]Edit
When creating new Notification Targets you will need to edit the default document to point to the proper destination. With spyctl you can use the edit command to ensure you don't accidentally introduce syntax errors.
spyctl edit -f FILENAMEIf you have already applied the Notification Target you may edit the resource using the following:
spyctl edit [OPTIONS] notification-target NAME_OR_UIDFor example:
spyctl edit -f target.yamlThis will bring up a prompt to select a text editor unless you have already done so previously. Then, using your text editor you may fill in your desired destination or destinations.
If you save without making any changes, nothing happens to the resource or file you're editing. If you save and there were syntax errors, Spyctl will save your draft to a temporary location and re-open it with comments detailing the errors. Finally, if your changes have no syntax errors, Spyctl will update the resource or file you're editing.
Apply
In order for a Notification Target to be usable by the Spyderbat Notifications System you must first apply it using the apply command.
spyctl apply -f FILENAMEFor example:
spyctl apply -f target.yamlIf the operation is successful, your Notification Target will be ready for use.
Delete
To remove a Notification Target from the Spyderbat Notifications System you can use the delete command.
spyctl delete [OPTIONS] notification-target NAME_OR_UIDFor example:
spyctl delete notification-target OperationsTeamView or Download
You can use the get command to view or download your Notification Targets.
spyctl get [OPTIONS] notification-targets [NAME_OR_UID]For example:
spyctl get notification-targets$ spyctl get notification-targets
Getting notification-targets
NAME ID AGE TYPE DESTINATIONS
OperationsTeam notif_tgt:XXXXXXXXXXXXXXXXXXXXXX 7d emails 1The default output is a tabular summary of your Notification Targets. To download the Notification Target as yaml or json you can use the -o option
spyctl get notification-targets -o yaml OperationsTeam$ spyctl get notification-targets -o yaml OperationsTeam
apiVersion: spyderbat/v1
kind: NotificationTarget
metadata:
name: OperationsTeam
spec:
emails:
- [email protected]
- [email protected]Using the > character you can save the document to a file.
spyctl get notification-targets -o yaml OperationsTeam > target.yamlLast updated
Was this helpful?