How to fix wlanO not found

The problem statement is while doing an *ip a* on the terminal and its output doesn’t show the wireless device, like below:

wlan0_not_showing_2017-01-27-22-17-20

The dmesg says like this below:

iwlwifi_firmware_not_found_2017-01-28-04-20-26

Let me cross check that file is present in the system or not,  just like below:

firmware_file_present_2017-01-28-04-23-41

So, it is very much seated there, where it suppose to be  Well, that trigger me trip to visit some kernel config variables, like below:

kernel_var_2017-01-28-04-31-25

It looks fine, then?? well, that warrant few more checks, well I made some trip to *gentoo forum* to know what is missing. And someone in the closed thread mentioned that The variable in question is CONFIG_IWLWIFI which is recommended =m and that necessarily meant I have to recompile the kernel one more time with that variable set to the module in the kernel.

Next, I went ahead and compile the kernel with that mentioned variable as the module. Okay, I have rebooted my machine and here is the outcome,

wlan0_showing_2017-01-28-05-14-35

Cool, but why we have to turn it to a module within the kernel than just straight built into the kernel not showing the device ?? The reason, by the time kernel boot and the firmware file, reside on the filesystem not yet read so it was missing.

Hope this will help.

 

 

 

 

Advertisements

Nagios saga

>In this post I will tell how I was frustrated by the fact of my own ignorance.I was configuaring nagios host for service check and stumbled with an error spitting out the message like below:


Name or service not known HTTP CRITICAL
- Unable to open TCP socket

I have had looked into nagios FAQ and google all over the place,but to my surprise I haven’t had found any solution to this problem and of course the cause of it.Really surprised!!! Now as the great man said once “Given enough eyeball software bug can be detected”, it was none other ,but Eric.S. Raymods. Anyway I was taking it easily by knowing that I was doing it correct,Yes I was regarding that configuration. But may be little bit ignorance with conf syntax.Because When I tried to look for a string in specific site I forgot to enquote it ….oooops what a shame. Any how once I checked the command line version of that perticular check and it shows the correct result. Now the command line from nagios one of conf file called command.cfg, which hold a line for checking like below:

Correct:


check_http -H yourwebsite -p portnumber -u the uri -s "the string" -t time

Wrong:

instead I was doing like below:


check_http -H yourwebsite -p portnumber -u the uri -s the string -t time

If it is a single word , then you can use that word without quote;but having space in between it will not work and throw the above error. It was a basic mistake,a string should always be quoted if that string consists with words separetad by space.

Hope this will help.

Cheers!
Bhaskar

Get alert about LAMP stack

In this article I am going to show you a very very rudimentary script to get over it.I have written it just to show you how it can be done,but having said that this script can be written with more information and much more complex way.Yes ,there is a  lot scope of improvement of this script and I would like to get your feedback on that.

So without much delay here is the mundane script to monitor the LAMP stack and provide alert


1 #!/bin/bash
2 # This program is written for my own help.Needs lot of tweaking.
3 #This script is written on Fedora and RHEL keep in mind,so other distribution
4 #should cross check the binary space of the specified program to their distribution.
5 #Author : Bhaskar Chowdhury
6 #Date : 03-12-2010
7
8
9 date=`date`
10
11 echo "Today is :" $date
12 echo
13 echo
14 host_name=`hostname`
15 echo "This is for the $host_name"
16 echo
17 echo
18 #System binary location information
19 kernel=`uname -r`
20
21 apache=`/usr/sbin/httpd -v`
22
23 mysql=`/usr/bin/mysql --version`
24
25 php=`/usr/bin/php -v`
26
27 webroot='/var/www/html'
28
29 mail='whoeverincahrgeofit@gmail.com' #The person in-charge of lamp stack
30
31 echo "******************************* GNU/Linux ******************************"
32
33 echo " We are running Linux Kernel: " $kernel
34 echo
35 echo
36
37
38
39
40 echo
41 echo
42 echo "Check out kernel stuff...."
43 echo
44
45
46 /sbin/sysctl -p
47 echo
48 echo
49
50
51 echo
52 echo "********************* OS End *************************"
53 echo
54 echo
55
56 sleep 5
57
58
59 echo "************ Apache ******************"
60 echo
61
62 echo " We are running Apache : " $apache
63 echo
64 echo
65
66
67 echo " How Apache has been compiled with other stuff : "
68 echo
69 echo
70
71 /usr/sbin/httpd -V
72
73 echo
74 echo
75
76 echo "Check out the modules loaded with it.."
77
78 /usr/sbin/httpd -M
79
80 echo
81 echo
82 echo
83
84 echo " Check out Apache process ..."
85 echo
86
87 ps -ef | grep httpd
88
89 echo
90 echo
91
92 sleep 5
93
94 echo
95 echo "***************************** Apache End *************************"
96 echo
97 echo
98
99
100 echo " **************** PHP **********************"
101 echo
102
103
104 echo "We are running Php : " $php
105 echo
106 echo
107
108
109 echo " Let's check out php related thing ..checking ini files....."
110 echo
111 echo
112
113 php --ini
114
115 echo
116 echo
117 echo " Get details of php things into the system..like modules and other stuff..."
118 echo
119 echo
120
121 php -im
122
123 echo
124 echo
125 echo
126 echo "****************************** PHP End **********************************"
127 echo
128 echo
129
130 sleep 5
131
132
133 echo "************************** MySql ***********************"
134
135
136 echo "We are running MySql : " $mysql
137 echo
138 echo
139 echo
140
141
142 echo " Check out the process for it....."
143 echo
144 echo
145
146 ps -ef | grep mysql
147
148 echo
149 echo
150
151
152 echo "****************************** MySql End **************************"
153 echo
154 echo
155
156 sleep 5
157
158 echo " Let's check the web tree permission.."
159
160 echo
161
162 ls -d $webroot
163
164 echo
165 echo
166
167 echo " Check out the SELinux thing applied on the webtree ..."
168 echo
169 echo
170
171 ls -Z $webroot
172 echo
173 echo
174
175 #if [[ `pidof httpd` -ne 0 ]]
176 # then
177 # echo "Httpd seems working fine!"
178 #else
179 # echo " problem with httpd daemon"
180 #fi
181
182 #if [[ `pidof mysql` -ne 0 ]]
183 #then
184 # echo " Yup,mysql working"
185 #else
186 #echo " Seems to check the mysql thing"
187 #fi
188
189
190 #if [[`pidof php` -ne 0 ]]
191 #then
192 # echo "Looks good"
193 #else
194 # echo " Problem with php"
195 #fi
196
197 echo " If the stack goes down ..let me know.."
198 echo
199 echo
200
201 if [[`/sbin/pidof httpd mysqld php` -eq 0 ]]
202 then
203 mail -s "problem with lamp stack" $mail
204 echo "Mail sent with information"
205 fi

Now you can trash out lot of echo statement out of that script,but I’ve kept it for readability .The basic motto behind that script to check out the binary position of those LAMP(GNU/Linux,Apache,MySql,Php/Perl/Python) software and call them to verify it.Then I move onto checking how the web server( In this case Apache) was complied with what sort of flags.

Next checking out ini file related to php thing and then mysql server started or not.Then I checked the web root tree permission and SELinux thing with it.Finally if something not working (by checking the pid of it,kindly point out the better way to check)and if that is equal to zero then surely something not came up in the stack and need attention.

This script is just an outline and as I said need your feedback(with reason) to improve it.

Hope this will help.

Cheers!
Bhaskar

NetSurf – A graphical-browser for emergency browsing

>In this post I will investigate a commandline graphical browser(run without X) which I was unaware of till two days back.I am pretty much well versed with lynx and elinks. . The new found(mentioned the source in the resource section at the bottom of the post) one called netsurf .I have tried to install it from the source available on Fedora 12 ,but failed to do so due to lack of patience.

Now I am sitting on Debian Lenny as it in the repository so it;s really make easy to install and use it.So I get it like below:


bhaskar@bhaskar-laptop_06:00:11_Fri Nov 19:~> sudo aptitude install netsurf
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
The following NEW packages will be installed:
netsurf
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 411kB of archives. After unpacking 1217kB will be used.
Writing extended state information... Done
Get:1 http://http.us.debian.org stable/main netsurf 1.2-1 [411kB]
Fetched 411kB in 1min52s (3641B/s)
Selecting previously deselected package netsurf.
(Reading database ... 112830 files and directories currently installed.)
Unpacking netsurf (from .../netsurf_1.2-1_i386.deb) ...
Processing triggers for menu ...
Processing triggers for man-db ...
Setting up netsurf (1.2-1) ...
Processing triggers for menu ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
Reading task descriptions... Done

Once it is installed it just a cakewalk.I invoked it like below:

bhaskar@bhaskar-laptop_06:07:41_Fri Nov 19:~> /usr/bin/netsurf http://linux-nfs.org

(netsurf:5351): libglade-WARNING **: could not find signal handler 'on_menupopup_navigate_activate'.

(netsurf:5351): Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem

(netsurf:5351): Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem

(netsurf:5351): Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem

(netsurf:5351): Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem

(netsurf:5351): Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem

(netsurf:5351): Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem

(netsurf:5351): Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem

(netsurf:5351): Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem

(netsurf:5351): Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem

(netsurf:5351): Gtk-WARNING **: gtk_menu_attach_to_widget(): menu already attached to GtkMenuItem

Now the gtk-thing pop up like below;

Now few noticeable thing about it that it doesn’t support tab feature.And lot of normal plug-in might be missing.But in case of headless server it will be as useful as other cli-browser.Second it heavily depend on GTK, so you have to have it installed in the system to get it work.

Plus you need to check out the dependency when building from source from their web site to get it straight.

Resources:

1) http://soosck.wordpress.com/2010/11/16/netsurf-graphical-web-browser-command-line-css/

Hope this will help.

Cheers!
Bhaskar

Server monitoring by Monit and Munin

In this article I am going to show your how you can keep an eye on your server/desktop/laptop visually through web browser. For that I am going to use two tools to do the job for you; those are monit and munin .

I am on Debian Lenny to implement those two tools.So the first thing first get those software in the system.Here we go:

Monit:

Before try to install it I tried to query the existing package database to whether it installed or not(or I might have installed some time back!!)

bhaskar@bhaskar-laptop_18:12:03_Tue Nov 16:/etc/monit> sudo dpkg -s monit
Package: monit
Status: install ok installed
Priority: optional
Section: admin
Installed-Size: 696
Maintainer: Stefan Alfredsson
Architecture: i386
Version: 1:4.10.1-4
Depends: libc6 (>= 2.7-1), libssl0.9.8 (>= 0.9.8f-5)
Conffiles:
/etc/default/monit cf582dd57fac58748aba3d7cf174f011
/etc/monit/monitrc d0127e44088e2c13e6eaef8f3cb95c9f
/etc/init.d/monit 3c19420528fdb85fd2669f6f7257a552
Description: A utility for monitoring and managing daemons or similar programs
monit is a utility for monitoring and managing daemons or similar
programs running on a Unix system. It will start specified programs
if they are not running and restart programs not responding.
.
monit supports:
* Daemon mode - poll programs at a specified interval
* Monitoring modes - active, passive or manual
* Start, stop and restart of programs
* Group and manage groups of programs
* Process dependency definition
* Logging to syslog or own logfile
* Configuration - comprehensive controlfile
* Runtime and TCP/IP port checking (tcp and udp)
* SSL support for port checking
* Unix domain socket checking
* Process status and process timeout
* Process cpu usage
* Process memory usage
* Process zombie check
* Check the systems load average
* Check a file or directory timestamp
* Alert, stop or restart a process based on its characteristics
* MD5 checksum for programs started and stopped by monit
* Alert notification for program timeout, restart, checksum, stop
resource and timestamp error
* Flexible and customizable email alert messages
* Protocol verification. HTTP, FTP, SMTP, POP, IMAP, NNTP, SSH, DWP,
LDAPv2 and LDAPv3
* An http interface with optional SSL support to make monit
accessible from a webbrowser

It seems it’s there.Ok,now it has deflated lot of file in the system and as I am not going to mention those in details,but should show you where it kept :

bhaskar@bhaskar-laptop_18:17:15_Tue Nov 16:~> whereis monit
monit: /usr/sbin/monit /etc/monit /usr/share/man/man1/monit.1.gz

We should be concerned about the configuration file it.Because we need to define everything in this file to get noticed by it.I changed into /etc/monit dir ,where I found the config file named monitrc.Let’s have a view of it:


bhaskar@bhaskar-laptop_18:20:12_Tue Nov 16:~> cd /etc/monit
bhaskar@bhaskar-laptop_18:20:18_Tue Nov 16:/etc/monit> ls

