diff --git a/deb/scripts/nvidia_smi_stats b/deb/scripts/nvidia_smi_stats index 7dfd218..eaad02e 100755 --- a/deb/scripts/nvidia_smi_stats +++ b/deb/scripts/nvidia_smi_stats @@ -7,7 +7,7 @@ use IPC::Open3; my $fnret = smi_stats(); if(!ok($fnret) ) { - print "Error with nvidia smi stats \n"; + print STDERR "Error with nvidia smi stats \n"; } else { @@ -19,7 +19,7 @@ sub smi_stats my $fnret = execute("/usr/bin/nvidia-smi", "--query-gpu=gpu_name,gpu_uuid,index,memory.total,memory.used,utilization.memory,utilization.gpu,encoder.stats.sessionCount,temperature.gpu,power.draw", "--format=csv,noheader,nounits"); if ( $fnret->{status} != 100 ) { - print "$fnret->{msg} \n"; + print STDERR "$fnret->{msg} \n"; return { status => 500, msg => "nvidia-smi error: $fnret->{msg}" }; } else @@ -61,7 +61,7 @@ sub ok } elsif (ref $arg eq 'HASH' and $arg->{status} eq 500 and defined($arg->{msg})) { - print $arg->{msg}; + print STDERR $arg->{msg}; } return 0; } diff --git a/deb/scripts/rtmHardware.pl b/deb/scripts/rtmHardware.pl index 61bedff..fb42211 100755 --- a/deb/scripts/rtmHardware.pl +++ b/deb/scripts/rtmHardware.pl @@ -39,7 +39,7 @@ sub rtmHardware } else { - print "Error with CPUInfo \n"; + print STDERR "Error with CPUInfo \n"; } $fnret = getSgPaths(); if( ok($fnret) ) @@ -58,7 +58,7 @@ sub rtmHardware } else { - print "Error with kernel_oops \n"; + print STDERR "Error with kernel_oops \n"; } $fnret = os(); if (ok($fnret)) @@ -67,7 +67,7 @@ sub rtmHardware } else { - print "Error with os \n"; + print STDERR "Error with os \n"; } $fnret = motherboard(); if (ok($fnret)) @@ -76,7 +76,7 @@ sub rtmHardware } else { - print "Error with motherboard \n"; + print STDERR "Error with motherboard \n"; } $fnret = disk(); if (ok($fnret)) @@ -85,7 +85,7 @@ sub rtmHardware } else { - print "Error with disk \n"; + print STDERR "Error with disk \n"; } $fnret = lspci(); if (ok($fnret)) @@ -94,7 +94,7 @@ sub rtmHardware } else { - print "Error with lspci \n"; + print STDERR "Error with lspci \n"; } } @@ -129,7 +129,7 @@ sub CPUInfo } else { - print "Cannot open /proc/cpuinfo"; + print STDERR "Cannot open /proc/cpuinfo"; return {status => 500, msg => "Cannot open /proc/loadavg" }; } } @@ -140,7 +140,7 @@ sub kernel my $fnret = execute('uname -r'); if ( $fnret->{status} != 100 or !defined($fnret->{value}[0])) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; return { status => 500, msg => "uname error: ".$fnret->{msg}}; } else @@ -151,7 +151,7 @@ sub kernel $fnret = execute('uname -v'); if ( $fnret->{status} != 100 or !defined($fnret->{value}[0])) { - print $fnret->{msg}. "\n"; + print STDERR $fnret->{msg}. "\n"; return { status => 500, msg => "uname error: ".$fnret->{msg} }; } else @@ -166,7 +166,7 @@ sub os my $fnret =execute("lsb_release","-a"); if ( $fnret->{status} != 100 ) { - print "Error ".$fnret->{msg}." \n"; + print STDERR "Error ".$fnret->{msg}." \n"; # maybe red hat: if (open(my $fh, '<', "/etc/redhat-release")) { @@ -179,7 +179,7 @@ sub os } else { - print "Cannot open /etc/redhat-release"; + print STDERR "Cannot open /etc/redhat-release"; return {status => 500, msg => "Cannot open /etc/redhat-release" }; } } @@ -210,7 +210,7 @@ sub motherboard my $fnret = execute('dmidecode'); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; return { status => 500, msg => "dmidecode error: ".$fnret->{msg}}; } else @@ -280,7 +280,7 @@ sub disk my $fnret = execute('lsblk -r --nodeps -o name 2>/dev/null'); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; return { status => 500, msg => "lsblk error: ".$fnret->{msg}}; } else @@ -309,7 +309,7 @@ sub disk my $fnret = execute("smartctl -a $diskSmart 2>/dev/null"); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; next; } else @@ -438,7 +438,7 @@ sub disk my $fnret= execute("hddtemp $diskSmart 2>/dev/null"); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; next; } elsif (defined $fnret->{value}[0]) @@ -504,7 +504,7 @@ sub lspci my $fnret = execute("lspci -n 2>/dev/null"); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; return { status => 500, msg => "lspci error: ".$fnret->{msg}}; } else @@ -537,7 +537,7 @@ sub getSectorSize { my $fnret = execute("blockdev --getss $disk"); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; return { status => 500, msg => "Error: unable to get sector size for device $disk"}; } elsif (defined($fnret->{value}[0])) @@ -1202,7 +1202,7 @@ sub getSgPaths my $fnret = execute("lsscsi -tg 2>/dev/null"); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; return { status => 500, msg => "Unable to gather sg paths ".$fnret->{msg}}; } else @@ -1239,7 +1239,7 @@ sub getSupportedLogPages my $fnret = execute("sg_logs -x $devPath 2>/dev/null"); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; return { status => 500, msg => "Unable to get sg logs pages ".$fnret->{msg}}; } else @@ -1279,7 +1279,7 @@ sub getGenericLogPage my $fnret = execute("sg_logs -x --page $page $devPath"); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; return { status => 500, msg => "Unable to get sg logs requested page ".$fnret->{msg}}; } else @@ -1347,7 +1347,7 @@ sub getBackgroundScanResultsLogPage my $fnret = execute("sg_logs -x --page 0x15 $devPath 2>/dev/null"); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; return { status => 500, msg => "Unable to get background scan page: ".$fnret->{msg}."\n"}; } else @@ -1419,7 +1419,7 @@ sub getDmesg my $fnret = execute('/bin/dmesg -T | tail -n 15000'); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; return { status => 500, msg => "dmesg error: ".$fnret->{msg}}; } else @@ -1479,7 +1479,7 @@ sub iostatCounters my $fnret = execute("/usr/bin/iostat -d -x $devPath"); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; return { status => 500, msg => "iostat error: ".$fnret->{msg}}; } else @@ -1960,7 +1960,7 @@ sub ok } elsif (ref $arg eq 'HASH' and $arg->{status} eq 500 and defined($arg->{msg})) { - print $arg->{msg}; + print STDERR $arg->{msg}; } return 0; } diff --git a/deb/scripts/rtmHourly.pl b/deb/scripts/rtmHourly.pl index 2e213bb..277dfc5 100755 --- a/deb/scripts/rtmHourly.pl +++ b/deb/scripts/rtmHourly.pl @@ -23,7 +23,7 @@ sub systemInfo } else { - print "Error with processes \n"; + print STDERR "Error with processes \n"; } $fnret = _getTopProcess(); if (ok($fnret)) @@ -32,7 +32,7 @@ sub systemInfo } else { - print "Error with getTopProcess \n"; + print STDERR "Error with getTopProcess \n"; } $fnret = _getPortsAndInfos(); if (ok($fnret)) @@ -41,7 +41,7 @@ sub systemInfo } else { - print "Error with getPortsAndInfos \n"; + print STDERR "Error with getPortsAndInfos \n"; } $fnret = uptime(); if (ok($fnret)) @@ -50,7 +50,7 @@ sub systemInfo } else { - print "Error with uptime \n"; + print STDERR "Error with uptime \n"; } # hostname @@ -71,7 +71,7 @@ sub processes my $fnret = execute('/bin/ps --no-headers -C noderig,beamium -o sess | sort -n | uniq'); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}." \n"; + print STDERR $fnret->{msg}." \n"; return { status => 500, msg => "ps error: ".$fnret->{msg}." \n" }; } else @@ -80,7 +80,7 @@ sub processes $fnret = execute('/bin/ps --no-headers -A -o sess,state,command'); if( $fnret->{status} != 100 ) { - print "ps error: ".$fnret->{msg}."\n"; + print STDERR "ps error: ".$fnret->{msg}."\n"; return { status => 500, msg => "ps error: ".$fnret->{msg}." \n" }; } else @@ -112,7 +112,7 @@ sub _getTopProcess my $fnret = execute('/bin/ps -A -o vsz,cmd --sort=-vsz --no-headers | head -n 7 | grep -vE "[0123456789]+[ ]/usr/bin/(noderig|beamium)"'); if ( $fnret->{status} != 100 ) { - print "ps error: ".$fnret->{msg}." \n"; + print STDERR "ps error: ".$fnret->{msg}." \n"; return { status => 500, msg => "ps error: ".$fnret->{msg}."\n" }; } else @@ -143,7 +143,7 @@ sub _getPortsAndInfos my $fnret = execute('/bin/netstat -tlenp | grep LISTEN | grep -v \'tcp6\' | awk \'{print $4"|"$9}\''); if ( $fnret->{status} != 100 ) { - print $fnret->{msg}."\n"; + print STDERR $fnret->{msg}."\n"; return { status => 500, msg => "netstat error: ".$fnret->{msg}."\n" }; } else @@ -212,13 +212,13 @@ sub _getPortsAndInfos } else { - print "Could not open /proc/$pid/status"; + print STDERR "Could not open /proc/$pid/status"; return {status=>500}; } } else { - print "Could not open /proc/$pid/cmdline"; + print STDERR "Could not open /proc/$pid/cmdline"; return {status=>500}; } } @@ -226,7 +226,7 @@ sub _getPortsAndInfos } else { - print "Could not open /etc/passwd"; + print STDERR "Could not open /etc/passwd"; return {status=>500}; } } @@ -245,7 +245,7 @@ sub uptime } else { - print "Cannot open /proc/uptime"; + print STDERR "Cannot open /proc/uptime"; return {status => 500, msg => "Cannot open /proc/loadavg" }; } } @@ -299,7 +299,7 @@ sub ok } elsif (ref $arg eq 'HASH' and $arg->{status} eq 500 and defined($arg->{msg})) { - print $arg->{msg}; + print STDERR $arg->{msg}; } return 0; } diff --git a/deb/scripts/rtmRaidCheck.pl b/deb/scripts/rtmRaidCheck.pl index 2cf6a9d..8222852 100755 --- a/deb/scripts/rtmRaidCheck.pl +++ b/deb/scripts/rtmRaidCheck.pl @@ -15,7 +15,7 @@ sub rtmRaidCheck my $fnret = execute('which mdadm 2>/dev/null'); if ( $fnret->{status} != 100 ) { - print "mdadm not found \n"; + print STDERR "mdadm not found \n"; } elsif (defined($fnret->{value}[0])) { @@ -24,7 +24,7 @@ sub rtmRaidCheck $fnret = execute('which mpt-status 2>/dev/null'); if ( $fnret->{status} != 100 ) { - print "mpt-status not found \n"; + print STDERR "mpt-status not found \n"; } elsif (defined($fnret->{value}[0])) { @@ -33,7 +33,7 @@ sub rtmRaidCheck $fnret = execute('which lsiutil 2>/dev/null'); if ( $fnret->{status} != 100 ) { - print "lsiutil not found \n"; + print STDERR "lsiutil not found \n"; } elsif (defined($fnret->{value}[0])) { @@ -42,7 +42,7 @@ sub rtmRaidCheck $fnret = execute('which lspci 2>/dev/null'); if ( $fnret->{status} != 100 ) { - print "lspci not found \n"; + print STDERR "lspci not found \n"; } elsif (defined($fnret->{value}[0])) { @@ -53,7 +53,7 @@ sub rtmRaidCheck $fnret = execute("$LSPCI -d 1000:"); if ( $fnret->{status} != 100 ) { - print ("error executing: $LSPCI -d 1000: \n"); + print STDERR ("error executing: $LSPCI -d 1000: \n"); } elsif (defined($fnret->{value}[0])) { @@ -63,7 +63,7 @@ sub rtmRaidCheck $fnret = execute("$MPTSTATUS -p 2>/dev/null | grep 'Found SCSI' | cut -f1 -d, | cut -f2 -d="); if ( $fnret->{status} != 100 ) { - print "SCSI not found \n"; + print STDERR "SCSI not found \n"; } elsif(defined($fnret->{value}[0])) { @@ -88,7 +88,7 @@ sub rtmRaidCheck $fnret = execute("$MPTSTATUS -i $SCSI_ID"); if ( $fnret->{status} != 100 ) { - print "SCSI not found \n"; + print STDERR "SCSI not found \n"; undef $MPTSTATUS; } elsif (defined($fnret->{value}[0])) @@ -101,7 +101,7 @@ sub rtmRaidCheck else { # nothing returned, - print "Nothing returned with lspci -d 1000: \n"; + print STDERR "Nothing returned with lspci -d 1000: \n"; } } my ($line, @mptInfo, @twCliInfo, $controler); @@ -113,7 +113,7 @@ sub rtmRaidCheck $fnret = execute('cat /proc/mdstat | grep md'); if ( $fnret->{status} != 100 ) { - print "no md device found in /proc/mdstat \n"; + print STDERR "no md device found in /proc/mdstat \n"; } else { @@ -185,7 +185,7 @@ sub rtmRaidCheck $fnret = execute("$MPTSTATUS 2>/dev/null"); if ($fnret->{status} != '100') { - print "no MPTSTATUS \n"; + print STDERR "no MPTSTATUS \n"; } else { @@ -271,7 +271,7 @@ sub rtmRaidCheck $fnret = execute('cat /proc/mpt/summary'); if($fnret->{status} != '100') { - print"can't cat /proc/mpt/summary \n"; + print STDERR "can't cat /proc/mpt/summary \n"; } else { @@ -663,7 +663,7 @@ sub ok } elsif (ref $arg eq 'HASH' and $arg->{status} eq 500 and defined($arg->{msg})) { - print $arg->{msg}; + print STDERR $arg->{msg}; } return 0; }