Archivio

Posts Tagged ‘Sysadmin’

Giochiamo con Label e UUID

7 agosto 2009 Giorgio Nessun commento

Mettiamo il caso che si stia lavorando su un server, un lavoro delicato, eh, e che la fuckup fairy decida proprio in quel momento di venire a trovarvi…

Mettiamo il caso che per una botta incredibile di fortuna, vi interrompano mentre state eseguendo un echo su /etc/fstab e invece di un bel >> vi ritroviate con >.

Ok, in questo caso fate ciao ciao con la manina a /etc/fstab e pensate intensamente al fatto che, genialmente, chi si occupa dei backup se n’è andato in vacanza una settimana prima di voi.

Ora, proprio per non rendere le cose facili, tenete conto che il vostro /etc/fstab monti i filesystem indicandoli con una volume label che, ovviamente, ora non ricordate, del tipo :

LABEL=SW-cciss/c0d0p2   swap                    swap    defaults        0 0

Questo è un caso classico, una swap referenziata da label, e cancellata la riga chi si ricorda più dove, come, quando, perché? Volendo ripristinare un mount via label, una via semplice per recuperare l’etichetta mancante consiste nell’utilizzare bklid:

#: blkid /dev/cciss/c0d0p2
/dev/cciss/c0d0p2: TYPE="swap" LABEL="SW-cciss/c0d0p2" UUID="1b2e35d0-8321-4d5b-bed0-647b862cbc88"

Fatto. La label è

SW-cciss/c0d0p2

Incidentalmente, ma nemmeno troppo, blkid vi mostra anche la UUID del filesystem. Infatti, potreste volere montare il filesystem usando il suo UUID e quindi la precedente istruzione in /etc/fstab potrebbe essere riscritta come:

UUID=1b2e35d0-8321-4d5b-bed0-647b862cbc88 swap swap defaults 0 0

Ciò vale per qualsiasi filesystem. Per esempio, questa regola di mount per il filesystem contenente i database di MySQL, da così

/dev/VolGroup00/LogVol03 /var/lib/mysql ext3 defaults 1 2

passando per

#: blkid /dev/VolGroup00/LogVol03
/dev/VolGroup00/LogVol03: UUID="fb5050a9-6641-4ec8-a1dc-5365b326d9bd" TYPE="ext3"

Può essere riscritta come:

UUID=fb5050a9-6641-4ec8-a1dc-5365b326d9bd /var/lib/mysql ext3 defaults 1 2

Avete notato nulla? Il filesystem è sprovvisto di una volume label. Rimediamo applicando una etichetta che ci consenta di capire al volo la funzione del filesystem montato:

tune2fs -L "MySQL DB" /dev/VolGroup00/LogVol03

Controlliamo che il filesystem abbia preso l’etichetta in maniera corretta:


#: blkid /dev/VolGroup00/LogVol03
/dev/VolGroup00/LogVol03: UUID="fb5050a9-6641-4ec8-a1dc-5365b326d9bd" TYPE="ext3" LABEL="MySQL DB"

Ora non rimane che modificare /etc/fstab per rimontare il filesystem usando la nuova label:

LABEL=MySQL\040DB /var/lib/mysql ext3 defaults 1 2

Notato qualcosa? Forse quello

\040

messo fra MySQL e DB? Esatto. Serve per eseguire l’escape dello spazio fra le due parole che compongono la label. Se date un’occhiata al man 5 di fstab noterete che gli spazi vanno sottoposti a escape se si trovano all’interno di una etichetta o nel percorso del mount point. Quindi, corollario molto semplice, potete anche creare dei mount point il cui percorso sia composto da più termni separati da uno spazio.

Proviamoci:

mkdir "/Spazio per i file database di MySQL"

Quindi modifichiamo in questo modo /etc/fstab:

LABEL=MySQL\040DB /Spazio\040per\040i\040file\040database\040di\040MySQL ext3 defaults 1 2

Ora non rimane che smontare e rimontare il filesystem:

umount /var/lib/mysql/ ; mount -a

e infine, verifichiamo la buona riuscita dell’operazione:

#: mount | grep Spazio
/dev/mapper/VolGroup00-LogVol03 on /Spazio per i file database di MySQL type ext3 (rw)

e poi:

ls /Spazio\ per\ i\ file\ database\ di\ MySQL/
controllo ib_logfile0 ib_logfile1 ibdata1 lost+found mysql nagios_data

Bene, direi che tutto è a posto. Non vi rimane che fare qualche esperimento, giusto?

P.S.

Nel caso aveste giocato con la directory dei db di MySQL (ma siete pazzi come me?), rimettete tutto a posto, oppure modificate il puntamento in my.cnf.

July 31, 2009 (Last Friday Of July) 10th Annual System Administrator Appreciation Day

31 luglio 2009 Giorgio Nessun commento

A sysadmin unpacked the server for this website from its box, installed an operating system, patched it for security, made sure the power and air conditioning was working in the server room, monitored it for stability, set up the software, and kept backups in case anything went wrong. All to serve this webpage.

A sysadmin installed the routers, laid the cables, configured the networks, set up the firewalls, and watched and guided the traffic for each hop of the network that runs over copper, fiber optic glass, and even the air itself to bring the Internet to your computer. All to make sure the webpage found its way from the server to your computer.

Ted In Wires
Fig. 1 Ted.

A sysadmin makes sure your network connection is safe, secure, open, and working. A sysadmin makes sure your computer is working in a healthy way on a healthy network. A sysadmin takes backups to guard against disaster both human and otherwise, holds the gates against security threats and crackers, and keeps the printers going no matter how many copies of the tax code someone from Accounting prints out.