monitrc
bhaskar@bhaskar-laptop_18:20:20_Tue Nov 16:/etc/monit> sudo vim monitrc
###############################################################################
2 ## Monit control file
3 ###############################################################################
4 ##
5 ## Comments begin with a '#' and extend through the end of the line. Keywords
6 ## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
7 ##
8 ## Below you will find examples of some frequently used statements. For
9 ## information about the control file, a complete list of statements and
10 ## options please have a look in the monit manual.
11 ##
12 ##
13 ###############################################################################
14 ## Global section
15 ###############################################################################
16 ##
17 ## Start monit in the background (run as a daemon) and check services at
18 ## 2-minute intervals.
19 #
20 set daemon 60
21 #
22 #
23 ## Set syslog logging with the 'daemon' facility. If the FACILITY option is
24 ## omitted, monit will use 'user' facility by default. If you want to log to
25 ## a stand alone log file instead, specify the path to a log file
26 #
27 set logfile syslog facility log_daemon
28 #
29 #
30 ## Set the list of mail servers for alert delivery. Multiple servers may be
31 ## specified using comma separator. By default monit uses port 25 - this
32 ## is possible to override with the PORT option.
33 #
34 set mailserver bhaskar-laptop # primary mailserver
35 # backup.bar.baz port 10025, # backup mailserver on port 10025
36 # localhost # fallback relay
37 #
38 #
39 ## By default monit will drop alert events if no mail servers are available.
40 ## If you want to keep the alerts for a later delivery retry, you can use the
41 ## EVENTQUEUE statement. The base directory where undelivered alerts will be
42 ## stored is specified by the BASEDIR option. You can limit the maximal queue
43 ## size using the SLOTS option (if omitted, the queue is limited by space
44 ## available in the back end filesystem).
45 #
46 # set eventqueue
47 # basedir /var/monit # set the base directory where events will be stored
48 # slots 100 # optionaly limit the queue size
49 #
50 #
51 ## Monit by default uses the following alert mail format:
52 ##
53 ## --8<--
54 ## From: monit@$HOST # sender
55 ## Subject: monit alert -- $EVENT $SERVICE # subject
56 ##
57 ## $EVENT Service $SERVICE #
58 ## #
59 ## Date: $DATE #
60 ## Action: $ACTION #
61 ## Host: $HOST # body
62 ## Description: $DESCRIPTION #
63 ## #
64 ## Your faithful employee, #
65 ## monit #
66 ## --8<-- 67 ## 68 ## You can override this message format or parts of it, such as subject 69 ## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc. 70 ## are expanded at runtime. For example, to override the sender: 71 # 72 set mail-format { from: monit@bhaskar-laptop.localdomain } 73 # 74 # 75 ## You can set alert recipients here whom will receive alerts if/when a 76 ## service defined in this file has errors. Alerts may be restricted on 77 ## events by using a filter as in the second example below. 78 # 79 set alert root@bhaskar-laptop.localdomain # receive all alerts 80 # set alert manager@foo.bar only on { timeout } # receive just service- 81 # # timeout alert 82 # 83 # 84 ## Monit has an embedded web server which can be used to view status of 85 ## services monitored, the current configuration, actual services parameters 86 ## and manage services from a web interface. 87 # 88 set httpd port 2812 and 89 use address bhaskar-laptop # only accept connection from localhost 90 allow bhaskar-laptop # allow localhost to connect to the server and 91 allow admin:admin # require user 'admin' with password 'admin' 92 # 93 # 94 ############################################################################### 95 ## Services 96 ############################################################################### 97 ## 98 ## Check general system resources such as load average, cpu and memory 99 ## usage. Each test specifies a resource, conditions and the action to be 100 ## performed should a test fail. 101 # 102 check system bhaskar-laptop.localdomain 103 if loadavg (1min) > 4 then alert
104 if loadavg (5min) > 2 then alert
105 if memory usage > 75% then alert
106 if cpu usage (user) > 70% then alert
107 if cpu usage (system) > 30% then alert
108 if cpu usage (wait) > 20% then alert
109 #
110 #
111 ## Check a file for existence, checksum, permissions, uid and gid. In addition
112 ## to alert recipients in the global section, customized alert will be sent to
113 ## additional recipients by specifying a local alert handler. The service may
114 ## be grouped using the GROUP option.
115 #
116 check file apache_bin with path /usr/sbin/apache2
117 # if failed checksum and
118 # expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor
119 if failed permission 755 then unmonitor
120 if failed uid root then unmonitor
121 if failed gid root then unmonitor
122 alert security@bhaskar-laptop.localdomain on {
123 permission, uid, gid, unmonitor
124 } with the mail-format { subject: Alarm! }
125 # group server
126 #
127 #
128 ## Check that a process is running, in this case Apache, and that it respond
129 ## to HTTP and HTTPS requests. Check its resource usage such as cpu and memory,
130 ## and number of children. If the process is not running, monit will restart
131 ## it by default. In case the service was restarted very often and the
132 ## problem remains, it is possible to disable monitoring using the TIMEOUT
133 ## statement. This service depends on another service (apache_bin) which
134 ## is defined above.
135 #
136 check process apache2 with pidfile /var/run/Apache2/apache2.pid
137 start program = "/etc/init.d/apache2 start"
138 stop program = "/etc/init.d/apache2 stop"
139 if cpu > 60% for 2 cycles then alert
140 if cpu > 80% for 5 cycles then restart
141 if totalmem > 200.0 MB for 5 cycles then restart
142 if children > 250 then restart
143 if loadavg(5min) greater than 10 for 8 cycles then stop
144 if failed host bhaskar-laptop.localdomain port 80 protocol http
145 and request "/monit/doc/next.php"
146 then restart
147 # if failed port 443 type tcpssl protocol http
148 # with timeout 15 seconds
149 # then restart
150 if 3 restarts within 5 cycles then timeout
151 depends on apache_bin
152 group server
153 #
154 #
155 ## Check device permissions, uid, gid, space and inode usage. Other services,
156 ## such as databases, may depend on this resource and an automatically graceful
157 ## stop may be cascaded to them before the filesystem will become full and data
158 ## lost.
159 #
160 # check device datafs with path /dev/sdb1
161 # start program = "/bin/mount /data"
162 # stop program = "/bin/umount /data"
163 # if failed permission 660 then unmonitor
164 # if failed uid root then unmonitor
165 # if failed gid disk then unmonitor
166 # if space usage > 80% for 5 times within 15 cycles then alert
167 # if space usage > 99% then stop
168 # if inode usage > 30000 then alert
169 # if inode usage > 99% then stop
170 # group server
171 #
172 #LVM
173
174 check device Bhaskar-laptop-data with path /lvm
175 if space usage > 80% then alert
176
177 #Tmp
178 check device tmp with path /tmp
179 if space usage > 90% then alert
180
181 ## Check a file's timestamp. In this example, we test if a file is older
182 ## than 15 minutes and assume something is wrong if its not updated. Also,
183 ## if the file size exceed a given limit, execute a script
184 #
185 # check file database with path /data/mydatabase.db
186 # if failed permission 700 then alert
187 # if failed uid data then alert
188 # if failed gid data then alert
189 # if timestamp > 15 minutes then alert
190 # if size > 100 MB then exec "/my/cleanup/script"
191 #
192 #
193 ## Check directory permission, uid and gid. An event is triggered if the
194 ## directory does not belong to the user with uid 0 and gid 0. In addition,
195 ## the permissions have to match the octal description of 755 (see chmod(1)).
196 #Bin
197 check directory bin with path /bin
198 if failed permission 755 then unmonitor
199 if failed uid 0 then unmonitor
200 if failed gid 0 then unmonitor
201 #
202 #LVM
203 check directory lvm with path /lvm
204 if failed uid 0 then unmonitor
205 if failed gid 0 then unmonitor
206
207 #Home
208 check directory home with path /home
209 if failed uid 0 then unmonitor
210 if failed gid 0 then unmonitor
211
212 # Var
213 check directory var with path /var
214 if failed uid 0 then unmonitor
215 if failed gid 0 then unmonitor
216
217
218
219
220 ## Check a remote host network services availability using a ping test and
221 ## check response content from a web server. Up to three pings are sent and
222 ## connection to a port and a application level network check is performed.
223 #
224 # check host myserver with address 192.168.1.1
225 # if failed icmp type echo count 3 with timeout 3 seconds then alert
226 # if failed port 3306 protocol mysql with timeout 15 seconds then alert
227 # if failed url
228 # http://user:password@www.foo.bar:8080/?querystring
229 # and content == 'action="j_security_check"'
230 # then alert
231 #
232 #Mysql
233
234 check process mysql with pidfile /var/run/mysqld/mysqld.pid
235 group database
236 start program = "/etc/init.d/mysql start"
237 stop program = "/etc/init.d/mysql stop"
238 if failed host 127.0.0.1 port 3306 then restart
239 if 5 restarts within 5 cycles then timeout
240
241 ###############################################################################
242 ## Includes
243 ###############################################################################
244 ##
245 ## It is possible to include additional configuration parts from other files or
246 ## directories.
247 #
248 # include /etc/monit.d/*
249 #
250 #
"monitrc" 250L, 9699C

