Re: cat cron jobs crontab: SOLVED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 13/03/07, Karl R. Balsmeier <karl@xxxxxxxxxxxxxx> wrote:

I am the only user on the box, -this is all part of the %post element of
a Kickstart file.  No one's on there, heh.  But I see what you mean.  If
this were not the only cron job on the machine, i'd probably entertain
the single-file/single-job tactic.

This particular question was aimed at adding the final line in a
kickstart post-install script, e.g. modifying crontab in an automatic
way to complete a given server build.  Specifically the local changes a
system gets to make it ready for Nagios monitoring, prior, I needed to
manually visit all the machines i'd built and crontab -e.  But then a
phone rings, or a pager goes off, or a human appears, wanting something,
heh.  Automatic is the way.

I use include statements RCS and 'here' documents to accomplish this
sort of thing so I can have local customisations per-host but also a
log of the changes in revision control.

So I'd have something like a centos4-install-ks.cfg called via PXE and
in that...

# Setup users and their authorized_keys
%include /mnt/ks/kickstart/include/users-and-keys.cfg

# Setup secure SSHD configuration
%include /mnt/ks/kickstart/include/secure-sshd.cfg

# Setup Sudo
%include /mnt/ks/kickstart/include/sudo.cfg

# Setup Nagios Remote Plugin Execution
%include /mnt/ks/kickstart/include/nagios-nrpe.cfg

And in each of those, nagios-nrpe.cfg for example something like...

# Install and setup nagios configuration

yum -y install nagios-nrpe
mkdir -p /etc/nagios/RCS
mkdir -p /etc/xinetd.d/RCS
ci -t-'Nagios Remote Plugin Exection configuration.' -u /etc/nagios/nrpe.cfg
ci -t-'Nagios NRPE xinetd configuration.' -u /etc/xinetd.d/nrpe
co -l /etc/nagios/nrpe.cfg
co -l /etc/xinetd.d/nrpe

cat <<EOF > /etc/nagios/nrpe.cfg
#
# Nagios Remote Plugin Exection configuration.
#
# \$Id\$
#
# FILE UNDER RCS, DO NOT EDIT WITHOUT CHECKING OUT!!!

server_port=5666
# allowed_hosts=127.0.0.1
nrpe_user=nagios
nrpe_group=nagios
dont_blame_nrpe=0
debug=0
command_timeout=60
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_disk1]=/usr/lib/nagios/plugins/check_disk -w 20 -c 10 -p
/dev/mapper/vg00-lv00
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200

EOF

cat <<EOF > /etc/xinetd.d/nrpe
# default: off
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
       flags           = REUSE
       type            = UNLISTED
       port            = 5666
       socket_type     = stream
       wait            = no
       user            = nagios
       group           = nagios
       server          = /usr/sbin/nrpe
       server_args     = -c /etc/nagios/nrpe.cfg --inetd
       log_on_failure  += USERID
       disable         = no
       only_from       = 127.0.0.1 X.X.X.X X.X.X.X
}

EOF

ci -m'Kickstart: Setting up default NRPE configuration.' -u /etc/nagios/nrpe.cfg
ci -m'Kickstart: Setting up default NRPE Xinetd configuration.' -u
/etc/xinetd.d/nrpe

# vim:sb:ai:sw=4:expandtab


Will.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux