Skip to main content

Posts

Showing posts from May, 2018

powershell script to loop database query etc on multiple servers.

1. To test connection time: 1.1 $PASSWD="whatever" $PASSED get-content bosslist.txt|foreach-object {measure-command {(echo "select 1 from dual")|sqlplus jsun/$PASSWD@"(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = $_)(Port = 1521))) (CONNECT_DATA = (SID =SIDNAME)))"}}|findstr TotalSeconds output looks like this: TotalSeconds      : 1.6875126 TotalSeconds      : 1.6090257 TotalSeconds      : 1.61322 ... 1.2: This command will combine the server name to the totalseconds output. get-content bosslist.txt|foreach-object { $server=$_ measure-command {(echo "select 1 from dual")|sqlplus jsun/$PASSWD@"(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = $_)(Port = 1521))) (CONNECT_DATA = (SID =PCP1)))"} }|select-object  {"Server "+$server+" : "+$_.TotalSeconds} output look like this: "Server "+$server+" : "+$_.TotalSeconds ------------------------

10 Useful Sar (Sysstat) Examples for UNIX / Linux Performance Monitoring

found this very helpful: https://www.thegeekstuff.com/2011/03/sar-examples/?utm_source=feedburner 1. CPU Usage of ALL CPUs (sar -u) This gives the cumulative real-time CPU usage of all CPUs. “1 3” reports for every 1 seconds a total of 3 times. Most likely you’ll focus on the last field “%idle” to see the cpu load. $ sar -u 1 3 Linux 2.6.18-194.el5PAE (dev-db) 03/26/2011 _i686_ (8 CPU) 01:27:32 PM CPU %user %nice %system %iowait %steal %idle 01:27:33 PM all 0.00 0.00 0.00 0.00 0.00 100.00 01:27:34 PM all 0.25 0.00 0.25 0.00 0.00 99.50 01:27:35 PM all 0.75 0.00 0.25 0.00 0.00 99.00 Average: all 0.33 0.00 0.17 0.00 0.00 99.50 Following are few variations: sar -u  Displays CPU usage for the current day that was collected until that point. sar -u 1 3  Displays real time CPU usage every 1 second for