As it is visible from the mundane configuration file that what we are trying to monitor.It has a big advantage that monit can take decision about the service i.e if some service is down and it needs to up,it can do so.It is just not mere status showing software.

Now we can configure it start when the system boots.So we will define a runlevels for it .We will use a software called sysv-rc-conf ,(aptitude install sysv-rc-conf).Here is invocation of it:

sysv-rc-conf

sysv-rc-conf/>

Now you can see the highlighted section for the monit service.As I have mentioned in configuration file that the web interface of it can be accessed through port 2812 .Here is the invocation through browser:

Monit Web Interface

I hope enlarging those two above picture will give you enough insight that what you can do with it.Now if you click on any of the service on the left side of panel you can get a detailed view like below:

service-details

The above screen has a “Disable Monitoring” button at the bottom of the screen,so with that you can deactivate particular device or thing monitoring.

Munin:
It is basically a graphing system to plot thing on the browser to get a visual representation of activity happening on the network or particular device.Let’s check out whether I have it or not in y system:


bhaskar@bhaskar-laptop_18:38:14_Tue Nov 16:~> sudo dpkg -s munin
[sudo] password for bhaskar:
Package: munin
Status: install ok installed
Priority: optional
Section: net
Installed-Size: 996
Maintainer: Munin Debian Maintainers
Architecture: all
Version: 1.2.6-10~lenny2
Depends: perl (>= 5.6.0-16), perl-modules | libparse-recdescent-perl, librrds-perl, libhtml-template-perl, libdigest-md5-perl, libtime-hires-perl, libstorable-perl, rrdtool, adduser
Recommends: munin-node, libdate-manip-perl
Suggests: www-browser, httpd
Conffiles:
/etc/cron.d/munin 98f4112ea36053af9e1dc9111ab4d973
/etc/munin/munin.conf 057d322c5776710b8b71fbf02b12edbc
/etc/munin/templates/munin-comparison-month.tmpl 31f92013656bc96f496ad9fe9bd87b8b
/etc/munin/templates/munin-comparison-year.tmpl f8fc458757219e152bc0c316208214c4
/etc/munin/templates/definitions.html 6f2cda49ff5f0a5641549ae0dd063334
/etc/munin/templates/munin-nodeview.tmpl 60791f957f0879b859274ac423850e59
/etc/munin/templates/munin-serviceview.tmpl 9d061d0a097fdedc7cec09da56b45170
/etc/munin/templates/munin-comparison-week.tmpl 0ed0ac1772a96108e621f7ec9e651e65
/etc/munin/templates/logo.png 385010f8f050d25723206b1c77f0df5e
/etc/munin/templates/munin-comparison-day.tmpl 487b8c7f6f1eaf19687d601621da6f06
/etc/munin/templates/munin-overview.tmpl 07b6ba2c872f737fd3f2bf3df82bee06
/etc/munin/templates/munin-domainview.tmpl dfa7d0b5372086423c2aa7476bd04b90
/etc/munin/templates/style.css e6f61ecb33988635e5f6961de96c71c3
/etc/logrotate.d/munin caf8f6b63086ec5e11a9a2e2d883c7a1
Description: network-wide graphing framework (grapher/gatherer)
Munin is a highly flexible and powerful solution used to create graphs of
virtually everything imaginable throughout your network, while still
maintaining a rattling ease of installation and configuration.
.
This package contains the grapher/gatherer. You will only need one instance of
it in your network. It will periodically poll all the nodes in your network
it's aware of for data, which it in turn will use to create graphs and HTML
pages, suitable for viewing with your graphical web browser of choice.
.
It is also able to alert you if any value is outside of a preset boundary,
useful if you want to be alerted if a filesystem is about to grow full, for
instance. You can do this by making Munin run an arbitrary command when you
need to be alert it, or make use of the intrinsic Nagios support.
.
Munin is written in Perl, and relies heavily on Tobi Oetiker's excellent
RRDtool. To see a real example of Munin in action, you can follow a link
from to a live installation.
Homepage: http://munin.projects.linpro.no

It seems that I have it.So the next thing to where it reside in the system :

bhaskar@bhaskar-laptop_18:57:10_Tue Nov 16:~> whereis munin
munin: /etc/munin /usr/share/munin

Oh! I forgot to tell you that I need one more piece of software called “minin-node” . Let’s check out:


