Remotely Monitoring a Satellite Instrument
Our original design was based on two computers. One was an NT workstation running the Level 0 software and simultaneously providing some real-time strip charts of data. The second was a Linux workstation running the Level 1 software. It was a P-II with 128MB RAM and 24GB hard drive to catch six week's worth of calibration data. We built the Linux workstation for about $3500. We ran Samba on the Linux workstation so that the NT box could write its Level 0 files to the large hard drive on the Linux box across the network.
We flew out to Utah with the computers to test the original design. It worked, but we had some reliability issues with the NT-based Level 0 software. One requirement was that the Level 0 files must be generated reliably and be read-accessible 24 hours per day. We had some unexplained hiccups when the files were accessed by programs such as Microsoft Notepad. After verifying that file read/write access was set correctly, we decided to change the design and port the code to the Linux box.
As mentioned above, the Level 0 software was reconfigured from another GATS project that required an NT workstation. After reviewing the code, we realized the only Windows unique code was in the winsock calls for socket connections. It is easy to port Windows <winsock.h> calls to GNU C <socket.h> calls. In fact, it entails deleting some overhead needed in Windows but not required in GNU C. To make the code backward-compatible, we simply wrapped the Linux code with #ifdef LINUX-#else pre-compiler directives. This allowed us to keep the same version of code that worked on NT and Linux under one configuration management version. Some examples of converting Windows socket calls to Linux are shown in Listing 1.
With these modifications, we now had the Level 0 and Level 1 processing stages on one Linux workstation. We called this the Calibration Analysis Computer, and we left it and the (now spare) NT workstation at SDL connected to their network. During calibration tests, it generated Level 0 files 24 hours per day and never had to be rebooted over the six-week calibration period. As I mentioned before, the NT workstation had some strip-charting capabilities for viewing real-time data. This turned out to be a good use for the NT box, so we configured it to work with SABER data. Since the Linux workstation was on the Internet, we automatically had remote access, and we needed the same for the NT box. VNC filled the bill. This remarkable application (Virtual Network Computer) pipes the Windows desktop to a client running on a Linux X session. With VNC, we had the ability to set up and monitor the NT box remotely so we could configure it for SDL engineers wishing to view real-time temperature output. We could also view the same real-time strip-charts on our Linux workstations back in Virginia.
This system offers a great deal of flexibility. We chose to let the Linux workstation at SDL connect to the socket, then access the data through the Internet. We could also connect to the socket from Virginia and generate the Level 0 files in our office.
The Level 1 processing stage ran flawlessly. The PostgreSQL database on the GSE workstation was easily accessible from the front-end library (libpq-fe.h) that comes with this powerful SQL database. Each calibration test event was performed automatically by a script on the GSE workstation which automatically populated an “event” in the database. The Level 1 stage made a query to this database for beginning and ending times of the test event. With this information, the particular piece of the Level 0 files could be pulled out and processed (even though they were constantly being written to). These files, called calibration analysis files, could then be accessed by the analysis routines, which we called Level 1b.
The Level 1b processing stage contained powerful tools for analyzing the calibration data. Many of the algorithms were from other GATS projects and were reconfigured to be methods within classes developed for the SABER project. One valuable diagnostic tool proved to be the C-callable library that came with the Xmgr graphics analysis package. These library calls were wrapped in an easily utilized plotting method contained in our Level 1b class. Using objects that have diagnostic plot methods shortened the debugging period that comes with looking at real data for the first time.
Our development team was lean and mean—three people working on various modules with support from two others, all working under the CVS configuration management system. Since our computers moved back and forth across the country, they were set up to be easily configured for their current location. We did this with simple scripts, stored in /root, which are run after bootup. We had a script for each location—“atGats” and “atSDL”. These simple scripts set the local IP address and set an /etc/resolv.conf (containing the location of local name servers and IP addresses) for each location. The scripts simply made a dynamic link to the appropriate resolv.conf file. An alternate solution would have been dynamically assigned IP addresses through DHCP, but we already had pre-assigned local addresses from SDL, and this method was simple and gave us easy control based on the computer's location.
I attended the first two weeks of calibration testing in Utah to ensure everything was working well, while my support people stayed home in Virginia. During that time, we easily diagnosed problems and were able to make updates to the code using CVS (Concurrent Version System, the GNU configuration management package). I described problems, they were fixed in Virginia, and I got instant updates with the CVS update command. This works because CVS can be set up with an NFS-mounted CVS root directory on a remote machine (in this case, at GATS in Virginia).
Once the testing started and Level 0 files were being generated, we monitored the data from Virginia as the tests were being run. Quick queries of the database with SQL told us when tests were completed. Making the Level 1 files was easy to automate at this point. Since the Level 1 software had command-line arguments typical of UNIX applications, we wrote Perl scripts to loop over the test event IDs (which were database fields designating each test event), and generated the Level 1 files in batches. As we migrate the software to the post-launch processing system, we will automate the entire daily processing with similar Perl scripts.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...