General discussion

  • Creator
    Topic
  • #2274692

    What is the best way to PM a linux box?

    Locked

    by mshultz ·

    I am curious what all of you linux admins do to PM your machines. I am a beginer with about 1 year of experience with linux so don’t hold back the obvious answers. Whether it is a server or workstation, what are some of the best actions to take while PMing (Preventative Maintenance) the machine?

All Comments

  • Author
    Replies
    • #2718887

      A few ideas

      by stress junkie ·

      In reply to What is the best way to PM a linux box?

      In my opinion you can generate your own preventive maintenance task list by first understanding the platform, any platform, and understanding how it accomplishes its work. Then the role that the machine plays and how it’s used will help to determine what needs to be done under what circumstances. Here are some ideas.

      If the machine is a workstation and is likely to be restarted “frequently”, as in daily or weekly, then the boot process can take care of a lot of preventive maintenance. For instance when you create a file system it is tuned to be checked during boot every 30th or 34th mount. You can tune this parameter to check the file system with fsck during boot on every 5th mount or whatever. The boot process can also be configured to clear temporary directories such as /tmp. This is a good time to clear these directories because during the boot process it is not possible for any process to be using a file in those directories so you can delete everything in these locations.

      If the machine is running for long periods of time then you should probably do the things listed above using scheduled jobs. You should use the logrotate utility to archive existing logs when they get to big and start a new log in place of the archived log. This is configured using the file /etc/logrotate.conf and with the files in /etc/logrotate.d. You can get rid of old unused user files in the /tmp directory with a cron job with a command something like the following:

      find /tmp -group users -atime +5 -exec rm {} \;

      This command will delete files owned by users in the /tmp directory tree if they have not been accessed in over 5 days. If your user accounts have a temp directory in each account login directory such as /home/username/tmp you can make a find command to clear out these directories based on some criteria. Since most Linux machines are probably being used as servers so you probably don’t have junk created by users that log in to the machine.

      I hope this helps get you started. Maybe other people will contribute other ideas.

      • #2719305

        Good, thanks.

        by mshultz ·

        In reply to A few ideas

        Thanks SJ, I did not even know about fsck. Thanks again for your suggestions.

    • #2700375

      Any ideas would be great

      by mshultz ·

      In reply to What is the best way to PM a linux box?

      Any other ideas/comments would be great.

      • #2714510

        Check the logs

        by kmiller ·

        In reply to Any ideas would be great

        If you’re logging anything (by default you’ll be logging several things) be sure you’re not putting the logs on the root filesystem. If you fill up the root, the machine will eventually stop responding and you’ll have to reboot it. Don’t ask how I know, but here’s a hint – it was on a SCO box! As suggested earlier, make sure you’re using logrotate on a reasonable schedule and you’ll be fine, just don’t log to the root. Look at the logs, if they’re getting too big to manage, either log less or rotate more often.

    • #2713677

      Linux doesn’t really need it PMing

      by jeff@customerselects.com ·

      In reply to What is the best way to PM a linux box?

      Think about it:
      1) How many viruses have been written for linux?
      2) How often do you have to patch things?
      3) When you do patch, how often do you have to reboot?
      4) How often do you have kernel panics, the linux equivalent to the Blue Screen of Death?

      Let’s face it: in terms of reliability, cost, efficient use of machine resources, and ease of use, Linux is better than Windows

      • #2713617

        PM added

        by emdreyes ·

        In reply to Linux doesn’t really need it PMing

        The only thing I do in a Linux box is to update kernel. I agree that Linux doesn’t need much PM, coz if you fine tune your box correctly it will become stable rather than MS with Blue Screen.

        • #2713548

          Well

          by mshultz ·

          In reply to PM added

          I realize linux is more stable and self-reliant than windows but that’s not what I’m asking. Linux is not an AI box, yet, so it’s not going to straight fix itself; it’s still going to need a little management and maintenance to stay running at the top.

    • #2713514

      A suggestion for everyone.

      by guapo ·

      In reply to What is the best way to PM a linux box?

      If you have a tip, please post it with the name
      and likely location of any file that needs
      modification. While it may be obvious to you
      where the startup files are and which one needs
      to be modified to increase the frequency of fsck
      on boot, (not picking on anyone, but that was
      the first example found) most newbies won’t even
      know where to look.

      BTW, one of the things I noticed very early on
      in my Linux experience is that almost no PM is
      needed. Just keep your system updated, and you
      can forget all that defragging and virus update
      nonsense.

      Thanks.

      Thanks.

    • #2713427

      Just watch disk space and memory

      by jdclyde ·

      In reply to What is the best way to PM a linux box?

      Command: df
      I will once a month make a point to use the “df” command to make sure I don’t have a file system getting too full. Just keep an eye on the available amount. /usr has 3Gig free. Fine for now.

      Command: free
      The other thing I watch for is if my system is getting taxed or not. Use the “free” command to see your memory useage. If you see during busy times of the day that you are hitting over 75% useage it is time to drop in more memory.
      I do this during off times and busy times to see the difference between what the server is using to run and the demand the users are putting on it.
      Shoot, I see out of 512M I only have 10M free. Need to go PM……..

      Command: uptime
      This shows how long the system has been up, and what average demand on it has been. Just checked and my server was up 160 days.

      In five years as linux admin I have had two crashes.
      One was a toasted hard drive.
      The other was a dumb co-worker created a symbolic link to it’s self.

      Good luck.

    • #2703879

      Some server hints

      by robert.hendrickx ·

      In reply to What is the best way to PM a linux box?

      There are some things you can do to follow the behaviour of your server (I’ve no experience in workstations).

      First of all, keep track of some important resources counters, like disk occupation, memory consumption, network traffic, cpu use and so on. If you do that, you can first see an abnormal use of one of the resources, (which can reveal a malicious user or an internet attack), and second, you can follow the evolution of your needs, and for instance, install a new disk before the time your last byte is used.
      For this, I use Cacti – http://www.raxnet.net/products/cacti/ – (something like an evolution of MRTG). It has a web interface, and give you graphics of these kind of things.

      Second, Keep your data safe. If you can afford that, put your system partitions in mirroring, and depending on how critical are your data, put them also in mirroring (or RAID5), and take regular backups.

      Third, mainly if your machine is an internet server, follow the last security patches for the exposed services. Even if there are less virus for *nix than for windoze, there are server expoits…

      Last but not least, monitor yours services. This is more reactive than preventive, but learn via an automatic e-mail that the web server answer no more or that the network connectivity has a problem, is better than to wait for the users complaints. Therefore, I use Nagios – http://www.nagios.org – which is, I think, really powerfull.

      • #2703818

        good ideas + gkrellm

        by eldergabriel ·

        In reply to Some server hints

        These are all good ideas.

        For graphically monitoring system stats, i suggest you check out gkrellm.
        It has a client and a server portion (gkrellmd) that supports remote monitoring via net. Also check to see if your linux distribution of choice includes this software (Fedora/Red Hat does).

    • #2703808

      cron, anacron, quotas, automation

      by eldergabriel ·

      In reply to What is the best way to PM a linux box?

      Often, it’s best to make the system handle as much of the maintenance automatically as much as possible, if for no other reason than to save yourself some time and headaches.

      A lot of gnu/linux distros will come pre-configured with a default set of maintenance tasks specific to that installation. These will typically be automated through the use of the cron and anacron system daemons, which may have been turned on by default at the time of installation. Cron is designed to handle jobs while the system is up and running, while anacron will handle running tasks that were scheduled but missed due to system downtime. Typical cron jobs may include checking filesystems, performing backups, log file rotation, etc. You can also create your own custom jobs to be automated by these system daemons. The possibilities are nearly endless. I refer you to the man pages (man crond at shell prompt) and the various online documentation.

      If dealing with file serving via Samba, you’ll want to learn about user file system consumption quotas. At some point, you’ll probably decide that learning how to enforce limits on users’ file storage is important.

      Also, if you’re a Fedora/Red Hat admin/user, i suggest you look into keeping up with the latest updates and packages via up2date and RHN (Red Hat Network). Ximian also offers their Red Carpet service (i believe they still offer this). There is also apt-rpm which can automagically handle package dependencies at the time of package installations. There’s a nice GUI front-end for this tool as well, called synaptic.

      Hope this helps.

    • #2703805

      linuxsecurity.org & mailing lists

      by eldergabriel ·

      In reply to What is the best way to PM a linux box?

      Although the relatively high security and general lack of viruses that GNU/Linux intrinsically provides is very nice, it’s still a good idea to check linuxsecurity.org frequently and subscribe to pertinent security mailing lists. A minimal mailing list subscription set would probably include general security announcements, linux-specific security announcements, and maybe a mailing list specific to your particular distribution that you are running. Keep your eyes and your ears open, and keep your GNU/Linux software maintenance/sysadmin skillset in shape and you should be fine.

Viewing 7 reply threads