bhaskar@bhaskar-laptop_18:58:53_Tue Nov 16:~> sudo dpkg -s munin-node
Package: munin-node
Status: install ok installed
Priority: optional
Section: net
Installed-Size: 1396
Maintainer: Munin Debian Maintainers
Architecture: all
Source: munin
Version: 1.2.6-10~lenny2
Depends: perl (>= 5.6.0-16), libnet-server-perl, procps, adduser, lsb-base (>= 3.2-4), gawk
Recommends: libnet-snmp-perl
Suggests: munin, munin-plugins-extra, libwww-perl, liblwp-useragent-determined-perl, libnet-irc-perl, mysql-client, smartmontools (>= 5.37-6~bpo40+1), acpi | lm-sensors, python, ethtool, libdbd-pg-perl
Conffiles:
/etc/cron.d/munin-node 64b993c241bef6ad98b0f50f0de9d18b
/etc/init.d/munin-node 0a2e199d22c98af892cc407c63dddb5a
/etc/munin/munin-node.conf c317597f98622746dc2120d4aa1ace17
/etc/munin/plugin-conf.d/munin-node 686c0aa6a0a3eb4e973f162dc77ffe52
/etc/logrotate.d/munin-node 8afe5ab15b1f1731016d0bffadadff46
Description: network-wide graphing framework (node)
Munin is a highly flexible and powerful solution used to create graphs of
virtually everything imaginable throughout your network, while still
maintaining a rattling ease of installation and configuration.
.
This package contains the daemon for the nodes being monitored. You should
install it on all the nodes in your network. It will know how to extract all
sorts of data from the node it runs on, and will wait for the gatherer to
request this data for further processing.
.
It includes a range of plugins capable of extracting common values such as cpu
usage, network usage, load average, and so on. Creating your own plugins which
are capable of extracting other system-specific values is very easy, and is
often done in a matter of minutes. You can also create plugins which relay
information from other devices in your network that can't run Munin, such as a
switch or a server running another operating system, by using SNMP or similar
technology.
.
Munin is written in Perl, and relies heavily on Tobi Oetiker's excellent
RRDtool. To see a real example of Munin in action, you can follow a link
from to a live installation.
Homepage: http://munin.projects.linpro.no

Now I changed into the /etc/munin directory ,because I need to change the configuration file of it.Like below:

bhaskar@bhaskar-laptop_19:03:28_Tue Nov 16:/etc/munin> ls
munin.conf munin-node.conf plugin-conf.d plugins templates

Now have a look at the munin.conf file:

1 # Example configuration file for Munin, generated by 'make build'
2
3 # The next three variables specifies where the location of the RRD
4 # databases, the HTML output, and the logs, severally. They all
5 # must be writable by the user running munin-cron.
6 dbdir /var/lib/munin
7 htmldir /var/www/munin
8 logdir /var/log/munin
9 rundir /var/run/munin
10
11 # Where to look for the HTML templates
12 tmpldir /etc/munin/templates
13
14 # Make graphs show values per minute instead of per second
15 #graph_period minute
16
17 # Graphics files are normaly generated by munin-graph, no matter if
18 # the graphs are used or not. You can change this to
19 # on-demand-graphing by following the instructions in
20 # http://munin.projects.linpro.no/wiki/CgiHowto
21 #
22 #graph_strategy cgi
23
24 # Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
25 # something changes (OK -> WARNING, CRITICAL -> OK, etc)
26 #contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
27 #contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
28 #
29 # For those with Nagios, the following might come in handy. In addition,
30 # the services must be defined in the Nagios server as well.
31 #contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg
32
33 # a simple host tree
34 [bhaskar-laptop.localdomain]
35 address 127.0.0.1
36 use_node_name yes
37
38 #
39 # A more complex example of a host tree
40 #
41 ## First our "normal" host.
42 # [fii.foo.com]
43 # address foo
44 #
45 ## Then our other host...
46 # [fay.foo.com]
47 # address fay
48 #
49 ## Then we want totals...
50 # [foo.com;Totals] #Force it into the "foo.com"-domain...
51 # update no # Turn off data-fetching for this "host".
52 #
53 # # The graph "load1". We want to see the loads of both machines...
54 # # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
55 # load1.graph_title Loads side by side
56 # load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
57 #
58 # # The graph "load2". Now we want them stacked on top of each other.
59 # load2.graph_title Loads on top of each other
60 # load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
61 # load2.dummy_field.draw AREA # We want area instead the default LINE2.
62 # load2.dummy_field.label dummy # This is needed. Silly, really.
63 #
64 # # The graph "load3". Now we want them summarised into one field
65 # load3.graph_title Loads summarised
66 # load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
67 # load3.combined_loads.label Combined loads # Must be set, as this is
68 # # not a dummy field!
69 #
70 ## ...and on a side note, I want them listen in another order (default is
71 ## alphabetically)
72 #
73 # # Since [foo.com] would be interpreted as a host in the domain "com", we
74 # # specify that this is a domain by adding a semicolon.
75 # [foo.com;]
76 # node_order Totals fii.foo.com fay.foo.com
77 #
78

I have bold the section in the file ; which is absolute must get going with it. If the directory is not present ,then please create it and point the right path.

Now take a look at the munin-node.conf file:

