Skip to main content

Gadget Wisdom

Tag: Linux

1 Response

Let’s Build a Server: Part 2 – Monitoring

Monit

Last time, in Part 1, we discussed setting up a firewall and an email relay so notifications from the firewall could get to us.

Now, in Part 2, we’re going to talk about more signal. Server monitoring and alerting. Our primary software for monitoring is Monit.

Monit has a single configuration file, but many distributions, including mine, set up a /etc/monit.d folder so you can divide your monit configuration into different files.

Once it is running, you can monitor its status by running
monit status
It will show the status of whatever is monitoring. There is also an optional web component, if you want to check status in a web browser.

What can you monitor?

Monit can monitor any program and restart it if it crashes.
check process nginx with pidfile /var/run/nginx.pid
start program = "/bin/systemctl start nginx.service"
stop program = "/bin/systemctl stop nginx.service"
if failed host 127.0.0.1 port 80
protocol http then restart
if 5 restarts within 5 cycles then timeout

As you can see, the simple scripting language allows you to not only restart, execute programs, but alert the user.

Not only can it make sure something is running, but it can monitor its resource usage, as well as system resource usage. It can monitor processes, network connections, programs and scripts, files, directories, etc.

An Alternative to Email Alerts

The default for an alert is to send an alert email, but for bigger emergencies, a phone push notification is also useful.

Monit provides a simple instruction on how to set it up for Pushover. There is also the alternative of PushBullet.

Pushover costs $5 per platform(Android, iOS, Desktop) to use on as many devices as you want. There is a per application limit of 7,500 messages per month. Pushbullet is, by comparison, free. The basic difference as I see it is that Pushbullet is more geared toward the consumer, and Pushover is more geared toward developers in how it was initially set up. They do have similar feature sets though.

Here is Monit’s suggested Pushover script, which can be run instead of an email alert.

/usr/bin/curl -s
-F "token=your_mmonit_or_monit_app_token"
-F "user=your_pushover_net_user_token"
-F "message=[$MONIT_HOST] $MONIT_SERVICE - $MONIT_DESCRIPTION"
https://api.pushover.net/1/messages.json

Here is an alternative version for Pushbullet

curl -u <your_access_token_here>: -X POST https://api.pushbullet.com/v2/pushes --header 'Content-Type: application/json' --data-binary '{"type": "note", "title": "$MONIT_HOST", "body": "$MONIT_SERVICE - $MONIT_DESCRIPTION"}'

Conclusion

In all cases, monit allows you to monitor your system and take action based on a change in performance. The complexity of your rules is entirely up to you. But, if you give thought to their setup, you can not only be told when there is a server emergency, but the system can take action to fix it.

Published on December 7, 2014
Full Post
0 Responses

Trying to Build a Better Web Server

We’ve been working hard here, behind the scenes, upgrading the Weneca Media servers. The Weneca Media Group is the umbrella term for all the sites we collectively host together.

The Weneca server works on what is called a LEMP stack. Linux, Nginx, MySQL, PHP. Nginx(pronounced Engine-X) is a lightweight web server which powers about 10% of the world’s web servers, including sites like WordPress.com and Netflix. Most of you have probably heard of Linux, the MySQL database server, and the PHP scripting language.

Nginx has just announced SPDY support in its development version, which should speed things up more. SPDY is a Google developed protocol to reduce web page load time, and is implemented in both Chrome and Firefox. It can work concurrently with HTTP, the common standard for web serving.

So, with this, we have a solid footing for implementing a lightweight framework to serve a lot of web pages. However, Nginx does not have built in PHP support. You have to pass PHP to be handled by another program. In this case, we are using PHP-FPM, which is now part of the official PHP package. PHP-FPM is a FastCGI manager creates a pool of processes to process PHP scripts and return the results to the server.

To reduce load on this, Nginx supports FastCGI caching, so the results of any dynamically built page, with some deliberate exceptions, are cached for a few minutes, and can be served as static files. The duration of the caching is variable. If you want basically fresh content, you can microcache, cache in seconds. So, only when your server got hammered would it be seeing static content. If you have a bit less dynamic content, you can increase that to minutes, or even hours.

Now, we continue to tweak and improve the services. In future, we’ll be covering a little of the Nginx and PHP-FPM configuration settings you may find interesting.

 

 

Published on June 29, 2012
Full Post
1 Response

Ubuntu 9.04 vs. Fedora 10

The Big Green Tree
Image by tipiro via Flickr

