Active IQ Unified Manager Discussions

alerting scripts on active IQ unified manager 9.11P1 OVA

rust86
1,726 Views

I'm trying to get alerts to run the simple script below.

However it's not pulling in the variables. 

The event gets passed to  ServiceNow but instead of the alert variable it passes:
message_key: [1]

description: Test from Active-IQ by Rusty $ARGV[1],

============================================================================

 

#!/bin/bash
url="https://<removed>:8050/api/mid/em/inbound_event?Transform=jsonv2"
auth="<removed>:<removed>"
data='{
         "records": [
                 {
                       "description": "Test from Active-IQ by Rusty $ARGV[1]",
                       "node": "test",
                       "severity": 2,
                        "updated": "2023-03-16 12:35:41",
                        "event_class": "ServiceNow Event Listner",
                        "type": "curl command",
                        "message_key": '$ARGV[1]' ,
                        "source": "Active-IQ",
                          "additional_info": {
                                  "%_ext_ticket_ref": "",
                                  "%F": "1217",
                                  "is_config": "snow-dash",
                                   "region": "texas"
                         },
                        "resource": "1.4.172.22.1.134"
                 }
            ]
}'
curl -u "$auth" --insecure -H "Content-Type: application/json" -d "$data" "$url"

 

 

 

 

I've been referencing the following documentation: 

https://www.netapp.com/pdf.html?item=/media/19932-tr-4585.pdf (outdated)

https://docs.netapp.com/us-en/active-iq-unified-manager-97/health-checker/concept-how-scripts-work-with-alerts.html (hasn't been helpful) 

https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/OnCommand-Unified-Manager-alert-script-integration/td-p/128784 (has made me hopeful but raises more questions) 

1 ACCEPTED SOLUTION

rust86
1,460 Views

The issue turned out to be a quote hell.  

was able to fix it by adjusting them. 

my $data = "{
    \"records\": [
        {
            \"description\": \" $eventID . $eventName \",
            \"node\": \"$vserver\",
            \"severity\": 2,
            \"updated\": \"$updated\",
            \"event_class\": \"ServiceNow Event Listner\",
            \"type\": \"curl command\",
            \"message_key\": \"$message_key\" ,
            \"source\": \"Active-IQ\",
            \"additional_info\": {
                \"%_ext_ticket_ref\": \"\",
                \"%F\": \"1217\",
                \"is_config\": \"snow-dash\",
                \"region\": \"texas\"
            },
            \"resource\": \"1.4.172.22.1.134\"
        }
    ]
}";

 

View solution in original post

4 REPLIES 4

RossC
1,549 Views

Hi @rust86 

 

The really basic "print" example in https://docs.netapp.com/us-en/active-iq-unified-manager/events/concept_how_scripts_work_with_alerts.html 

 

If you use that basic print example, does it successfully grab the variables?

 

 

rust86
1,522 Views

This is what I had started working with. but never got it to work. 

I have switched to trying to use Perl and while it's a slow crawl I'm actually getting something back.  so I'm just going to try and figure out how to do it with Perl. 

 

Thanks,  

RossC
1,511 Views

Hi @rust86 

 

Good to hear you at least were able to see some positive results using Perl. 

 

You could consider raising a case with our Support Team to point out the difference in behavior between Perl and Bash on your Unified Manger deployment.

 

 

rust86
1,461 Views

The issue turned out to be a quote hell.  

was able to fix it by adjusting them. 

my $data = "{
    \"records\": [
        {
            \"description\": \" $eventID . $eventName \",
            \"node\": \"$vserver\",
            \"severity\": 2,
            \"updated\": \"$updated\",
            \"event_class\": \"ServiceNow Event Listner\",
            \"type\": \"curl command\",
            \"message_key\": \"$message_key\" ,
            \"source\": \"Active-IQ\",
            \"additional_info\": {
                \"%_ext_ticket_ref\": \"\",
                \"%F\": \"1217\",
                \"is_config\": \"snow-dash\",
                \"region\": \"texas\"
            },
            \"resource\": \"1.4.172.22.1.134\"
        }
    ]
}";

 

Public