1 #
2 # Example config-file for munin-node
3 #
4
5 log_level 4
6 log_file /var/log/munin/munin-node.log
7 pid_file /var/run/munin/munin-node.pid
8
9 background 1
10 setseid 1
11
12 user munin
13 group munin
14 setsid yes
15
16 # Regexps for files to ignore
17
18 ignore_file ~$
19 ignore_file \.bak$
20 ignore_file %$
21 ignore_file \.dpkg-(tmp|new|old|dist)$
22 ignore_file \.rpm(save|new)$
23 ignore_file \.pod$
24
25 # Set this if the client doesn't report the correct hostname when
26 # telnetting to localhost, port 4949
27 #
28 #host_name localhost.localdomain
29
30 # A list of addresses that are allowed to connect. This must be a
31 # regular expression, due to brain damage in Net::Server, which
32 # doesn't understand CIDR-style network notation. You may repeat
33 # the allow line as many times as you'd like
34
35 allow ^127\.0\.0\.1$
36
37 # Which address to bind to;
38 host *
39 # host 127.0.0.1
40
41 # And which port
42 port 4949
43

So once more I have highlighted few thing in the this file to get going with it.And most of the thing are pretty easily understood thing.

Lets access it through browser to see the graph..here we go..this the first screen I got in my system:

Ok once I clicked on hyperlinked option I am presented with the graphs like below:

Ok, now if your click those graph then you can get little explanation of the graph too!!

Hope this will help.

Cheers!
Bhaskar

Password-less ssh

As the title said I am going to show you that how you can use the built-in mechanism to avoid typing your password at the terminal when connecting through ssh(secure shell) to the remote computer.

I am assuming both the computers(or as many we want to connect) has the required software to play with.I mean that both the boxes has openssh installed and well configured.So first thing first,we need to generate the keys.One is private(which should not be shared) and the public key(which should be shared).

Here is how it can be done…


bhaskar@bhaskar-laptop_08:58:56_Sat Oct 30:~> sudo /usr/bin/ssh-keygen -t rsa

It will ask you for the passphrase(password with space separated words).Once you have done that it will store the public key and private key in the specific users .ssh directory.And the public key file is ended with .pub extension.

Now try to figure out wether ssh-agent is running or not? Now a bit of explanation about it like this:ssh-agent is a program to hold private keys used for public key authentication (RSA, DSA). The idea is that ssh-agent is started in the beginning of an X-session or a login session, and all other windows or programs are started as clients to the ssh-agent program. Through use of environment variables the agent can be located and automatically used for authentication when logging in to other machines using ssh(1).

So how to detect it? Here is the way to do it :

bhaskar@bhaskar-laptop_09:07:26_Sat Oct 30:~> sudo echo $SSH_AGENT_PID
Password:
3482

So it’s running! If it is not running then start a new one like this :

bhaskar@bhaskar-laptop_09:07:51_Sat Oct 30:~> sudo eval $(ssh_agent)

Now tell it the key by running ssh-add .What does ssh-add do?? Here is explanation from the man page itself: ssh-add adds RSA or DSA identities to the authentication agent, ssh-agent(1). When run without arguments, it adds the files ~/.ssh/id_rsa, ~/.ssh/id_dsa and ~/.ssh/identity. After loading a private key, ssh-add will try to load corresponding certificate information from the filename obtained by appending -cert.pub to the name of the private key file. Alternative file names can be given on the command line.Right?

Now run :


bhaskar@bhaskar-laptop_09:13:11_Sat Oct 30:~> sudo ssh-add

and enter your passphrase. You’ll need to do this each time you log in; if you’re using X, try adding


SSH_ASKPASS=ssh-askpass ssh-add

to your .xsession file. (You may need to install ssh-askpass.) Now for each server you log into, create the directory ~/.ssh and copy the file ~/.ssh/id_rsa.pub into it as ~/.ssh/authorized_keys . If you started the ssh-agent by hand, kill it with

bhaskar@bhaskar-laptop_09:15:19_Sat Oct 30:~> sudo ssh-agent -k

when you log out.

Hope this will help.

Cheers!
Bhaskar

Cadaver – A command-line WebDAV client for Unix

What it does?

file upload, download, on-screen display, namespace operations (move and copy), collection creation and deletion, and locking operations.

How to get it:

You can get it from here http://www.webdav.org/cadaver/ . As I am sitting on Gentoo and it’s repository has it already,so I go it like below:

bhaskar@bhaskar-laptop_10:47:41_Fri Sep 24:~> sudo emerge -av cadaver

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] net-misc/cadaver-0.23.3  USE="nls" 813 kB

Total: 1 package (1 new), Size of downloads: 813 kB

Would you like to merge these packages? [Yes/No] y

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) net-misc/cadaver-0.23.3
>>> Downloading 'http://distfiles.gentoo.org/distfiles/cadaver-0.23.3.tar.gz'
--2010-09-24 10:47:56--  http://distfiles.gentoo.org/distfiles/cadaver-0.23.3.tar.gz
Resolving distfiles.gentoo.org... 199.6.1.174, 216.165.129.135, 140.211.166.134, ...
Connecting to distfiles.gentoo.org|199.6.1.174|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://mirrors.kernel.org/gentoo/distfiles/cadaver-0.23.3.tar.gz [following]
--2010-09-24 10:48:00--  http://mirrors.kernel.org/gentoo/distfiles/cadaver-0.23.3.tar.gz
Resolving mirrors.kernel.org... 130.239.17.6, 149.20.20.135, 199.6.1.174, ...
Reusing existing connection to distfiles.gentoo.org:80.
HTTP request sent, awaiting response... No data received.
Retrying.