We came across a post from last week comparing the features of the upcoming Fedora 11 with the upcoming Ubuntu 9.04 and decided that the comparison was worth making. Ubuntu 9.04, codenamed Jaunty Jackalope, scheduled to be released April 23th, followed on May 26th by Fedora 11, codenamed Leonidas.

In version terms, Fedora is ahead. Kernel 2.6.29 vs. 2.6.28, Firefox 3.1 instead of 3.0, Thunderbird 3.0 instead of 2.0, OpenOffice 3.1 vs. 3.0 and filesystem ext4 instead of ext3. Both ship with Gnome 2.26, KDE 4.2 and XFCE 4.6. But, we admit, new versions are not always better. Well, they are, that is the point. But sometimes new features result in new problems.

Fedora is cutting edge. They are always going for better features, but despite what some critics say, that doesn’t always mean instability. Ubuntu’s focus is ease of use, not that Fedora in our opinion doesn’t have that as well, but it is Ubuntu’s most attractive feature to most…it focuses on ease of use for new users. Many features first tested in Fedora now are part of Ubuntu.

Today, Phoronix released the results of its tests of the betas of each of the new distributions. Ubuntu, as of now, won 10 out of 15 of the tests they used, although they admitted that development builds of Fedora have debugging options enabled, which may slow its overall performance. We agree a more definitive result will be interesting once the two are in final release. Hopefully they’ll wait a few weeks after both are issued, to iron out any early issues.

All Linux distributions have their issues. Take this blog post we found from one dissatisfied Linux tester who tried out a LiveCD. An issue with a network card, one likely easily fixed with a simple keyword search online, turned the author off to adopting the Linux lifestyle. But, compared to years ago, when everything had to be manually configured, 99% of hardware works under Ubuntu, Fedora, or the other major distributions out of the box. It has been a goal of them to get to this point.

Many improvements are coming under the hood, so to speak. More efficient booting is a goal on both distributions, as is adoption of the ext4 filesystem and new versions of various softwares they have in common. We’ll be watching, either way.

Reblog this post [with Zemanta]
Published on March 31, 2009
Full Post
0 Responses

Calling on Linux

The results of Lifehacker‘s Hive Five for Best Linux Distributions came out this week. Taking the lead are Debian-based distributions Debian, Ubuntu, and Linux Mint. Mint is a version of Ubuntu which is a version of Debian. Behind them was Fedora, our distribution of choice, then Gentoo. Fedora, is, of course, the distribution used by Linus Torvalds, the Father of Linux. We’ve stated and continue to state our thought about Linux on many occasions.

Coming in, interestingly enough, on the heels of the announcement was the release of Presto Beta. Presto is a $20 paid(or will be when it moves out of beta on April 13th) distribution of Linux based on Xandros, and is billed as a fast-loading Linux desktop you install from Windows. It was built for boot-up speed, and intends to give laptop users an alternative system to jump into when they really just want to do something quick without having to wait for a full OS to boot up. Manufacturers have been offering an alternate instant-on Linux-based system called Splashtop, which they have embedded into chips on many motherboards.

We are looking forward to the next version of Fedora, where they are trying to achieve a goal of a 20-second to login-screen startup. They may not reach it, but we’re sure they’ll get the time down as much as they can. We also, despite our interest in out-of-the-box bundles, can suggest a variety of tweaks for many Linux distributions to scale them down.

For example, Fedora and Ubuntu defaultly use Gnome as its desktop manager. Gnome can be replaced, for example, with XFCE or LXDE, both more lightweight. LXDE is recommended for netbooks for that reason. Openbox is a lightweight Window manager that will work under Gnome and offers many memory improvements and simplifications over alternatives. XFCE is another lightweight desktop manager, offered as the primary desktop on a special custom spin of Fedora.

With a few simple tweaks, one can get good results out of any Linux distribution on one’s hard drive. And the distributions, not just Fedora, are working on the issue as well, looking for places the default configuration can be altered to remove unnecessary or redundant commands that slow it, or for places to optimize.

For those of you with netbooks, check out this review of several custom spins of various Linux distributions optimized for netbooks. We have yet to see a community supported distribution of Fedora for netbooks, but we are sure someone will jump on that. Until then, we also wonder if there is a way to configure the boot loader to offer booting up into a stripped down desktop/window manager and configuration or a full Gnome launch, allowing you to switch between the two on the same OS from startup. If there isn’t, might be worth setting up.

Reblog this post [with Zemanta]
Published on March 20, 2009
Full Post
0 Responses

Dvorak Likes Linux – Good or Bad?

Dvorak hosting Episode 19 of CrankyGeeks.
Image via Wikipedia

We like John C. Dvorak. He’s a well known tech pundit, very outspoken, and interesting to read. However, one of the most interesting aspects of reading Dvorak is how often we disagree with him.

Dvorak has finally discovered Ubuntu 8.10, four months after the current version was released.

Many of its problems, for me, stem from its inability to run on my overloaded hardware, or the occasional driver that makes the OS impossible to use without hand-tweaking something or other.

To disagree with Mr. Dvorak, Linux has made great strides in hardware support, with both independent developers and hardware manufacturers working to ensure support. The simplest way to ensure you don’t come across a device that isn’t supported under Linux is to check before you buy it. Most devices are. So far, since we switched to Linux, we’ve only found a noname GPS receiver, a Canon Scanner, and a Radio Shack postal scale failing to work under it. But we usually check before we buy. Most minor hardware issues can usually be resolved with a little online searching. Even he admits Linux support is increasing on new hardware.

He does point out many good things about Linux during his exploration of Ubuntu.

  • The lightweight nature of it makes it perfect for older machines. Many distributions offer lower memory(RAM or HD) alternatives to programs, such as Abiword instead of OpenOffice, XFCE or Sugar instead of Gnome or KDE, etc.
  • “There is probably a Linux program that will substitute for just about any Windows programs with as much or more functionality.” Not sure we agree with him on Photoshop vs. Gimp, but we’re not artists.
  • Linux is mostly immune to malware and viruses, as the bulk of such things are written for Windows.
  • The Windows registry is ultimately flawed. It is an increasingly unwieldy database that over time, slows Windows to a crawl.

He does note that the Linux desktops are not as polished as Windows. However, we’re not sure whether or not he tried Compiz Fusion, which enables all those nice windows animations. We loved watching them, but we loved speed more, and ultimately turned them off. For productivity use, we’d rather simplify.

Even the French police recognize the wonder of Linux. They’ve saved millions by migrating to Ubuntu. Currently, they are running Ubuntu on about 5,000 workstations with long term plans to have their entire organization (90,000 workstations) running Ubuntu by 2015. Their budget has been reduced by seventy percent without losing any functionality.

We’d love to hear your thoughts on this. Comment with your thoughts.

Reblog this post [with Zemanta]
Published on March 12, 2009
Full Post
4 Responses

More on Fedora

Linux distribution
Image via Wikipedia

After our post yesterday on Fedora, we received a comment from Paul W. Frields, who is the Fedora Project Leader and chairman of the Fedora Project Board. He wrote:

I think the idea that we’re “regaining” users implies that we lost them somewhere along the way, which isn’t what our statistics show. Rather, as the total size of the Linux-user pie has become larger, we’ve continued to grow consistently. There will always be distro-hoppers looking for that elusive perfect Linux distribution — and more often than not, failing in that quest — but in general the strength of our development model, rapid release cycle, and putting the freshest software in front of users in a stable, easy to manage platform have retained users’ hearts for a long time. It’s true that we may not have the marketing push of Ubuntu; it’s a fine distribution and community, but given the choice between marketing features and creating them, we definitely choose the latter. We’re very happy that many of the features we create are adopted by other distributions, because that shows, first, the strength of the free software development model; and second, that our policy of working directly with the upstream, as opposed to creating a crazy quilt of technically questionable patches in our own distribution alone, is the winning strategy for long-term sustainability.

And he is right, we were inaccurate with the title. Fedora is improving its share of the overall Linux market, which continues to grow. There has been a lot of growth on the Ubuntu front, because of their aggressive marketing push. We’ve noticed developers seem to be releasing Ubuntu packaging and not is offering up-to-date Fedora packing.

Three pieces of software we’ve referenced on this blog come to mind. Dropbox, Boxee, and XBMC. Dropbox is a file sync application which offers a current Ubuntu package, but only a Fedora 9 rpm(which fortunately works with Fedora 10). XBMC and Boxee are both supported under Ubuntu, and maintained there, but require a series of source code hacks to work under Fedora.

