The problem about iCall's tmsh script.

The following three parts what effect is there in the iCall 's tmsh Script? The default value is “none”.

1、app-service none

2、description none

3、events none

I did not find the detail in the devcentral website.

The following is the default script format.:

create script test {

app-service none 

definition {
}

description none

events none

}

Thanks LEE

In lieu of perhaps a better answer, I believe that the app-service tag is an iApp thing that allows you to define an object as part of an application service inside an iApp object. The description tag is a holder for plain text description information. And I have no idea hat the events tag is, but then I’ve never seen an iCall script use this tag.

The iCall script as a configuration object, could have been created by an iApp Application-service. In that case, the app-service field would reflect the service that did so.

The description is a Text field for the user to document the purpose of the iCall script, or anything else.

The iCall script “definition” section can generate Events, in that case it will publish the Event details in the “events” section, here is an example:

sys icall script get_sharepoint_score_new_and_improved {
    app-service none
    definition {
        package require http
    if {[catch {tmsh::generate sys icall event SharePoint_SCORE context \{ \{ name node_addr value $nodeaddr \} \{ name score value $spscore \} \}} err]} {
                puts "generate iCall event FAIL $url"
                http::cleanup $token
            } else {
                http::cleanup $token
                }
            }
        }
    }
    description none
    events {
        SharePoint_SCORE {
            app-service none
            contexts {
                node_addr {
                    app-service none
                }
                score {
                    app-service none
                }
            }
        }
    }
}

The only required section for an iCall script is the definition section. The events, app-service and description can be left as “none”.

Here is an example of a script which sends an email upon a failover Event. Note the FAILOVER event is system defined and it does not require special definition.

sys icall script email-on-failover  {
    definition {
        set old_status standby
        while { 1 } {
            EVENT::get_next
            set new_status $EVENT::context(/Common/traffic-group-1)

             detect if we just went standby
            if { $new_status eq "standby" && $old_status ne "standby" } {
                puts "failover detected - i am standby now!"

                set date [clock format [clock seconds] -format "%Y%m%d%H%M%S"]
                set settings [tmsh::get_config sys global-settings]
                set host [tmsh::get_field_value [lindex $settings 0] hostname]
                puts "generating email for $host-$date"

                set args "echo \"Failover notification\" | mail -s \"$host is now Standby.  $date\" network_operations@company.com“

                if { [catch {  exec  /bin/bash -c $args  }] } {
                    puts "\nCould not send email, try again."
                }

            }

             save the state
            set old_status $new_status
        }
    }
    description none
    events none
}

And the following perpetual handler to run it upon a Failover Event:

sys icall handler perpetual handle-failover {
    script email-on-failover
    subscriptions {
        failover {
            event-name FAILOVER_STATE
        }
    }
}

You also need to prepare the bash mail client.

HTH