icall perpetual handler
2 TopicsDaemon iApp
Problem this snippet solves: This iApp allows BIG-IP administrators to import a script file and run it as a daemon. The iApp will save the script locally as an iFile ensuring that the daemon will become an integral part of the BIG-IP configuration, meaning that it will persist across reboots, upgrades and will be synced to other members within the Cluster. The script file (or daemon) simply needs to be a file that will run perpetually - i.e. does not exit. It can be written in BASH, Perl, TCL or TMSH, although testing has been limited so please send feedback as to the success/failure of any particular script type. To manually control the execution of the daemon, the following tmsh command should be used: daemon-appservicename status | start | stop | restart How to use this snippet: Known Issues This iApp utilises the new iCall functionality that was introduced with TMOS 11.4. As such there appear to be some minor issues when using this new functionality with an iApp. Ensure that you don't reconfigure an Application Service that was created with this iApp. Instead, if you want to modify it, you should delete the application service and then recreate it. This iApp also creates a tmsh cli alias. There appears to be an issue whereby the cli alias is not recognised as being part of an app-service. Simply delete the cli alias prior to removing the application service. Deleting a cli alias can be done via tmsh using the "delete cli alias shared appservicename" command. Contributed by: Mike Crozier334Views0likes0CommentsGenerate qkview on core dump or unknown restart
Problem this snippet solves: This iCall script is a demo showing how a perpetual iCall handler can be used to watch for changes to the contents of the directory used to store core files (created when BIG-IP daemons unexpectedly exit), and upon seeing a new or modified entry, collecting a diagnostic snapshot of the system. How to use this snippet: Implementation Details This iCall script requires v11.4 or higher. Code : ### start code ### sys icall script core_restart_watch { app-service none definition { # prime the array with existing cores so the initial run won't generate # qkviews foreach { file } [glob /var/core/*.gz] { file stat $file corestat set cores($file) $corestat(mtime) } # main loop while { 1 } { foreach { file } [glob /var/core/*.gz] { file stat $file corestat # act if an entry doesn't already exist (indicating new core), # or if one exists but has a different modification time # (indicating an overwritten corefile) if { ! [info exists cores($file)] || $cores($file) ne $corestat(mtime) } { # insert/update this core for future use set cores($file) $corestat(mtime) # name the qkview after the hostname and date+time 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] # generate a UCS at this time puts "core found ($file), collecting diagnostic data as: /var/tmp/${host}-${date}.ucs" exec tmsh save sys config file /var/tmp/${host}-${date}.ucs # no need to run for more than one core break } } # time in ms to wait between this running after 30000 } } description none events none } ### end code ### And the following perpetual handler to run it: ### start code ### handler perpetual core_restart_watch sys icall handler perpetual core_restart_watch { script core_restart_watch } ### end code ###375Views0likes0Comments