NCS: Use

Use. Enjoy.

For the execution of the scripts it is suggested to use the sudo and alias so that they can be run from everyone and everywhere.


Generic placeholder image

Requirements Back to top

1 Install packages

sudo apt-get install sudo mplayer espeak
 
Reading package lists... Done
Building dependency tree
Reading state information... Done
espeak is already the newest version.
mplayer is already the newest version.
sudo is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
                      

2 Config user nagios

grep nagios /etc/passwd
nagios:x:1002:1002::/home/nagios:/bin/bash
                      

3 Config sudo

sudo grep ncs /etc/sudoers
nagios ALL = (root) NOPASSWD: /usr/local/ncs/ncs_from_local_or_remote.bash
                      

4 Config alias

tail -1 /etc/profile
. /usr/local/ncs/ncs_alias.bash
                      

5 Config Check Prerequisites

/usr/local/ncs/ncs_and_check_prerequisites.bash

CONFIGURATION:

        Exist /usr/local/ncs/ncs.conf... [ OK ]
        #!/bin/bash [ OK ]
        lang =
                en [ OK ]
        name =
                02 [ OK ]
        base =
                /usr/local/ncs [ OK ]
        ncs_and_report_to_console =
                /usr/local/ncs/ncs_and_report_to_console.bash [ OK ]
        ncs_from_local_or_remote =
                /usr/local/ncs/ncs_from_local_or_remote.bash [ OK ]
        live_sock =
                /var/log/nagios/rw/live [ OK ]
        nagiostats =
                /usr/local/nagios/bin/nagiostats [ OK ]
        console =
                /dev/pts/1 [ OK ]
        mail_background =
                screen_saver [ OK ]
        mail_to =
                npres.inc@gmail.com [ OK ]
        mail_from =
                $mail_to [ OK ]
        domain =
                npr3s.com [ OK ]
        server_01_name =
                01 [ OK ]
        server_01_host =
                nr01 [ OK ]
        server_01_port =
                80 [ OK ]
        server_02_name =
                02 [ OK ]
        server_02_host =
                nr03 [ OK ]
        server_02_port =
                80 [ OK ]

FILES NEEDED:

        ansi2html =
                /usr/local/ncs/resources/ansi2html.sh [ OK ]
        send_email.php =
                /usr/local/ncs/resources/send_email.php [ OK ]

FILES OPTIOMAL:

        mplayer =
                /usr/bin/mplayer [ FAIL! ]
        espeak =
                /usr/bin/espeak [ FAIL! ]
                      

Screen Saver | Alarm Back to top

1 START

ncs_start
==== NAGIOS REPORT 01 OF HOSTS/SERVICES WITH PROBLEMS @ 2016-11-25 00:01:39 ====
 nr01: BACKUP
 nr02: BACKUP
 nr05: GIT-NPR3S
------- NAGIOS REPORT OF HOSTS/SERVICES WITH PROBLEMS BUT WITH DOWNTIME. -------
------------------------------- SUMMARY OF STATE -------------------------------
 SERVICES: 90 OK | 2 WARNING | 0 UNKNOWN | 1 CRITICAL |
 HOSTS: 7 UP | 0 DOWN | RUNNING TIME: 4d 4h 24m 47s
================================================================================

REFRESH IN: 59 seconds
                      

The result may vary.

depending on the configuration of nagios

2 STOP

ncs_stop
kill -9 27272
                      

The result may vary.

depending on the assigned process id.


Terminal Back to top

1 RESUME

ncs
==== NAGIOS REPORT 02 OF HOSTS/SERVICES WITH PROBLEMS @ 2016-11-28 19:51:08 ====
 nr01: APT,BACKUP,CONKY,Current Load,Current Users,FIREWALL,GIT-NPR3S,HTTP,PING,RO-FS,Root Partition,SAR,SSH,Swap Usage,Total Processes
 nr03: CloudAtCost - Resources
 nr03: GIT-NPR3S
 nr05: GIT-NPR3S
------- NAGIOS REPORT OF HOSTS/SERVICES WITH PROBLEMS BUT WITH DOWNTIME. -------
------------------------------- SUMMARY OF STATE -------------------------------
 SERVICES: 74 OK | 2 WARNING | 0 UNKNOWN | 16 CRITICAL |
 HOSTS: 5 UP | 1 DOWN | RUNNING TIME: 0d 9h 59m 50s
================================================================================
                      

The result may vary.

depending on the configuration of nagios

2 ALL

ncs_all
==== NAGIOS REPORT 02 OF HOSTS/SERVICES WITH PROBLEMS @ 2016-11-28 19:52:11 ====
 nr01: APT,BACKUP,CONKY,Current Load,Current Users,FIREWALL,GIT-NPR3S,HTTP,PING,RO-FS,Root Partition,SAR,SSH,Swap Usage,Total Processes
 nr02: APT,BACKUP,CONKY,Current Load,Current Users,FIREWALL,GIT-NPR3S,HTTP,PING,RO-FS,Root Partition,SAR,SSH,Swap Usage,Total Processes
 nr03: APT,BACKUP,CONKY,Current Load,Current Users,FIREWALL,GIT-NPR3S,HTTP,PING,RO-FS,Root Partition,SAR,SSH,Swap Usage,Total Processes
 nr04: APT,BACKUP,CONKY,Current Load,Current Users,FIREWALL,GIT-NPR3S,HTTP,PING,RO-FS,Root Partition,SAR,SSH,Swap Usage,Total Processes
 nr05: APT,BACKUP,CONKY,Current Load,Current Users,FIREWALL,GIT-NPR3S,HTTP,PING,RO-FS,Root Partition,SAR,SSH,Swap Usage,Total Processes
 nr06: APT,BACKUP,CONKY,Current Load,Current Users,FIREWALL,GIT-NPR3S,HTTP,PING,RO-FS,Root Partition,SAR,SSH,Swap Usage,Total Processes
------- NAGIOS REPORT OF HOSTS/SERVICES WITH PROBLEMS BUT WITH DOWNTIME. -------
------------------------------- SUMMARY OF STATE -------------------------------
 SERVICES: 74 OK | 2 WARNING | 0 UNKNOWN | 16 CRITICAL |
 HOSTS: 5 UP | 1 DOWN | RUNNING TIME: 0d 10h 0m 53s
================================================================================
                      

The result may vary.

depending on the configuration of nagios


1 TEST

ncs_mail -f
It's my turn. (Forced!)
                      

The result may vary.

depending on the configuration of nagios

2 Config crontab

crontab -l | grep ncs
0 * * * * /usr/local/ncs/ncs_and_report_to_email.bash
                      

1 Config crontab

crontab -l | grep ncs
*/5 * * * * su nagios -c "/usr/local/ncs/ncs_and_report_to_image.bash -s=npro-vps-01 -n=1 -t=/usr/local/ncs/resources/templates/doom -o=/home/hosting/nelbren/2016_pelican/output/images/nagios"
*/5 * * * * su nagios -c "/usr/local/ncs/ncs_and_report_to_image.bash -s=ndev-vps-01 -n=2 -t=/usr/local/ncs/resources/templates/doom -o=/home/hosting/nelbren/2016_pelican/output/images/nagios"
                      

Examples from pelican.npr3s.net

Number: 1
System: npro-vps-01
Theme: Doom
Source: Faces of Doom
Image: status_npro-vps-01
Number: 2
System: ndev-vps-01
Theme: Doom
Source: Faces of Doom
Image: status_ndev-vps-01

2 Config crontab

crontab -l | grep ncs
*/5 * * * * su nagios -c "/usr/local/ncs/ncs_and_report_to_image.bash -s=npro-vps-01 -n=1 -t=/usr/local/ncs/resources/templates/flat-lines-circled -o=/home/hosting/nelbren/2016_pelican/output/images/nagios"
*/5 * * * * su nagios -c "/usr/local/ncs/ncs_and_report_to_image.bash -s=ndev-vps-01 -n=2 -t=/usr/local/ncs/resources/templates/flat-lines-circled -o=/home/hosting/nelbren/2016_pelican/output/images/nagios"
                      

Examples from pelican.npr3s.com

Number: 1
System: npro-vps-01
Theme: flat-lines-circled
Source: Flat Lines Circled
Image: status_npro-vps-01
Number: 2
System: ndev-vps-01
Theme: flat-lines-circled
Source: Flat Lines Circled
Image: status_ndev-vps-01

Top