Now, this is hardly a reflection on Fedora. XBMC and Boxee contain multimedia packages that Fedora cannot include for legal reasons…nor can Ubuntu for that matter. It is a reflection on our original point…essentially that Fedora(which we use) is gaining popularity. As Paul reminded us, one of the best parts of Fedora is that they work directly with upstream maintainers…those who write the packages Fedora is assembled from, such as the Gnome Desktop, which is a major part of multiple distributions, so that the alterations are done at a level above the individual distribution. Thus Fedora enhances the overall Linux experiences for all users, by being involved.

Reading a draft of this article on Fedora, it states that “the Fedora project has four basic foundations, the 4 Fs, its corner stones. Freedom, Friends, Features and First are the core values that govern us.”

“Freedom” represents the dedication to free software. It lays emphasis on the creation, usage and promotion of free, open source alternatives to proprietary or closed source solutions. Our aim is to provide software that is reliable as well as a hundred percent legally redistributable to everyone.

“Friends” signifies the strength of the community. The project consists of people from different parts of the world with different ideas and views with belief in Fedora’ s core values as their binding force. Everyone who wants to help is welcome at the community. Our decisions and steps are taken after a consensus is reached, as between friends!

“Features” represents our commitment to excellence. Fedora is responsible for the creation and constant improvement of software that takes the Linux world forward. It is for the benefit of all users of free software regardless of their distribution of choice.

Lastly, “first” represents our commitment to innovation. It signifies that every major step in the project is taken with a view of the future. Fedora is described as a bleeding edge distribution that always provides the latest available for Linux.

Fedora has some great features/goals for Fedora 11. They include, to name a few:

  • 20 Second Startup – Part of their continual goal to speed this up
  • Automatic Font and Mime Installer – Allowing programs on the desktop to automatically install fonts, codecs, and clipart
  • CrashCatcher – to help users with bug reporting
  • Ext4 – Replace the default ext3 partitioning scheme with ext4, its successor.
  • Updating the following included programs: Firefox to version 3.1, gcc to 4.4, Gnome to 2.26, NetBeans to 6.5, Python to 2.6, Thunderbird to 3, Xfce to 4.6, Xserver to 1.6.
  • Improved Fingerprint Reader support
  • Multiseat support – making it easy to  a single computer to operate with independent keyboard, mouse, and monitor for multiple users
  • Improve Power Management
  • Presto – Presto supports upgrades using DeltaRPMS. A DeltaRPM is a file that only has the differences between the last version of the software and the new one, allowing it to be much smaller. The DeltaRPM can be used to generate the updated package. This will reduce overall load on servers by not requiring users to download pieces of a file they already have.
  • Volume Control improvements – There have been problems with volume control since Fedora added Pulseaudio
  • Windows Cross-Compiler – Allows users to compile Windows programs without Windows

And many more…We look forward to enjoying them.

Reblog this post [with Zemanta]
Published on March 2, 2009
Full Post
0 Responses

Fedora Unity Does a Release

Image representing Fedora as depicted in Crunc...
Image via CrunchBase

We’re devotees of Fedora Linux, despite alternatives, and the incredible popularity of Ubuntu, which we have spent some time with. But we started with Red Hat 7, and with Fedora as its successor, we know more of the ins and outs of this distribution.

Tonight, we’re using to Jigdo to assemble new DVD images, as the Fedora Unity project has released a Fedora 10 re-spin. For those of you not familiar with these things, some background.

Jigdo is a wonderful thing, and has been used by various Linux distributions for some time, and only recently as a method for Fedora distribution. The idea is this…a CD or DVD for a Linux OS is merely a compilation of various software packages and configuration files. Instead of downloading an entire image, Jigdo assembles it from its components. This has several advantages…for one it doesn’t tax any one site. Jigdo, given a mirror list, can download files from multiple sites to assemble its image.

The Fedora Unity Re-Spin is a Jigdo image of the standard Fedora installation media, using any updates that have been released since the original release. Thus, if you install Fedora 10 on a new system, you don’t then have to download a few hundred megabytes of updated files to each system. We maintain a local mirror we use to update multiple systems at one time, and using it and Jigdo, can assemble a new installation DVD in less than 5 minutes.

The glaring gap in the Fedora Jigdo release is that specialty Fedora spins are not released as Jigdo templates. Fedora offers LiveCDs and custom distributions of various types, and these are distributed only as ISOs.

Either way, the Re-Spin system is a good one, and Fedora Unity provides a service. For those of you still on Windows, check out this Lifehacker article on their equivalent, known as slipstreaming.

Reblog this post [with Zemanta]
Published on February 23, 2009
Full Post

Get New Posts By Email