- If you compare old and new version, you'll notice the script was completely rewritten. It's because I wanted it to run on my synology NAS.
- Next change is additional host states, instead of A-available and N-notAvailable I'm now using 2 additional states Going Up, Going Down. This will delay the notification about host state change and prevent frequent flapping of naughty hosts in network.
- Last feature added is hosts UP/DOWN times in notifications; see mail notification example:
Showing posts with label Scripting. Show all posts
Showing posts with label Scripting. Show all posts
Saturday, July 30, 2016
Ping-based Host Monitoring Script with Timestamps
In my previous post Server availability monitoring with email notifications I've used the same idea of monitoring. This script is a version 2.0 with some additional features:
Tuesday, January 27, 2015
Dynamic shell prompt
Dynamic shell prompt can change it's form according to some events going on on terminal. It can change e.g. color, if the previous command execution was unsuccessful, or it can display various information.
In this post, there is an example of such a prompt. It displays information, when you enter specified working directory.
The picture below shows my configuration:
This is achieved with setting a variable PROMPT_COMMAND which is evaluated every time you run a command. In my case, there is a condition, which looks for matching path.
In this post, there is an example of such a prompt. It displays information, when you enter specified working directory.
The picture below shows my configuration:
This is achieved with setting a variable PROMPT_COMMAND which is evaluated every time you run a command. In my case, there is a condition, which looks for matching path.
# dynamic PS prompt export PROMPT_COMMAND='PS1="$(if [ "$(pwd | grep /mnt/storage/backup_git)" ]; then echo "\\[\\033[32m\\]backup_git "; fi;)\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] "'
Saturday, August 2, 2014
GPIO 05-pwm
Raspberry PI has the ability to use PWM (pulse width modulation) to control width of the pulse sent on the GPIO pin, which provides better granularity to control connected devices, in this case LED.
This feature allows to control LEDs intensity, which can be used with RGB LED to mix colors.
This feature allows to control LEDs intensity, which can be used with RGB LED to mix colors.
Sunday, July 20, 2014
GPIO 04-rgb
I finally got to the RGB LED and tried to connect it to Raspberry PI.
This first script (04-rgb.sh) is a modification of previous one. It uses one new feature though, associative fields in bash to distinguish between the three basic colors (RGB) and their combinations (Yellow, Purple, Light Blue, White) as shown on the figure:
The following figure shows how the LED is connected to GPIO.
This first script (04-rgb.sh) is a modification of previous one. It uses one new feature though, associative fields in bash to distinguish between the three basic colors (RGB) and their combinations (Yellow, Purple, Light Blue, White) as shown on the figure:
The following figure shows how the LED is connected to GPIO.
Sunday, July 6, 2014
keepalive.sh: send keepalive to remote server
This script is deployed on my odroid. It serves to keep track if the odroid has internet access and if it is alive. It uses simple keepalive sending via HTTPS protocol to a remote server. The remote server watches keepalive signals and will notify if they stop comming.
Monday, June 30, 2014
GPIO 03-leds
This script controls LEDs connected to the GPIO, however, it uses different approach. Instead of using python library to handle GPIO pins, is uses direct calls from shell. It is written in bash.
Wednesday, June 25, 2014
pingcheck.sh: restore wlan connection
Another simple script I used on my Raspberry PI and now use on odroid. It is simple, ping based check of IP address availability.
It has been designed to restore wlan0 connection, as from time to time I get disconnected from my network.
During the time I've added few features, like pingcheck of default GW and pingcheck of other IP addresses and network notifications which will send popup to my desktop PC.
It has been designed to restore wlan0 connection, as from time to time I get disconnected from my network.
During the time I've added few features, like pingcheck of default GW and pingcheck of other IP addresses and network notifications which will send popup to my desktop PC.
Monday, June 23, 2014
GPIO 02-leds
This is a slightly modified 01-leds python script. It can turn on/off group of LEDs (all red, green or yellow) defined in the LEDret(color) function.
This post shows scheme of how the LEDs are connected to GPIO.
This post shows scheme of how the LEDs are connected to GPIO.
Saturday, June 21, 2014
GPIO 01-leds
This is my first post regarding Raspberry's GPIO pins. This is very basic scheme consisting of ten LEDs, which are controlled by python script, providing several effects for LEDs.
Saturday, May 3, 2014
Bash Specialities, part 3
This part shows examples for bash string manipulation: string matching and replacing, some substring operations and positional parameters operations.
Tuesday, April 22, 2014
Bash Specialities, part 2
This post shows different examples of usage for file descriptors in bash and few interesting linux commands and features.
Wednesday, April 9, 2014
Bash Specialities, part 1
This post shows some more or less frequently used features in bash, which might come handy in some situations.
Saturday, April 5, 2014
Using caldav 0.2.1 with owncloud DAV services
New version caldav libraries was released recently. It didn't work from the scratch with my owncloud CalDAV. This post shows what I have changed to get it work.
Monday, March 17, 2014
Script for starting services and mouning filesystems
This script handles mounting of defined mountpoints and starts services via systemctl. I use it to start and mount all necessary services for my Raspberry PI.
Thursday, January 23, 2014
Script for unmounting NFS mounts
I encountered an issue when shutting down or rebooting system with mounted NFS exports. It seems that systemd shuts down network service before all NFS mounts are unmounted and the system will hang, waiting for these mount points to be unmounted.
To prevent this, I've composed short script, which handles NFS unmounting before shutdown.
To prevent this, I've composed short script, which handles NFS unmounting before shutdown.
Friday, January 3, 2014
IRC notifications from remote server
Like many people, I use irssi client on remote server to connect to IRC chat. With tmux or GNU Screen you are able to be connected 24/7, and it would be great to be notified when someone is writing to you or has mentioned you on a channel.
Read more on how to setup such a scenario.
Read more on how to setup such a scenario.
Monday, December 30, 2013
Setting up NFS
With NFS you can share folders on network and mount them on other computers just like local filesystems. I'm using NFS shared folder for transmission daemon's download folder and for owncloud.
Wednesday, December 11, 2013
Python CalDAV script for creating/removing calendar events
I'd like to use terminal to create, view and remove events in my Owncloud calendar. I've found client library which is able to handle this. It is simple to use and offers only few functions (see documentation).
Based on this library I've written python2 script.
Based on this library I've written python2 script.
Tuesday, November 19, 2013
Sync script
The script in this post handles synchronization of files and folders. You can specify source and destination file. It's using timestamp of file and md5 sum to check if the file was modified.
I've created this script because I needed to sync several files/folders with owncloud folder.
I've created this script because I needed to sync several files/folders with owncloud folder.
Sunday, October 20, 2013
Raspberry system information
Sometimes it is useful to see some basic information when logging onto your PI. In my case I wanted to see if some processes are running, so I created simple script, that writes those and few additional information.
Subscribe to:
Posts (Atom)
