vania-janet/multiturn-rag-retrieval-data huggingface dataset:
public void onFailure(ENPushException e) {
// Handle Failure
}
});
Show more
7. Optionally, if you are using tags



* Change the tag subscriptions as follows:

// Replace the below section

push.subscribe("tagName", new MFPPushResponseListener<String>() {

@Override
public void onSuccess(String arg) {
System.out.println("Succesfully Subscribed to: "+ arg);
}

@Override
public void onFailure(MFPPushException ex) {
String message = ex.getMessage();
System.out.println("Error subscribing to Tag " + message);
}
});

// with this

push.subscribe("tagName", new ENPushResponseListener<String>() {

@Override
public void onSuccess(String arg) {
System.out.println("Succesfully Subscribed to: "+ arg);
}

@Override
public void onFailure(ENPushException ex) {
String message = ex.getMessage();
System.out.println("Error subscribing to Tag " + message);
}
});
Show more
* Changes to get all the tag subscription for the device

// Replace the below section

push.getSubscriptions(new MFPPushResponseListener<List<String>>() {

@Override
public void onSuccess(List<String> tags) {
System.out.println("Subscribed tags are: "+tags);
}

@Override
public void onFailure(MFPPushException ex) {
String message = ex.getMessage();
System.out.println("Error getting subscriptions " + message);
There are different reasons why you might get this notification such as that credentials were deleted after streaming was activated and started.
* message_timed_out or timed_out: This notification reports generic timeout errors when streaming messages to Event Streams.



The Activity Tracker event includes different fields that you can use to monitor streaming data failures:



* reason.reasonCode = 500 and severity = critical notify of a failure streaming data.
* reason.reasonType indicates the type of failure.
* target.typeURI = logdna/account/streaming-notification indicates that the event is a notification event.



The following sections include samples of some fields in the notification event that you can use to monitor and be alerted when a failure happens:

"requestData": {
"notificationType": "unknown_topic_or_partition",
"start": "2021-06-29T21:33:52.333Z",
"end": "2021-06-29T21:35:13.772Z",
"topic": "kafka-java-console-sample-topic",
"error": "Error: Broker: Unknown topic or partition"
},

"reason": {
"reasonCode": 500,
"reasonType": "unknown_topic_or_partition",
"reasonForFailure": "Error: Broker: Unknown topic or partition"
},

"target": {
"id": "crn:v1:staging:public:logdna:us-south:a/9bb3ea01633c4d828080de16ce34ea70:d8ba830f-b0e0-4c42-9345-8981d4a94b31:streaming-logs:",
"typeURI": "logdna/account/streaming-notification"



 Query to monitor failures 

In Activity Tracker, you can create a view with the following query to filter for event stream failure notifications:

action:logdnaat.streaming-logs.send reason.reasonCode:500 severity:critical target.typeURI:"logdna/account/streaming-notification"
public void onSuccess(String arg) {
System.out.println("Succesfully Subscribed to: "+ arg);
}

@Override
public void onFailure(ENPushException ex) {
System.out.println("Error subscribing to Tag1.." + ex.getMessage());
}
});
* Add the notifications listener for receiving the notification in your application.

//Handles the notification when it arrives
ENPushNotificationListener notificationListener = new ENPushNotificationListener() {

@Override
public void onReceive (final ENSimplePushNotification message){
// Handle Push Notification
}
};

if(enPush != null) {
enPush.listen(notificationListener);
}
* When the setup is complete, run your application and register for push notifications.







 Step 9: Send notifications to the Android device 

Use the [Send notification API](https://cloud.ibm.com/apidocs/event-notifications/event-notificationssend-notifications) to send the push notification for the Android device. You can use the [Node](mailto:https://github.com/IBM/event-notifications-node-admin-sdk) or [Go](https://github.com/IBM/event-notifications-go-admin-sdksend-notifications) admin SDK instead of calling the API directly.

Zoom

![Send notifications](https://cloud.ibm.com/docs-content/v1/content/4c9a07fe500838e5e55e71e73131ef20b44a6c66/event-notifications/images/en-send-notifications.png)

Figure 6. Send notifications

Zoom

!
Create and send push notifications to Safari web by using Event Notifications 

Create an Event Notifications service, add a push destination for Apple Push Notification service (Safari), and send messages to iOS devices.



 What is Event Notifications? 

Event Notifications is an event notification routing service that notifies you of critical events that occur in your IBM Cloud account or triggers automated actions by using webhooks. You can filter and route event notifications from IBM Cloud services like Availability Monitoring, to email, SMS, push notifications (FCM or APNs), and webhooks.





 How do clients use Safari push notifications? 

The following diagram shows you how clients use iOS Push Notifications.

Zoom

![How clients use push notifications](https://cloud.ibm.com/docs-content/v1/content/4c9a07fe500838e5e55e71e73131ef20b44a6c66/event-notifications/images/en-how-send-safari.svg)

Figure 1. How clients use push notifications





 Objectives 

This tutorial shows you how to send push notifications as follows:



* Create a web app with Event Notifications.
* Get Safari credentials.
* Download the code and complete the notifications setup.
* Configure and send Safari Push Notifications to a Safari Web.







 Before you begin 

You must have the following prerequisites in place:



* An IBM Cloud account. If you do not have one, [create an IBM Cloud account](https://cloud.ibm.com/).
* An Event Notifications Instance.
* An IAM API key to allow the SDK to access your account. Create one [here](https://cloud.ibm.com/iam/apikeys).







 Step 1: Create an Event Notifications service instance 



* Log in to your [IBM Cloud account](https://cloud.ibm.com/).
* In the [IBM Cloud catalog](https://cloud.ibm.com/catalogservices), search Event Notifications > Event Notifications.
event-notifications.tag-subscriptions.create POST /event-notifications/v1/instances/{instanceID}/destinations/{id}/tag_subscriptions Manager, Administrator, Device-Manager Create a tag subscription under a push notifications FCM Destination 
 event-notifications.tag-subscriptions.delete DELETE /event-notifications/v1/instances/{instanceID}/destinations/{id}/tag_subscriptions Manager, Administrator, Device-Manager Delete tag subscriptions under a push notifications FCM destination 
 event-notifications.channel-groups.create POST /event-notifications/v1/instances/{instance_id}/destinations/{id}/fcm_channel_groups Manager, Administrator, Device-Manager Create a channel group under a push notifications FCM destination 
 event-notifications.channel-groups.read POST /event-notifications/v1/instances/{instance_id}/destinations/{id}/fcm_channel_groups/{group_id} Manager, Administrator, Device-Manager Get a new channel group under a push notifications FCM destination 
 event-notifications.channel-groups.list GET /event-notifications/v1/instances/{instance_id}/destinations/{id}/fcm_channel_groups Manager, Administrator, Device-Manager List all channel groups under a push notifications FCM destination 
 event-notifications.channel-groups.update PUT /event-notifications/v1/instances/{instance_id}/destinations/{id}/fcmChannelGroups/{group_id} Manager, Administrator, Device-Manager Update an existing channel group under a push notifications FCM destination 
 event-notifications.channel-groups.delete DELETE /event-notifications/v1/instances/{instance_id}/destinations/{id}/fcm_channel_groups/{group_id} Manager, Administrator Delete an existing channel group under a push notifications FCM destination 
 event-notifications.integrations.list GET /event-notifications/v1/instances/{instance_id}/integrations Manager, Administrator, Device-Manager List all Key Management Services integrations
event-notifications.severities.list GET /event-notifications/v1/instances/{instanceID}/severities?sourceID=* Manager, Reader, Administrator, Event-Source-Manager Get all severities based on the source 
 event-notifications.severities.delete DELETE /event-notifications/v1/instances/{instanceID}/severities/{severity_id}?sourceID=* Event-Source-Manager Delete a severity based on the source 
 event-notifications.email-status.create POST /event-notifications/v1/instances/{instanceID}/email-status/sources/{sourceID}/notifications/{notificationID} Status-Reporter Create/Update current status of a dispatched email 
 event-notifications.sms-status.create POST /event-notifications/v1/instances/{instanceID}/sms-status/sources/{sourceID}/notifications/{notificationID} Status-Reporter Create/Update current status of a dispatched SMS 
 event-notifications.webhook-status.create POST /event-notifications/v1/instances/{instanceID}/webhook-status/sources/{sourceID}/notifications/{notificationID} Status-Reporter Create/Update current status of a dispatched webhook 
 event-notifications.devices.create POST /event-notifications/v1/instances/{instanceID}/destinations/{id}/devices Manager, Administrator, Device-Manager Create a device under a push notifications FCM destination 
 event-notifications.devices.read GET /event-notifications/v1/instances/{instanceID}/destinations/{id}/devices/{device_id} Manager, Administrator, Device-Manager Get a single device under a push notifications FCM destination 
 event-notifications.devices.list GET /event-notifications/v1/instances/{instanceID}/destinations/{id}/devices Manager, Administrator, Device-Manager Create all devices under a push notifications FCM Destination
How do I manage vSAN Health alerts and warnings? 

 What’s happening 

You might see alerts and warnings that relate to Virtual SAN (vSAN™) Health issues on the VMware vSphere® Web Client Monitor page.

 Why it’s happening 

These warnings are nonissues and do not indicate functional problems.

 How to fix it 

Use the following steps to clear the warnings from the vSphere Web Client:



1. Go to [http://partnerweb.vmware.com/service/vsan/all.json](http://partnerweb.vmware.com/service/vsan/all.json) and save the JSON file, with the name all.json, on your local system.
2. Ensure that you completed the steps in [vCenter console timeout](https://cloud.ibm.com/docs/vmwaresolutions?topic=vmwaresolutions-trbl_timeout_vc_console).
3. On the details page of the instance, click vCenter console, and log in to the vSphere Web Client by using the credentials displayed on the IBM Cloud® for VMware Solutions console.
4. On the vSphere web Client, go to Manage > Settings and open the Virtual SAN > Health > HCL Database section. Click Update from file, then upload the all.json file that you saved previously.
5. To clear the warnings, go to the Alarms pane on the upper right of the vSphere Web Client. Right-click each of the alarms, and select Reset to green.



For more information, see [How to download offline vSAN HCL file for vSAN Health Check plug-in](https://www.virtuallyghetto.com/2015/05/how-to-download-offline-vsan-hcl-file-for-vsan-health-check-plugin.html).

 What’s happening 

On the vSAN health page, the following warning might be displayed with the recommendation to restart host.

vSAN extended configuration in sync.

 Why it’s happening
ibmcloud ce application logs -n ${SERVICE_NAME}-guard

Example output

[...]
{"level":"warn","message":"SECURITY ALERT! HttpRequest: Headers: KeyVal: Known Key X-B3-Traceid: Digits: Counter out of Range: 25"}
[...]

Security alerts appear as warnings in the guard log file and start with the string SECURITY ALERT!. The default setup of Guard is to allow any request or response and learn any new pattern after reporting it. When the application is actively serving requests, it typically takes about 30 min for Guard to learn the patterns of the application requests and responses and build corresponding micro-rules. After the initial learning period, Guard sends alerts only when a change in behavior is detected.

Note that in the default setup, Guard continues to learn any new behavior and therefore avoids reporting alerts repeatedly when the new behavior reoccurs. Correct security procedures should include reviewing any new behavior detected by Guard.

Guard can also be configured to operate in other modes of operation, such as:



* Move from auto learning to manual micro-rules management after the initial learning period
* Block requests/responses when they do not conform to the micro-rules



For more information or for troubleshooting help, see the

[#code-engine channel](https://ibm-cloud-success.slack.com).





 Step 6: Clean up the tutorial applications 

After you are finished with this tutorial, you can remove the Hello World application, the Hello World Guard, and the Guard-Learner as shown in the following example.

ibmcloud ce application delete -n ${SERVICE_NAME}
ibmcloud ce application delete -n ${SERVICE_NAME}-guard
ibmcloud ce application delete -n guard-learner
If not set, the context instance specified by ibmcloud cis instance-set INSTANCE is used.--output: Specify output format, only JSON is supported.<-- </section "id="section-opt-create-pool-toggle-alert" "> --><-- <section "id="section-create-pool-toggle-alert-examples" "> --> Examples Create a pool toggle alert policy for instance cis-demo. ibmcloud cis alert-policy pool-toggle-alert-create --name test1 --emails test1@cn.ibm.com --enabled true --pools all --trigger-condition enabled --include-future-pools true -i "cis-demo"
<-- </section "id="section-create-pool-toggle-alert-examples" "> --><-- </section "id="section-create-pool-toggle-alert" "> --><-- <section "id="section-firewall-events-alert" "> --> ibmcloud cis alert-policy firewall-events-alert-create Create an alert policy about spikes in firewall events. Firewall events alerts use a z-score]z_-score] calculation over the last six hours and five-minute buckets of events. An alert is triggered whenever the z-score is above 3.5 (the threshold). You will not receive duplicate alerts within the same two-hour time frame. ibmcloud cis alert-policy firewall-events-alert-create --name NAME (--emails EMAILS | --webhooks WEBHOOKS) --enabled (true | false) --domains DOMAINS --services SERVICES] --description DESCRIPTION] -i, --instance INSTANCE] --output FORMAT] ! ! ! ! ! !
<-- <section "id="section-opt-firewall-events-alert" "> --> Command options --name: The name of the alert policy.--description: The description for the alert policy.--emails: The email addresses for dispatching an alert notification.
--team <TEAM_NAME>
: The name of the IBM Cloud Monitoring team to be used for authorization. If no team is specified, the default team will be used.

--help | -h
: List options available for the command.





 Examples 

The following are examples using the ibmcloud monitoring alert add command.

Add an alert for the IBM Cloud Monitoring abc instance to detect a CrashLoopBackOff in the last 5 minutes.

ibmcloud monitoring alert add --name "IBM Cloud Monitoring abc" --description "Alert to report crashLoopBackOffs that are detected" --severity 2 --timespan 300 --condition 'sum(avg(kubernetes.pod.restart.count)) > 1' --alert-name '[Kubernetes] Pod crash/restart loop'

Add an alert for the IBM Cloud Monitoring abc instance to detect a CrashLoopBackOff in the last 5 minutes with severity set to medium.

ibmcloud monitoring alert add --name "IBM Cloud Monitoring abc" --description "Alert to report crashLoopBackOffs that are detected" --severity 2 --severity-label MEDIUM --timespan 300 --condition 'sum(avg(kubernetes.pod.restart.count)) > 1' --alert-name '[Kubernetes] Pod crash/restart loop'







 ibmcloud monitoring alert list 

Use this command to list the alerts for the specified instance.

ibmcloud monitoring alert list --name NAME [--severity SEVERITY] [--enabled TRUE or FALSE] [--region REGION] [--output FORMAT] [--team TEAM_NAME]



 Command options 

--name <NAME> | --n <NAME>
: Name of the instance.

--region <REGION> | -r <REGION>
: Name of the region, for example, us-south or eu-gb. If not specified, the region logged into or targeted will be used.

--severity <SEVERITY> | -s <SEVERITY>
: A comma-separated list of severity values enclosed in double-quotes ("). If only a single severity is specified, the double-quotes can be omitted.
* The Notifications page is account that is scoped and shows only notifications for the account that is selected on the menu bar. You can switch accounts to view notifications that are affecting a different account.
* The severity or impact is listed for each notification type. Depending on the notification, you might see severity 1 listed for an unplanned incident notification and high impact that is listed for a planned maintenance notification.
* You can use the search field to locate a specific notification or filter by a notification type.
* Navigate to a specific notification by using the unique URL that is associated with each notification. You can save and share the URL with users in the account.
* You can access the Notifications page with the applied filters to view only applicable notifications. Make sure to save the URL to view the Notifications page with the applied filters.
* If you want to receive future updates about a specific type of notification, click the Email icon next to each notification item in the list.





 Notification types 

The following table describes the different types of notifications that are displayed.



Table 1. Notification types

 Notification Type Description 

 Planned maintenance Scheduled maintenance that is required to keep the IBM Cloud platform and infrastructure operating at optimal status. 
 Security bulletins Announcements about security vulnerabilities and the required actions. 
 Announcements Updates on new infrastructure features and services in IBM Cloud. 
 Incidents Unexpected impacting events that can cause an outage or restrict functionality. 
 Account Invitation email, or console notifications for inviting users to the IBM Cloud platform. 







 Subscribing to email notifications 

You can select whether to receive email notifications about IBM Cloud platform-related items, such as announcements, billing and usage, additional notification preferences, and ordering. Or, about resource-related items, such as incidents, maintenance, security bulletins and resource activity. Additionally, if you have a Pay-As-You-Go or Subscription account, you can choose whether to receive IBM Cloud infrastructure service updates about changes, such as OS reloads, assigned IPs, and image and firmware updates. For more information, see [Setting email preferences for notifications](https://cloud.ibm.com/docs/account?topic=account-email-prefs).
Integrating with Slack 

You can send IBM® Log Analysis alerts to Slack.



  Prerequsite 

Before configuring a Slack alert in IBM® Log Analysis, you will need to [configure a webhook in Slack.](https://api.slack.com/messaging/webhooks)





  Configuring Slack 

When you [configure an alert](https://cloud.ibm.com/docs/log-analysis?topic=log-analysis-alerts) you can have that alert sent to a Slack.



1.  When configuring your alert, click ![Slack icon](https://cloud.ibm.com/docs-content/v1/content/f61dbc5d84bf0c89e477a05cab04c72f429e1b7a/log-analysis/images/slack.png).
2.  Select if you want the alert to be sent when the condition exists (Presence) or does not exist (Absence).
3.  Indicate the logging criteria when an alert should be sent. For example, when 100 lines matching in the view are logged in an hour. A graph will help you determine the number of log lines matching your specified criteria.
4.  Select if the alert should be sent at the end of the selected period or immediately when the number of lines are logged.
5.  Optionally you can specify a Custom schedule with alerting limited to a specified timezone, days of the week, or timeframe. To configure a Custom schedule:



1.  Select on for Custom schedule.
2.  Select the Timezone for the log entries.
3.  Select the days of the week when alerts should be generated.
4.  Optionally specify a time range for the selected days. A graph will help you determine the number of log entries for the timezone and time range.



6.  Specify the Webhook URL to receive the alert.
7.  Specify the color of the mesage to be displayed in Slack.
8.  Click Save Alert.

The alert definition must be saved for alerts to be sent to your slack.
After you enable notifications for Security and Compliance Center, test your connection to ensure that the events that are generated by Security and Compliance Center are being forwarded to Event Notifications.

Before you can send a test Security and Compliance Center event, you must have [topics, destinations, and subscriptions](https://cloud.ibm.com/docs/event-notifications?topic=event-notifications-en-create-en-topic) created in your Event Notifications instance. Be sure that the Test configuration event type (com.ibm.cloud.compliance.test) is included as a condition in your Event Notifications topic.

The following example shows a query that you can use to send a test event from the Security and Compliance Center to Event Notifications. When you call the API, replace the <accountID> variable and IAM token with the values that are specific to your account.

curl -X POST 'https://compliance.<domainName>/admin/v1/accounts/<accountID>/test_event' -H 'Content-Type: application/json' -H 'Authorization: Bearer <accessToken>'







 Delivering notifications to select destinations 

After you enable notifications for Security and Compliance Center, create topics and subscriptions in Event Notifications so alerts can be forwarded and delivered to your selected destinations.

For a complete list of supported destinations, see the [Event Notifications documentation](https://cloud.ibm.com/docs/event-notifications?topic=event-notifications-en-destination).



 Email notifications 

You can use the [IBM Cloud email service](https://cloud.ibm.com/docs/event-notifications?topic=event-notifications-en-destinations-email) as a delivery channel for Security and Compliance Center event notifications. [Create an Event Notifications subscription](https://cloud.ibm.com/docs/event-notifications?topic=event-notifications-en-create-en-subscription) between an existing topic and the IBM Cloud email service to forward your alerts to various recipients by email.

An email from IBM Cloud that contains information about a Security and Compliance Center event resembles the following example:

Subject: Validation completed: my-test-validation-scan