--2010-09-24 10:48:06--  (try: 2)  http://mirrors.kernel.org/gentoo/distfiles/cadaver-0.23.3.tar.gz
Connecting to mirrors.kernel.org|130.239.17.6|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 831884 (812K) [application/x-gzip]
Saving to: `/usr/portage/distfiles/cadaver-0.23.3.tar.gz'

 100%[======================================================================================================
==================================>] 831,884     1.15K/s   in 2m 33s

For working with it I have created a directory for it in web space like below:

bhaskar@bhaskar-laptop_10:57:11_Fri Sep 24:~>sudo mkdir -p/var/www/localhost/htdocs/webdav
Password: 

bhaskar@bhaskar-laptop_11:08:07_Fri Sep 24:~>ls -ls /var/www/localhost/htdocs/webdav/
total 0

bhaskar@bhaskar-laptop_11:08:25_Fri Sep 24:~>ls -ld /var/www/localhost/htdocs/webdav/
drwxr-xr-x 2 apache apache 4096 Sep 24 11:08 /var/www/localhost/htdocs/webdav/

Now I have mod_dav built with apache as module.Here it is:

bhaskar@bhaskar-laptop_11:17:54_Fri Sep 24:/etc/apache2/modules.d>ls | grep mod_dav
45_mod_dav.conf

And the config look like below:

 <IfDefine DAV>
 2 DavLockDB "/var/lib/dav/lockdb"
 3
 4 # The following directives disable redirects on non-GET requests for
 5 # a directory that does not include the trailing slash.  This fixes a
 6 # problem with several clients that do not appropriately handle
 7 # redirects for folders with DAV methods.
 8 <IfModule setenvif_module>
 9 BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
10 BrowserMatch "MS FrontPage" redirect-carefully
11 BrowserMatch "^WebDrive" redirect-carefully
12 BrowserMatch "^WebDAVFS/1.[012345678]" redirect-carefully
13 BrowserMatch "^gnome-vfs/1.0" redirect-carefully
14 BrowserMatch "^XML Spy" redirect-carefully
15 BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
16 </IfModule>
17 </IfDefine>
18
19 # vim: ts=4 filetype=apache

Now in main apache config file it shows like this:

 <IfDefine DAV>
 85 LoadModule dav_module modules/mod_dav.so
 86 </IfDefine>
 87 <IfDefine DAV>
 88 LoadModule dav_fs_module modules/mod_dav_fs.so
 89 </IfDefine>
 90 <IfDefine DAV>
 91 LoadModule dav_lock_module modules/mod_dav_lock.so
 92 </IfDefine>

I am going to create a virtualhost for cadaver to use..like below:

<VirtualHost *:80>
49     ServerName localhost
50     Include /etc/apache2/vhosts.d/default_vhost.include
51     DocumentRoot /var/www/localhost/htdocs/webdav/
52     <Directory /var/www/localhost/htdocs/webdav>
53       Options Indexes Multiviews
54       AllowOverride None
55       Order Allow deny
56       Allow from all
57     </Directory>

Alias /webdav /var/www/localhost/htdocs/webdav
60
61    <Location /webdav>
62      DAV on
63      AuthType Basic
64      AuthName "webdav"
65      AuthUserFile /var/www/localhost/htdocs/webdav/passwd.dav
66      Require valid-user
67    </Location>

58  </Virtualhost>

Adding a user and password to operate with cadaver:

bhaskar@bhaskar-laptop_11:31:59_Fri Sep 24:/etc/apache2/vhosts.d> sudo /usr/sbin/htpasswd2
-c /var/www/localhost/htdocs/webdav/passwd.dav cadaver
New password:
Re-type new password:
Adding password for user cadaver

And change the permission of that file like below:

bhaskar@bhaskar-laptop_11:35:20_Fri Sep 24:/var/www/localhost/htdocs/webdav>sudo chown
 root:apache passwd.dav

Now restarted the apache like this:

bhaskar@bhaskar-laptop_11:51:30_Fri Sep 24:~> sudo /etc/init.d/apache2 start
 * Starting apache2 ...                                                                                                                                                     [ ok ]

Now to test the cadaver commandline client..see below:

bhaskar@bhaskar-laptop_11:55:52_Fri Sep 24:~> cadaver http://bhaskar-laptop/webdav

Authentication required for webdav on server `bhaskar-laptop’:

Username: cadaver

Password:

dav:/webdav/>

dav:/webdav/> help

Available commands:

ls         cd         pwd        put        get        mget       mput

edit       less       mkcol      cat        delete     rmcol      copy

move       lock       unlock     discover   steal      showlocks  version

checkin    checkout   uncheckout history    label      propnames  chexec

propget    propdel    propset    search     set        open       close

echo       quit       unset      lcd        lls        lpwd       logout

help       describe   about

Aliases: rm=delete, mkdir=mkcol, mv=move, cp=copy, more=less, quit=exit=bye

dav:/webdav/>

Now you can use it like ftp thing .

Hope this will help.

Cheers!

Bhaskar