How to add image to Nagios chart

We assume following configuration:

  • FAN installation containing Nagios and Centreon installed on CentOS 5.9
  • IP of Nagios: 10.50.100.101
  • You are owner of a working machine with linux or macos (windows users will need to use putty for some of the steps or install an ftp server on the centreon machine)

First step, prepare your image

Create an image of 40 by 40 pixels and in PNG format. In order to blend in the image with Nagios, make sure that the parts around the image are transparent. (Alpha layer PGN).

Second step, upload your image

Normally speaking, your server should only support following protocols. HTTPS (or HTTP for local deployments) and SSH. If you have FTP running on your server, things are different, but here we assume we only have HTTP/SSH. We also assume the root account is accessible from the outside. If not (e.g. debian default install) one will have to copy to the user having remote access over SSH.

scp image.png root@10.50.100.101:/root
scp image.png user1@10.50.100.101:/home/user1

Third step, copy the image to the right folder on the server

Please note the second operation is a move operation. Make sure to execute the steps in the correct order.

cp /root/*.png /usr/share/centreon/www/img/media/logos/
mv /root/*.png /usr/share/nagios/images/logos/

Normally, a chown apache:apache to the files would be required in order to make the files readable for Nagios, but this seems to be working without. Just for the sake of correctness, please find following commands.

chown apache:apache /usr/share/centreon/www/img/media/logos/
chown apache:apache /usr/share/nagios/images/logos/

Forth step, refresh the server

Log-in to centreon, go to administration, options, media and select synchronise media. Now you should be able to use the image on any network device.

Add diskspace on CentOS 6.x

This procedure will only work if your configuration is using LVM. LVM is the default used during install, so this should be ok.

Start analyzing the usage of the disks.

fdisk -l

Shows that the volumes are on e.g. /dev/sda and that you are using an LVM system.

fdisk /dev/sda

In fdisk, create a new volume by pressing ‘n’. Create new primary partition (extended partition is not tested but should work). Change partition type by pressing ‘t’. Select partition type ‘8e’, this is Linux LVM.
Write down the results by pressing ‘w’ key. In case of doublt, press ‘m’ key to get help.

Now we need to re-read the partition table. Ether we restart the services or do a reboot.

shutdown -r now

After restarting the services, we check if all is ok and then proceed by creating the ‘Physical Volume Group’. The pvs command will show if it was created correctly. The example below assumes that your new partition is called /dev/sda4.

fdisk -l
pvcreate /dev/sda4
pvs

Now extend the volume group. Example assumes that name is VolGroup00, but fdisk will show you the exact name to be used. In case of doubt and you only have one volume group, the command vgs will show its name.

vgextend VolGroup00 /dev/sda4

Now extend its space, type the command vgdisplay to get the number of blocks to be extended. It should be displayed next to the label Free PE / Size. The example below assumes it shows Free PE / Size 3190 / xxxx.

vgdisplay
lvextend -l +3190 /dev/mapper/VolGroup00-LogVol00

After doing this, resize the file system. The command resize2fs assumes you are using ext4 which is the default.

resize2fs /dev/mapper/VolGroup00-LogVol00

Now check available disk space. It should be increased.

df

After finishing, do not forget to restart services or reboot.

shutdown -r now

Done !

Installing Code::Blocks on Linux Mint

Check what version of Mint you have:

cat /etc/debian_version

This should be Buster for the following to work. If you are on Stretch, please refer to: https://wxstuff.xaviou.fr/article/debian-repository.html

Import repository key:

wget -O- https://apt.xaviou.fr/key.asc | sudo apt-key add -

Create repository list:

sudo vi /etc/apt/sources.list.d/codeblocks.list

And insert following text:

deb https://apt.xaviou.fr/stable/ buster main
deb-src https://apt.xaviou.fr/stable/ buster main

Update your installation

sudo apt-get update

Now you are ready to install Code::Blocks from the packet manager or from the command line.

sudo apt-get install codeblocks

Tinkering on what happened in 2019

2019 was a great year for the internet, but some elements are worry-some

Tim Berners-Lee launched the contract for the web. A good initiative. Certainly an answer to what happened with some big companies wanting to take control:

HTTPS everywhere – great for privacy. Downsides: most proxies are broken, network acceleration is back to basics widening the gap in between the western countries and third world countries. How are corporate firewalls handling it? Most of the time, there is no need to deliver data over HTTPS except for a single reason, privacy. Why in a hell is firefox showing a broken lock when a site is not HTTPS. It should be more like a spying eye. Please let users decide whether or not they want privacy. Anyway, as long as we do not control the keystore, there is no privacy.

Facebook stance on privacy. 2019 was the beginning of the fall of facebook. It will either be broken up or people will start to understand how it is abusing your data.

The demise of windows. Even on Azure, now there are more linux installations than windows installations. Only a few years keep us apart from an opensource windows for the public and a closed source version for the enterprise.

Do-not-track. Honestly, I do not understand why we need this. If I go to a web-site, I want content of this web-site. I do not want publicity, nor any other content that is not delivered from other sources as the one on the website. It is time for browsers to block all content from other sources than the URL we just typed in the address bar. The do-not-track would not be required.

WWW has to go. Honestly, I do not understand why we need this. As a sideline, some browsers will not show the parameters in the address bar unless I select it. People already do not understand how a browser works, so why hiding some of its core concepts? Goal, take the hand of your user so you can guide him/her to where you want. This lets me think of the early Microsoft that thought you, nobody will ever need HTML 4 as majority of users stick to 3.2, lets remove it from Internet Explorer Mac so we can force users to silverlight.
For those that do not understand, www is great for routing. A company might have multiple servers, such as mail, webmail, intranet, application1, ftp, … and then a also a server servicing www content.

DNS over HTTP. What the heck is going on? Why would we ever need this? Answer: you certainly can read the reasoning from those promoting it. Until all browsers, phones, operating systems, … will adopt it, it will create a dual speed internet. In the mean time, all those applications that are on iOS or play store will start to function differently than the google browser. (Yes, I should sell this idea to google, great way to force users to come back to them.)

HSTS. What the heck is going on? Why would we ever need this? After the history of certificates, green ‘costly’ certificates, demoting self signed certificates, now the browser is storing DNS entries and caching not only web-content but also web routing. Bye bye accelerating the web and imposing a new cache hell to web-developers.

Huawei gets blocked for the false reason. Why are other countries following suit? Where are the proofs? The US has been caught multiple times in spying, creating backdoors, tampering the BGP routes, imposing operators or the Swift network to spy into their systems, yet we are not blocking Cisco, Facebook, …. because of … maybe the US is not involved in any wars while the others are. This is all a huge lie.

Edward Snowden and Julian Assange. The last part of demonizing those that want the truth to be told and lies to be revealed. Poor guys who dared to tell the public what for large parts we knew already.

QUIC – (aka HTTP/3) a proprietary protocol by Google that wants you to use UDP for content streaming just like audio streaming. They only talk about the benefits. There are several downsides to it: it cannot be cached, if bundled with SSL, how are corporate firewalls going to handle it? It also adds complexity because retransmission is handled by the application and no longer by the network layer. In essence, it makes browsers bigger and more complex just for the interest of some of the big players such as Facebook and Google.

Blocking certain countries to access open source repositories such as sourceforge or github? Who is deciding what? Who is the bad guy and who is the good guy? Its like saying, lets starve a population to death because we don’t like its leaders.

Privacy as a technology concept or privacy by human rights

There are some legitimate reasons why we want to intercept privacy. I give some examples: parents controlling their children, networks that block bad content, companies wanting to protect their interests, countries that want to apply their legislation.

We should not give the right to big companies to control your content and at the same time propose solutions that make controlling by the one who is entitled to control impossible. Putting new protocols in place because you do not agree with what certain governments are doing is not the right thing to do.

Protocols are open and should be easily adopted by all players of the market. Yes, one can develop and propose an enhancement, but being a major player in the market does not mean that you are allowed to impose your choices. Please play it nice. It is not because there are bad offenders in the world that you should become a bad offender of a different kind.

Bash tricks

Colouring grep output, modifying welcome message.

Reference on colours.

Some ways to do it

grep --color=always
grep --color -E 'pattern|$' file
grep --color 'pattern\|$' file
egrep --color 'pattern|$' file
export GREP_OPTIONS='--color=always' 

Alternatively, use ack. No file required, recursive by default.

ack -i pattern

The ultimate solution, use ack --cathy! Do not forget to install it first.

sudo apt-get install ack