Archive - debian RSS Feed

fixing a broken rrd cacti graph

Recently i ran into a problem while graphing the total number of pages being printed every day on xerox 7765 workcentre printer, snmpwalk worked fine and gave the correct result, but cacti rrd did not display any data.

1
2
snmpwalk -v 1 -c 'communitystring' printer SNMPv2-SMI::mib-2.43.10.2.1.4.1.1
107212

I increased the maximum value on cacti but it did not take any effect so i had to edit the rra file directly using rrdtool and increase the maximum snmp oid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cd /var/www/cacti/rra
rrdtool info printer_snmp_oid_241.rrd
........
..............
ds[snmp_oid].index = 0
ds[snmp_oid].type = "GAUGE"
ds[snmp_oid].minimal_heartbeat = 600
ds[snmp_oid].min = 0.0000000000e+00
ds[snmp_oid].max = 1.0000000000e+03
ds[snmp_oid].last_ds = "107211"
ds[snmp_oid].value = 5.3605500000e+05
ds[snmp_oid].unknown_sec = 0
................
........

Continue Reading…

 

puppet sync users across all linux machines

Puppet is a very handy package if you have a range of linux machines to configure, here i will try to use puppet to sync users across all machines, there are many who used bash and puppet codings to achieve the same, i prefer to use python. So…..you can feeds the users from a file or from a list in python..

1
users = ["user1","user2","user3","user4","user5]

incase you want to feed from file use the file open function and iterate over the users

1
2
3
4
userfile = open("location of file", "r")
for i in userfile.readlines():
     print i
     (process i i.e. users...)

Continue Reading…

 

How does ls command work in linux?

You can use these two utilities in linux, strace to trace system calls and ftrace to trace the function,system calls which are called within the kernel.

to run a strace on ls,

1
strace -o output.log ls /etc

so,

1
execve("/bin/ls", ["ls"], [/* 21 vars */]) = 0

the system call execve() is evoked and it executes the command ls and based on the type of executable it will look for the program ld.so.* to load the shared libraries which are needed by the program.

http://www.kernel.org/doc/man-pages/online/pages/man2/execve.2.html

Continue Reading…

 

write zeros (format) on all sectors of an hard drive

you can write zeros on your drive by using the “shred” command, this will erase all data from the drive!!!

shred -vfz -n 0 /dev/xxx

-v is for verbose (this takes a huge amount of time and you really will want progress updates)
-z is for write zeros
-n 0 is for how many passes of totally random data to write first, here none. Feel free to do random passes if you are doing this for data destruction purposes. It takes a long time.

xxx should be the name of the raw drive and not the partition.

 

kindle for linux

the new version of kindle reader does not work on linux, so i found the beta version of kindle which works cool, here is the link..

http://d1xhj100piaj9u.cloudfront.net/25338/KindleForPC-installer.exe

http://www.krisindigitalage.com/KindleForPC-installer.exe

 

secure centralized log server

log archive script

#!/bin/sh

Today=`date +%Y%m%d`
fy=`date –date=’5 days ago’ +%Y`
fm=`date –date=’5 days ago’ +%m`
fd=`date –date=’5 days ago’ +%d`

echo “$Today”;
echo “$fd”;

server=`ls /var/log/HOSTS`;

for i in $server
do

mkdir -p /archive/$i/$fy/$fm/$fd
tar -zcvf /archive/$i/$fy/$fm/$fd/$fd.tar.gz /var/log/HOSTS/$i/$fy/$fm/$fd/

done

#!/bin/sh

Today=`date +%Y%m%d`
fy=`date –date=’5 days ago’ +%Y`
fm=`date –date=’5 days ago’ +%m`
fd=`date –date=’5 days ago’ +%d`

echo “$Today”;
echo “$fd”;

server=`ls /var/log/HOSTS`;

for i in $server
do

mkdir -p /archive/$i/$fy/$fm/$fd
tar -zcvf /archive/$i/$fy/$fm/$fd/$fd.tar.gz /var/log/HOSTS/$i/$fy/$fm/$fd/

done

 
Page 1 of 11
Theme Tweaker by Unreal