Empulse Group a collection of notes from a sys admin, musician, and father

30May/110

gnuplot

gnuplot is an easy to use bash tool to create graph images on any data you can throw at it.

 

gnuplot homepage

 

For my test, I am taking a 12 hour period of sar logs.

[root@www gnuplot_tests]# head tail.log
05/29/2011 01:10:01 PM  22195880   2475844     10.04    152596   1857972   2096472         0      0.00         0
05/29/2011 01:20:01 PM  22183664   2488060     10.08    153788   1867836   2096472         0      0.00         0
05/29/2011 01:30:01 PM  22183092   2488632     10.09    154196   1868708   2096472         0      0.00         0
05/29/2011 01:40:01 PM  22180212   2491512     10.10    155188   1869504   2096472         0      0.00         0

 

And the script to create a .png image. To run:  ./sar_plot.pg > graph.png

#!/usr/bin/gnuplot
reset
set terminal png

## set size w,h
set size 2,1

set xdata time
set timefmt "%d/%m/%Y %H:%M:%S"
set format x "%H:%M"
set xlabel "time"

set ylabel "% RAM used"

set title "Server RAM Usage"
set key reverse Left outside
set grid

set style data linespoints

#plot "tail.log" using 1:2, "tail.log" using 1:4
plot "tail.log" using 1:6



15May/110

using ‘diff’ to compare files or directories

Find differences between two files or directories.

 

 

# diff sample1 sample2

2,3c2,3

< sample text. I

< will not forget

---

> EXTREMELY sample text. I

> will not EVER WANT

4a5

> OR BE BAD

6d6

< Good bye,

 

 

# cat sample1

This is my

sample text. I

will not forget

to write another message,

for my friends.

Good bye,

and thanks for all the fish!

 

 

# cat sample2

This is my

EXTREMELY sample text. I

will not EVER WANT

to write another message,

OR BE BAD

for my friends.

and thanks for all the fish!

 

 

Explanation:

 

(line number of range) (c, a, or d) (line number of range)

 

'c' - stands for a change in the line

'a' - stands for append after the line

'd' - stands for delete the line

 

 

:: For side by side comparison:

 

# diff -y file1 file2

 

'|' - stands for a change between the lines

'>' - stands for an addition of text from file2 that was not in file1

'<' - stands for a deletion of text from file1 since not found in file2

 

 

:: To create a patch file from the diff:

 

# diff file1 file2 > patch

 

 

:: To patch the original file:

 

# patch file1 -i patch -o updatedfile

 

# if diff sample1 sample1; then echo "files are the same"; else echo "files are DIFFERENT"; fi

files are the same

 

 

:: To compare directories:

 

# ls tmp1

sample1 sample2

 

# ls tmp2

file1 file2 sample1

 

# diff tmp1 tmp2

Only in tmp2: file1

Only in tmp2: file2

Only in tmp1: sample2

8Jan/110

50 UNIX / Linux Sysadmin Tutorials

50 UNIX / Linux Sysadmin Tutorials.

21Apr/090

Nice Cacti Install How To

RedHat / CentOS Install and Configure Cacti Network Graphing Tool

16Apr/090

Reset file permissions of RPM packages

UPDATE: YOU NEED TO RUN THE FOLLOWING COMMANDS IN REVERS ORDER!

So, --setperms then --setugids. This is because setperms will overwrite sticky bits if run after setugids.

A disastrous mistake anyone can make on their Linux server is to chown or chmod their entire filesystem.

You can reset the permissions of packages installed with rpm.

To reset file permissions:

[root@www ~]# rpm --setperms {packagename}

To reset ownership permissions:

[root@www ~]# rpm --setugids {packagename}
5Apr/090

Security Articles

Hacking-Gurus: Network and Server Security Blog really has some useful information documented.  Check out these articles.

Basic Linux Server Security

Linux Security Tools


SQL CheatSheet

5Apr/090

SQL Injection article

This is an article I found on Twitter from Hacking-Gurus on SQL injection. Check it out.

MySQL: Secure Web Apps - SQL Injection techniques

8Apr/080

Empulse Hosting and other online works

So I've been a little busy setting up a few new projects that I have going on right now.  The first site to come online is Southwest PC Direct, Joe's and my new online computer component store.  You will a lot of other useful information there also compiled by Joe and me.

The next project is Empulse Hosting [dot] com. We will be offering web and other online services to the masses.  I will also be having information on setting up your first site.

I will also be starting a number of online resources at Circulo Marketing Squidoo on Linux and Open Source topics.  I will keep you updated on other further developments.