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 TYPE
For example:
spyctl create notification-target -n OperationsTeam -T emails > target.yaml
This 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 FILENAME
If you have already applied the Notification Target you may edit the resource using the following:
spyctl edit [OPTIONS] notification-target NAME_OR_UID
For example:
spyctl edit -f target.yaml
This 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 FILENAME
For example:
spyctl apply -f target.yaml
If 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_UID
For example:
spyctl delete notification-target OperationsTeam
View 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 1
The 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.yaml
Last updated
Was this helpful?