A sysadmin worries about spam, viruses, spyware, but also power outages, fires and floods.

When the email server goes down at 2 AM on a Sunday, your sysadmin is paged, wakes up, and goes to work.

A sysadmin is a professional, who plans, worries, hacks, fixes, pushes, advocates, protects and creates good computer networks, to get you your data, to help you do work — to bring the potential of computing ever closer to reality.

So if you can read this, thank your sysadmin — and know he or she is only one of dozens or possibly hundreds whose work brings you the email from your aunt on the West Coast, the instant message from your son at college, the free phone call from the friend in Australia, and this webpage.

Show your appreciation

Friday, July 31, 2009, is the 10th annual System Administrator Appreciation Day. On this special international day, give your System Administrator something that shows that you truly appreciate their hard work and dedication. (All day Friday, 24 hours, your local timezone).

Let’s face it, System Administrators get no respect 364 days a year. This is the day that all fellow System Administrators across the globe, will be showered with expensive sports cars and large piles of cash in appreciation of their diligent work. But seriously, we are asking for a nice token gift and some public acknowledgement. It’s the least you could do.

Consider all the daunting tasks and long hours (weekends too.) Let’s be honest, sometimes we don’t know our System Administrators as well as they know us. Remember this is one day to recognize your System Administrator for their workplace contributions and to promote professional excellence. Thank them for all the things they do for you and your business.

Help Spread the word

These icons link to social bookmarking sites where readers can share and discover new web pages. Please click on your favorites and help spread the news about System Administrator Appreciation Day.

[Via Sysadminday]

Categorie:Sysadmin Tag: , ,

Corso su Nagios – Brainstorming Phase

4 giugno 2009 Giorgio 21 commenti

Dato che il mio amichino Theo mi suggeriva che forse a qualcuno potrebbe interessare un tutorial su come installare e configurare Nagios, stavo pensando di iniziare un corso su Nagios articolato, per ora, nei seguenti step:

1. Avvicinamento. Cosa è Nagios, a cosa mi può servire, cosa fa;

2. Hands on. Prendiamo i sorgenti di Nagios, compiliamoli e installiamolo su un server. Partirò da una virtual machine Ubuntu Desktop pulita, indicandovi quali pacchetti o programmi o librerie accessorie installare e come farlo. Parto da una Destkop, tanto per non farvi ammattire;

3. Test the difference. Seconda macchina virtuale. Questa sarà il client Ubuntu che terremo sotto controllo, su questa installeremo gli agenti e impareremo a configurarne il supporto SNMP;

4. Win on Win. Impareremo a installare, configurare e interrogare il clent Nsclient++, in modo da tenere sotto controllo anche le macchine Windows. Davvero pensavate che avrei ignorate Windows?

4. So confusing, so amazing. Giusto un po’ di teoria. I file principali di Nagios, la loro sintassi, il significato delle varie istruzioni. Questo punto richiederà probabilmente una serie di puntate a parte;

5. Creiamo il nostro primo plugin. Si, si, giusto un paio di api, un po’ di bash, e si fa tutto. Imparerete a estendere Nagios oltre ogni vostra immaginazione. Ok, frase ad effetto ma rende l’idea.

6. Agentless! SNMP mon amour. Ok, vedremo come configurare Net-Snmp, come interrogarlo in maniera sicura, come gestire delle trap, insomma, come fare parecchie cose interessanti senza bisogno di installare un agente sulla macchina da tenere sotto controllo;

7.  GraphITe! Plottare Nagios. I dati di per sé sono nulla se non li aggreghi in qualche modo. Vedremo come generare dei grafici partendo dai dati recuperati da Nagios. Cosa useremo? Mah, io ho sempre utilizzato NagiosGrapher, ma anche Pnp4Nagios potrebbe andare bene;

8. Templare! Ok, non è una religione. Se i template base di NagiosGrapher non vi bastano, vedremo come crearne qualcuno a nostro piacimento, con tanto di legende, linee mediane e quant’altro.

9. Infighettiamoci. Beh, Nagvis fa sempre scena, vedremo come mettere Nagios sul palco e ben sotto i riflettori.

10. One step beyond! Ovvero della distribuzione. Qualcosa di più complicato? Per esempio Nagios in versione distribuita in modo da controllare ambienti molto complessi? Oppure Nagios in alta affidabilità?

Ok, mi sono giocato il prossimo anno di post.

Perché ho intitolato questo post “Brainstorming”? Perché se vi interessa, potete indicare nei commenti quali argomenti vorreste vedere trattati e quindi fornirmi qualche spunto nell’elaborazione dei prossimi post di questo corso.

Bon voyage…

Ah, giusto per dare un’idea…

Misurazione di Banda tramite SNMP e grafico su NagiosGrapher

Rpm query arch

15 ottobre 2008 Giorgio Nessun commento

rpm -q pakage_name --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})\n"

Giusto perché non ricordo mai come far visualizzare a rpm una lista coerente di pacchetti con relative architetture.

Per esempio:

rpm -q glibc-devel-2.3.4-2.41 --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})\n"

glibc-devel-2.3.4.2.41 (x86_64)
glibc-devel-2.3.4.2.41 (i386)

Se, invece, si desidera la lista di tutti i pacchetti installati, con relative architetture:

rpm -qa --queryformat "%{NAME}-%{VERSION}.%{RELEASE}-(%{ARCH})\n"

Bookmarks for Luglio 29th from 08:48 to 16:32

29 luglio 2008 Giorgio Nessun commento

These are my links for Luglio 29th from 08:48 to 16:32: