I would like to report back on my progress here with getting a report of the RAID1 condition and a few other things, such as files open in a SMB connection.
To get the condition of a raid array on the sme server.
First, i built some bash scripts to create some txt files periodically that had information in them i wanted and place them into a webpage file. I started using file extensions of .PRN then changed to .TXT file extensions. It was a learning experience for me as a beginner with linux, and where i as a user(admin) has to copy procedures to get things going.
But is soon found out how to use some simple php code to generated what i wanted into a web page servered by the sme server, which was far better and simpler.
I created a directory under the primary ibay called "'/home/e-smith/files/ibays/Primary/html/serverstatus"
I placed into the directory three php files that would run linux system commands and php commands to return minimum information, but important to me.
I used the chmod program to set the whole serverstatus directory to 777 which Charlie mentioned was some kind of security issue, then i believe somebody mentioned 775. I think now i understand Charlie's concern but i have not had time to work with chmod command and i needed to get things a rolling on to get the job done, but i want to come back to the chmod 777 thing some time soon.
I like having the directory name set to serverstatus for reasons it makes it easier to set some policies on windows clients using IEURLLOCK to access the web server but that is another story.
All this has come from help from others but i would like to wrap it up here with the three php files i am now using.
"lgreport.php" is just an extended and more detailed report than what the first report "index.php" reports on. I am using index.php as the short report because i do not want anybody browsing my web page directory "serverstatus". Who knows what i will put in there later. I also built a php file to report smb workstations longed on and open files on the server. This has been a big help in troubleshooting files left open with a little thing call "opportunistic file locking" and also just viewing what files are open and by whom for various other reasons. Do you know how hard it is to get files the opened and by who on a windows computer easily?
Naturally, like most users, we are running windows workstations. Here is how i am the using the web pages.
On the workstations, i created a directory called "C:\WEBPAGES", and placed two url shortcuts in the directory.
serverstatus.url
[InternetShortcut]
URL=http://192.168.1.191/serverstatus
filesopen.url
[InternetShortcut]
URL=http://192.168.1.191/serverstatus/sambausersopen.php
i have a batch file on every computer that performs all the setup after bootup
I placed the command "START C:\WEBPAGES\SERVERSTATUS.URL" as one of the last commands in my batch file.
Now upon any bootup from a windows workstation, which should be done daily in the morning, the users can study the reports for a bad raid array and low disk space useage.
I placed a shortcut to the directory "C:\WEBPAGES" on each users desktop so that anybody could easily get to the webpages. Sure is better than favorites and can be used with any web browser.
Here are the php files i use and i left some extra code in there for testing that is commented out with "\\" characters that may or may not be useful to others.
index.php
<!--DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"-->
<html>
<head><title>Server Status</title></head>
<body>
<tt>
<b>
<div>
<?php
print "<pre>";
echo '<font size="4">';
print "Server Status Report\n";
print "\n";
print "Current date : ";
system("date +'%m-%d-%Y %T %Z' | col -b",$return);
print " URL name : ";
print ($_SERVER['SERVER_NAME']);
print "\n";
print " Server name : ";
system("uname -n | col -b",$return);
print "************** UPTIME ***************\n";
system("uptime | col -b",$return);
print "\n";
print "\n";
print "************** RAID STATUS **********\n";
system("cat /proc/mdstat | col -b",$return);
print "\n";
print "************** DISK STATUS **********\n";
system("df -h | col -b",$return);
//system("df | col -b",$return);
print "\n";
print "\n---end of report---\n";
print "</pre>";
?>
<p>A more detailed report is <a href="lgreport.php">available here</a>.</p>
</div>
</body>
</html>
lgreport.php
<!--DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"-->
<html>
<head><title>Server Status</title></head>
<body>
<tt>
<b>
<div>
<?php
print "<pre>";
echo '<font size="4">';
print "Server Status Report\n";
print "\n";
print "Current date : ";
system("date +'%m-%d-%Y %T %Z' | col -b",$return);
print " URL name : ";
print ($_SERVER['SERVER_NAME']);
print "\n";
print " Server name : ";
system("uname -n | col -b",$return);
print "************** UPTIME ***************\n";
system("uptime | col -b",$return);
print "\n";
print "\n";
print "************** RAID STATUS **********\n";
system("cat /proc/mdstat | col -b",$return);
print "\n";
print "************** DISK STATUS **********\n";
// system("df -h | col -b",$return);
system("df | col -b",$return);
print "\n";
print "************** ETHERNET PORT STATUS ******\n";
system("ifconfig | col -b",$return);
print "\n";
print "************** SERVER TYPE ***************\n";
system("uname -orp | col -b",$return);
print "\n";
print "************** SERVER MEMORY *************\n";
system("free | col -b",$return);
print "\n";
// print "************** RPM PACKAGES INSTALLED ****\n";
// system("rpm -qa --last | col -b",$return);
// print "\n";
// print "************** UPDATES FOR INSTALLED PACKAGES ****\n";
// system("yum list updates | col -b",$return);
// print "\n";
// print "**************************************************\n";
// system("printenv | col -b",$return);
// print "\n";
print "\n---end of report---\n";
print "</pre>";
?>
</div>
</body>
sambausersopen.php
<!--DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"-->
<html>
<head><title>Server Status</title></head>
<body>
<tt>
<b>
<div>
<?php
print "<pre>";
echo '<font size="4">';
print "Server Status Report\n";
print "\n";
print "Current date : ";
system("date +'%m-%d-%Y %T %Z' | col -b",$return);
print " URL name : ";
print ($_SERVER['SERVER_NAME']);
print "\n";
print " Server name : ";
system("uname -n | col -b",$return);
print "************** UPTIME ***************\n";
system("uptime | col -b",$return);
print "\n";
print "\n";
print "************** SMB STATUS ****************\n";
system("smbstatus | col -b",$return);
print "\n";
print "\n---end of report---\n";
print "</pre>";
?>
</div>
</body>
</html>
I had copied some code in the program to format the uptime information to something better, but it just did not work, so now i am coping out the return code of whatever sme server returns.
I do not know much about linux and somethings are very wierd, but i am finding out one thing. In linux "EVERTHING IS A FILE"
Now, at my office i can write a program to access these web pages one after another by either a web browser or a program i write to retrieve the web pages with a program to interpret the pages for my use.