I want to write script which will check CPU and Memory Utilization every 2 hours and send a mail to monitoring team and when utilization reaches to a certain level.
This applet assumes that your device only has one CPU:
event manager applet watch-cpu
event snmp oid 126.96.36.199.188.8.131.52.184.108.40.206.1.11.1 entry-op ge entry-val 70 poll-interval 7200 get-type exact
This will send an email to [email protected] if the CPU utilization reachs 70%.
For memory, you could use:
event manager applet watch-mem
event snmp oid 220.127.116.11.18.104.22.168.22.214.171.124.6.1 entry-op le entry-val 4194304 poll-interval 7200 get-type exact
This will send an email if free memory dips below 4 MB.
For external scripting, I suggest you look into the Expect programming language. You can use this to wrap programs like telnet and SSH to connect to devices and run arbitrary CLI commands.
Are you looking to do with with the Embedded Event Manager (i.e. on-box) or do you need to have an external script to collect this information?