Build precise queries to find exactly what you need
Press ESC to close
Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now
@jabbasi
Favorites0
Views
Projects0
Not sure what I am doing wrong but I took this scrpit and running it without changing anything from command like and i am getting this error and its not returning any values nagios@cubic:~> ./check_CPU_Perf.sh 20 10 ./check_CPU_Perf.sh: line 200: [: -lt: unary operator expected ./check_CPU_Perf.sh: line 204: [: -lt: unary operator expected OK: i686 nagios@cubic:~> While sar is executable and can be executed by user nagios nagios@cubic:~> sar -u Linux 2.4.19-64GB-SMP (cubic) 05/13/2013 12:00:00 AM CPU %user %nice %system %idle 12:10:00 AM all 3.15 0.00 0.97 95.88 12:20:00 AM all 4.15 0.04 1.11 94.70 12:30:00 AM all 3.69 0.00 0.97 95.34 12:40:00 AM all 3.22 0.00 0.87 95.91 12:50:00 AM all 3.16 0.00 0.90 95.94 01:00:00 AM all 2.95 0.00 0.88 96.17 01:10:00 AM all 7.66 1.98 3.88 86.48 01:20:00 AM all 3.91 0.00 1.14 94.95 01:30:00 AM all 2.84 0.00 0.89 96.27 01:40:00 AM all 2.98 0.00 0.86 96.16 01:50:00 AM all 2.98 0.00 0.96 96.06 02:00:00 AM all 2.91 0.00 0.89 96.20 02:10:00 AM all 2.66 0.00 0.86 96.48 02:20:00 AM all 2.73 0.00 0.83 96.44 02:30:00 AM all 2.99 0.00 1.13 95.88 02:40:00 AM all 1.96 0.00 0.72 97.32 02:50:00 AM all 2.21 0.00 0.74 97.04 03:00:00 AM all 2.81 0.00 0.83 96.36 03:10:00 AM all 3.02 0.00 0.89 96.09 03:20:00 AM all 2.71 0.00 0.79 96.50 03:30:00 AM all 2.97 0.00 0.87 96.16 03:40:00 AM all 2.41 0.00 0.76 96.83 03:50:00 AM all 2.31 0.00 0.72 96.97 04:00:00 AM all 2.18 0.00 0.71 97.11 04:10:00 AM all 2.20 0.00 0.73 97.07 04:20:00 AM all 1.97 0.00 0.71 97.31 04:30:00 AM all 2.61 0.00 0.85 96.53 04:40:00 AM all 2.23 0.00 0.71 97.06 04:50:00 AM all 2.11 0.00 0.69 97.20 05:00:00 AM all 2.46 0.00 0.81 96.73 05:10:00 AM all 2.30 0.00 0.73 96.98 05:20:00 AM all 2.09 0.00 0.69 97.22 05:30:00 AM all 2.39 0.00 0.78 96.83 05:40:00 AM all 2.28 0.00 0.74 96.98 05:50:01 AM all 2.17 0.00 0.71 97.12 06:00:01 AM all 1.99 0.00 0.69 97.32 06:10:00 AM all 3.82 0.00 0.81 95.37 06:20:00 AM all 5.94 0.00 1.07 92.99 06:30:00 AM all 2.21 0.00 0.72 97.08 06:40:00 AM all 3.48 0.00 1.24 95.28 06:50:00 AM all 2.53 0.00 0.76 96.71 07:00:00 AM all 2.30 0.00 0.72 96.98 07:10:00 AM all 2.91 0.00 0.93 96.16 07:20:00 AM all 3.54 0.00 0.95 95.51 07:30:00 AM all 2.65 0.00 0.86 96.49 07:40:00 AM all 3.02 0.00 0.96 96.02 07:50:00 AM all 2.90 0.00 0.86 96.24 08:00:00 AM all 3.28 0.00 0.95 95.77 08:10:00 AM all 3.45 0.00 1.09 95.46 08:20:00 AM all 3.46 0.00 1.02 95.52 08:30:00 AM all 4.98 0.00 1.27 93.75 08:30:00 AM CPU %user %nice %system %idle 08:40:00 AM all 5.69 0.00 1.54 92.78 08:50:00 AM all 6.98 0.00 1.63 91.38 09:00:00 AM all 7.73 0.00 1.94 90.32 09:10:00 AM all 7.65 0.00 1.97 90.37 09:20:00 AM all 8.12 0.00 2.09 89.78 09:30:01 AM all 12.55 0.00 2.46 84.99 09:40:00 AM all 13.31 0.00 2.49 84.19 09:50:00 AM all 11.41 0.00 2.56 86.03 10:00:00 AM all 9.41 0.00 2.37 88.21 10:10:01 AM all 10.06 0.00 2.34 87.60 10:20:00 AM all 9.69 0.00 2.37 87.94 10:30:00 AM all 10.86 0.00 2.55 86.59 Average: all 4.21 0.03 1.17 94.59 nagios@cubic:~>
Reviewed 12 years ago
Could not download the script itself it opened in webage. So I copied and pasted it in vi. When I run it it executes bit it always gives me that Critical warning and all CPUs running at 99% no matter when I run it its same nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~> ./chk_linux_procstat.pl -w 70 -c 80 CRITICAL - 4 CPUs - CPU(all) 99.0% used > 80%, CPU0 99.0% used > 80%, CPU1 99.0% used > 80%, CPU2 99.0% used > 80%, CPU3 99.0% used > 80% nagios@cubic:~>
I am using SUSE 11 and when i run this i am getting nagios@cubic:~> ./check_cpu -c 95 -w 90 expr: syntax error OK - CPU used=% idle=% | 'CPU Usage'=%;90;95; nagios@cubic:~>
1: Can't download the file; had to copy from browser and past it in vi 2: not enough instruction how to set it up and what it needs to run 3: no instructions on how to run it and pass parameters to it. 4: Doesn't which perl version it needs I tried to run it and I got following line I do have perl installed nagios@wlnagios:~> which perl /usr/bin/perl nagios@wlnagios:~> nagios@wlnagios:~> ./check_cpu.pl Can't locate Getopt/Compact.pm in @INC (@INC contains: /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .) at ./check_cpu.pl line 5. BEGIN failed--compilation aborted at ./check_cpu.pl line 5.
I tired this it works in simple and straight forward cases but fails in bit odd situations. For example $ ./check_procs2 gurjobs eq 1 and daemon Prod eq 1 ./check_procs2: incomplete expression In my case "daemon PROD" is one process; if I put just a 'daemon' or just 'PROD' its not going to work because there are lots of other daemons on host and processes also that have PROD in them but I need to watch these 2 specific processed only. It will also be nice if user option can be added so that if there processes that share a name but run by different users; then you can extract them out.
Hi Is there any reason it print such a huge user percent of 5599% nagios@cubic:~> ./chk_perf_cpu.sh -uw 70 -iw 95 -sw 85 -uc 80 -ic 98 -sc 95 -n 5 CPU CRITICAL : user=5599% system=10% iowait=88% idle=2% | cpu_user=5599%;70;80; cpu_sys=10%;85;95; cpu_iowait=88%;95;98; cpu_idle=2%; nagios@cubic:~>
I ran it with option show on the page on Suse linux 11 and I get following output nagios@cubic:~> ./check_cpu_stats.sh -w 90,40,30 -c 90,50,40 -i 3 -n 5 ./check_cpu_stats.sh: line 172: [: 90,40,30: integer expression expected ./check_cpu_stats.sh: line 175: [: 90,50,40: integer expression expected CPU STATISTICS OK : user=6.50% system=1.33% iowait=92.17% idle=% nice=0.00% | CpuUser=6.50;CpuSystem=1.33;CpuIoWait=92.17;CpuIdle=;CpuNice=0.00;90,40,30;90,50,40 nagios@cubic:~> Integre expression expected is one issue and second thing idle is always empty. if I run it like this then i don't get integer expression but Idle is still empty nagios@cubic:~> ./check_cpu_stats.sh -w 90 -c 95 -i 2 -n 10 CPU STATISTICS WARNING : user=7.25% system=2.62% iowait=90.12% idle=% nice=0.00% | CpuUser=7.25;CpuSystem=2.62;CpuIoWait=90.12;CpuIdle=;CpuNice=0.00;90;95 nagios@cubic:~> also you can see that its warning just because IoWait is hitting 90%