sudo -s apt-get install perl apt-get install libnotify-bin apt-get install lm-sensors apt-get install sysstat apt-get install apache2 exit
#!/bin/bash export DISPLAY=:0.0; echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <!-- Coded and designed by 19N4T0V --> <head> <meta http-equiv="Content-Type" content="text/html; charset=KOI8-R"> <script type="text/javascript" src="jquery.js"></script> <title>Kansatsu</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="leftline"> <a href=""><div class="header"></div></a> <ul class="leftmenu"> <a href="#summary"><li>SUMMARY</li></a> <a href="#IO"><li>I/O STATS</li></a> <a href="#temperature"><li>TEMPERATURE</li></a> <a href="#HDD"><li>HDD</li></a> <a href="#RAM"><li>RAM</li></a> <a href="#net"><li>NETWORK</li></a> <a href="#PROC"><li>PROC</li></a> </ul> </div> <div class="content"> <!--ABOUT BEGINS HERE--> <div class="block"> <div class="bl_head"> ABOUT </div> <div class="bl_info"> KANSATSU monitoring system is an opensource project. License is <a href="http://www.gnu.org/copyleft/"><font color="red">GNU copyleft</font></a>. This is the simple scripts written in BASH and Perl, running as a cron job . Everything you can see there is just responding to console comands. Author - <a href="http://19N4T0V.PNZ.RU/"><font color="red">19N4T0V</font></a>. If you want to receive the code to use or improve it - write me. <br> Thanks to <a href="http://linux.org.ru/"><font color="red">LOR</font></a> users for help and advices.<br> DEPENDS: lm-sensors, libnotify-bin, perl, sysstat. </div> </div> <!--SUMMARY BEGINS HERE--> <div class="block" id = "summary"> <div class="bl_head"> SUMMARY </div> <div class="bl_info"> <div class="line"> <div class="tit"> HOSTNAME </div> <div class="tty">' > /var/www/index.html hostname >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> UPTIME </div> <div class="tty">' >> /var/www/index.html; uptime | sed 's/,.*//' | sed 's/.*up //' >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> TIMESTAMP </div> <div class="tty">' >>/var/www/index.html; date >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> KERNEL </div> <div class="tty">'>> /var/www/index.html; uname -s >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> VERSION </div> <div class="tty">' >> /var/www/index.html; uname -r >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> HARDWARE </div> <div class="tty">' >> /var/www/index.html; uname -m >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> PROCESSOR </div> <div class="tty">' >> /var/www/index.html; uname -p >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> PLATFORM </div> <div class="tty">' >> /var/www/index.html; uname -i >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> OS </div> <div class="tty">' >> /var/www/index.html; uname -o >> /var/www/index.html; echo ' </div> </div> </div> </div> <!--IO BEGINS HERE--> ' >> /var/www/index.html; echo ' <div class="block" id ="IO"> <div class="bl_head"> I/O STATS </div> <div class="bl_info"> ' >> /var/www/index.html; iostat -h -x > /var/www/tmp; perl /var/www/scr.pl; echo ' </div> </div> </div> </div> <!--TEMPERATURE BEGINS HERE--> <div class="block" id ="temperature"> <div class="bl_head"> TEMPERATURE </div> <div class="bl_info"> <div class="line"> <div class="tit"> CHIPSET CURRENT </div> <div class="tty">' >> /var/www/index.html; sensors -u | grep "temp1_input" | sed 's/temp1_input://' | sed 's/ *//g' | sed 's/\.000//' >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> CHIPSET CRITICAL </div> <div class="tty">' >>/var/www/index.html; sensors -u | grep "temp1_crit" | sed 's/temp1_crit://' | sed 's/ *//g' | sed 's/\.000//' >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> CORE1 CURRENT </div> <div class="tty">' >> /var/www/index.html; sensors -u | grep "temp2_input" | sed 's/.*: //' | sed 's/.000//' >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> CORE1 CRITICAL </div> <div class="tty">' >> /var/www/index.html; sensors -u | grep "temp2_crit:" | sed 's/.*: //' | sed 's/.000//' >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> CORE2 CURRENT </div> <div class="tty">' >> /var/www/index.html; sensors -u | grep "temp3_input" | sed 's/.*: //' | sed 's/.000//' >> /var/www/index.html; echo ' </div> </div> <div class="line"> <div class="tit"> CORE2 CRITICAL </div> <div class="tty">' >> /var/www/index.html; sensors -u | grep "temp3_crit:" | sed 's/.*: //' | sed 's/.000//' >> /var/www/index.html; echo ' </div> </div> </div> </div> <!--HDD BEGINS HERE--> <div class="block" id="HDD"> <div class="bl_head"> HDD </div> <div class="bl_info">' >> /var/www/index.html; df -a -h > /var/www/tmp; perl /var/www/scr.pl; echo ' </div> </div> <!--RAM BEGINS HERE--> <div class="block" id="RAM"> <div class="bl_head"> RAM </div> <div class="bl_info">' >> /var/www/index.html; free -l -h > /var/www/tmp; perl /var/www/scr.pl; echo '</div></div> <!--NETWORK BEGINS HERE--> <div class="block" id="net"> <div class="bl_head"> NETWORK </div> <div class="bl_info">' >> /var/www/index.html; ifconfig > /var/www/tmp; perl /var/www/scr.pl; echo ' </div> </div> <!--PROC BEGINS HERE--> <div class="block" id="PROC"> <div class="bl_head"> PROC </div> <div class="bl_info">' >> /var/www/index.html; top -n1 -b > /var/www/tmp; perl /var/www/scr.pl; echo ' </div> </div>' >> /var/www/index.html; #footer, closing "content" div and finishing DOM tree echo '</div> </body> </html>' >> /var/www/index.html; notify-send "KANSATSU" "Report has been updated";
hostname >> /var/www/index.html; uptime | sed 's/,.*//' | sed 's/.*up //' >> /var/www/index.html; date >> /var/www/index.html; uname -s >> /var/www/index.html; uname -r >> /var/www/index.html; uname -m >> /var/www/index.html; uname -p >> /var/www/index.html; uname -i >> /var/www/index.html; uname -o >> /var/www/index.html; iostat -h -x > /var/www/tmp; perl /var/www/scr.pl; sensors -u | grep "temp1_input" | sed 's/temp1_input://' | sed 's/ *//g' | sed 's/\.000//' >> /var/www/index.html; sensors -u | grep "temp1_crit" | sed 's/temp1_crit://' | sed 's/ *//g' | sed 's/\.000//' >> /var/www/index.html; sensors -u | grep "temp2_input" | sed 's/.*: //' | sed 's/.000//' >> /var/www/index.html; sensors -u | grep "temp2_crit:" | sed 's/.*: //' | sed 's/.000//' >> /var/www/index.html; sensors -u | grep "temp3_input" | sed 's/.*: //' | sed 's/.000//' >> /var/www/index.html; sensors -u | grep "temp3_crit:" | sed 's/.*: //' | sed 's/.000//' >> /var/www/index.html; df -a -h > /var/www/tmp; perl /var/www/scr.pl; free -l -h > /var/www/tmp; perl /var/www/scr.pl; ifconfig > /var/www/tmp; perl /var/www/scr.pl; top -n1 -b > /var/www/tmp; perl /var/www/scr.pl; notify-send "KANSATSU" "Report has been updated";
#! perl -w open (STREAM_IN, '/var/www/tmp');# || die "Can't open STREAM_IN\n"; open (STREAM_OUT, '>> /var/www/index.html');# || die "Can't open STREAM_OUT\n"; $s1 = '<div class="line">'; $s2 = '</div>'; while ($curr = <STREAM_IN>) { chomp($curr); $curr=~s/\s/\ /g; $out = $s1.$curr.$s2; print (STREAM_OUT $out); }; close STREAM_IN; close STREAM_OUT;
html { height:100%; width:100% } body { height:100%; width:100%; padding:0px; margin:0; color:#000; font-family:Arial; font-size:14px; background-color:#FFF; } .leftline { width:210px; overflow:hidden; float:left; height:100%; position:fixed; top:0px; left:0px; } .header { width:100%; float:none; background:url(logo.png) top left no-repeat; height:160px; } .leftmenu { padding:0px; } .leftmenu li { width:200px; height:30px; background:#000; font-size:24px; line-height:1.3; float:none; margin:10px 10px 10px 0px ; text-align:right; padding-right:10px; list-style:none } .leftmenu li:hover { background:#FF0000; } a { color:#FFF; text-decoration:none; } .content { } .block { float:none; margin-top:20px; margin-left:250px; margin-right:50px; border-left:2px black solid; } .bl_head { color:#fff; background:#000; padding:10px 0px 10px 10px; } .bl_info { color:#000; padding-left:10px; padding-top:5px; } .line { display:block; height:20px; cursor:default; } .line:hover { background:red; } .tit { width:200px; float:left; } .tty { }
sudo chmod 777 /var/www/index.html sudo chmod 777 /var/www/tmp sudo chmod 777 /var/www/scr.pl sudo chmod 777 /var/www/style.css
alias kansatsu="sh /var/www/kansatsu.sh"
crontab -e
Source: https://habr.com/ru/post/165171/
All Articles