Adding bulks of SNMP hosts to cacti, updated

I did some changes to the makefile I published last month. It would be too much to completely rewrite the blog post to adapt for the changes, so I am just publishing the update here, and you can do the diff yourself.

There is still a lot of factorization left to do, I am leaving it to when I'll have more time. If, in the meanwhile, you come up with a better version, please leave a comment here.

I still have problems with LVS metrics, in particular: "LVS traffic in" is not getting any data. If you can spot the mistake and tell me, that would be much appreciated.

Have fun! … Continue reading

Using a makefile to automate a puppet installation

The first make will back up some files. It is important to run it only once.

The second run, "make" alone, will go through the needed steps for installation: if rsync is not installed, it will install rsync; if the needed files are not present in the /puppet hierarchy, it will download the files using rsync; if puppet is not installed, it will install it; then, it will run puppetd with a bootstrap configuration file and… fail!

Yes, fail. Because you need to sign the host certificate, don't you? Once you signed it on the master node, then you'll run make config. If everything is properly configured, this will set up your host according to the manifests.

The last command, make test will just run a puppetd --test to ensure that everything is properly set up.

And that's all. Installing one host this way takes about 5 minutes, downloads included. And using cssh I could even install puppet on several machines in parallel.

Am I missing something? Oh, yes, the real Makefile 🙂

all: install config

install: /usr/bin/puppetd

        puppetd --config /puppet/common/files/bootstrap/client.conf --server $(PUPPETMASTER) --test

        puppetd --test

        -rm -rf /puppet
        -apt-get remove puppet facter
        -apt-get autoremove

        cp /etc/apt/sources.list{,.dist}

        apt-get install rsync

/puppet/usa/files/sources.list: sync-puppet-conf

/puppet/volatile/keys/apt: sync-puppet-conf

update: /puppet/usa/files/sources.list /puppet/volatile/keys/apt
        cp /puppet/usa/files/sources.list /etc/apt/sources.list
        apt-key add /puppet/volatile/keys/apt 
        apt-get update
        apt-key update

sync-puppet-conf: /usr/bin/rsync
        rsync -zav $(SYNCSERVER)::PuppetConf /puppet

/usr/bin/puppetd: update
        apt-get install puppet