Create an alert for more than one superuser on server
Posted: Mon Jul 29, 2013 7:05 am
Yes I am trying to figure out how to write a plugin that contains conditional logic in regards to sending an alert if more than one superuser exists on the server. The only thing I have so far is the following command:
awk -F: '{if ($3 < 1) print $0}' < /etc/passwd
which prints --> root
0:0:root:/root:/bin/bash
This is close to what I need however I need this to report if the total count is more than one and I have no clue how to convert this into commands
So another words if I ran the same command and it printed the following then send an alert
awk -F: '{if ($3 < 1) print $0}' < /etc/passwd
root
0:0:root:/root:/bin/bash
super
0:0:super:/super:/bin/bash
-> send alert to Nagios
Any help is appreciated.
awk -F: '{if ($3 < 1) print $0}' < /etc/passwd
which prints --> root
This is close to what I need however I need this to report if the total count is more than one and I have no clue how to convert this into commands
So another words if I ran the same command and it printed the following then send an alert
awk -F: '{if ($3 < 1) print $0}' < /etc/passwd
root
super
-> send alert to Nagios
Any help is appreciated.